Skip to content

Commit

Permalink
Reconstruction MD: (#35)
Browse files Browse the repository at this point in the history
* update (#2)

* modify h_psi to make it able to calculate all bands in one time

* add ORB_api in src_external

* update ORB_api and modifies related files in ABACUS

* 1. add OpenMP in PW_Basis::setup_structure_factor

* fix a bug in schmit_orth which results from commit e647aa9

* update ORB files

* delete usage of tools.h in ORB_gaunt_table

* 1. delete unnecessary header files included in class Sph_Bessel_Recursive

* add lat0 parameter in ORB_control::set_orb_tables subroutine to minimize global variables

* modify ORB_table_beta.cpp and ORB_table_beta.h

* set ntype as an input parameter

* keep eliminating global variables in ORB files

* keep eliminating global variables in ORB

* add math_integral class

* delete SimpsonIntegrals in Mathzone, use the one in src_global/math_integral.h instead

* some files haven't be successfully submitted in reading descriptor

* make Exx_Abfs::Lmax as an input for ORB module

* fix a bug in h_psi for NSPIN!=4

* out lcao-line descriptor

* add new input parameter read_file_dir

* eliminate inclusion of global files in ORB* files

* add __NORMAL option in complex to avoid linking to lapack in some cases

* update matrix to make connecting to lapack unnecessary

* update of ORB files

* optimize src_lcao/LCAO_gen_fixedH.cpp

* delete useless variable itia* in ORB_read

* delete nkb variable in ORB_read, the variable has been defined in ppcell.nkb

* add GRID_api in src_external

* fixed bug in cell-relax, start refactor after_vc part

* fix a segfault in src_lcao/LCAO_gen_fixedH.cpp

* delte NEW_DM global variable, use INPUT.new_dm instead, this will be modified further in future

* add some comments in ylm and ORB_gen_tables

* fixed a bug in FORCE&&STRESS, but this part still puzzling

* refactor some repete codes in Unitcell

* update grid base

* seems a bug in src_lcao/LCAO_gen_fixedH.cpp when multiple cores are parallel

* 1. add BSSE for lcao
	1.1 src_pw/pseudopot_upf.h
	1.2 src_pw/pseudopot_upf.cpp
	1.3 src_pw/atom_pseudo.h
	1.4 src_io/read_atoms.cpp
	1.5 src_io/read_pseudopot.cpp
	1.6 src_pw/charge.cpp

2. refactor Charge::atomic_rho()
	2.1 src_pw/charge.cpp

* fixed nspin=2 bug

* fix bugs in lcao-line descriptor

* fix ORB_gen_tables conflicts

* revert

* fix a bug about no initialization of variable

* DFT+U stress

Fix bug of stress of DFT+U; Change fortran code lscc.f90 to C++

* Delete lscc.f

* Revert "DFT+U"

* fix a bug when the pseudopotential dir is incorrect

* delete ucell.lmax in ORB*

* set ORB parameters in ORB codes, not through global variables

* 1. fix bug of flag_empty_element

* 1. delete testing header file

* fixed bug of relax

* 1. add Matrix3::Zero()

* 1. fix bug in Vdwd2::cal_stress()

* DFT+U (#25)

* DFT+U

fix the problem of dftu_relax.h header file

* DFT+U

Fix bug in stress calculation; delete lscc.f

* Update README

* avoid using INPUT.descriptor

* update soc class for non-local pseudopotential initial

* 1. add bcast flag_empty_element in Atom::bcast_atom()

* update reader of upf ONCV pseudopotential

* eliminate INPUT.descriptor in ORB codes

* cleanup some .h files

* update formats in ORB

* update ORB_gen_tables

* delete Coefficient_D in ORB_nonlocal

* keep cleaning ORB_nonlocal

* keep cleaning ORB

* add __OPENMP option for openmp codes

* update ORB codes

* add parameter in set_orb

* keep on updating ORB

* delete a useless variable in ORB_read

* delte a useless function in ORB_read

* add MY_RANK as an input parameter for ORB module

* add two variables in set_orb

* update ORB

* update file pointers in ORB

* add correct warning when the orbital files cannot be found

* ready for reconstruction of nchi array for ORB module

* update some formats in pdiag_double

* extract common parts in 'Read_PAO' and 'Read_Descriptor' to function 'read_orb_file'

* 1. fix bug of operator*(const double&, const Matrix3&)
2. delete default parameters in Matrix3()

* 1. delete Matrix3::Reset()

* Update README

* reformat some pseudopotential codes

* delete pseudo_us class

* merge pseudo_atom and pseudo_h classes to pseudo_nc

* update pseudo_nc

* update ORB include files

* change pseudopot_cell_vl and _vnl to more appropriate names, namely, VL_in_pw and VNL_in_pw, respectively

* divide pseudopot_upf to two files

* change read_pseudopot to read_cell_pseudopots

* divide read_pseudopotentials to three formats: upf100 stands for version of upf, upf201 stands for upf.2.0.1, and vwr

* add vdwd3

Co-authored-by: Han Wang <amcadmus@gmail.com>
Co-authored-by: qianrui <Terry_Liu@pku.edu.cn>
Co-authored-by: mohan <mohan.chen.chen.mohan@gmail.com>
Co-authored-by: linpz <linpz@mail.ustc.edu.cn>
Co-authored-by: maki49 <1579492865@qq.com>
Co-authored-by: Yu Liu <77716030+YuLiu98@users.noreply.github.com>
Co-authored-by: YuLiu <liuyu@stu.pku.edu.cn>
Co-authored-by: 80610702-git <quxin@mail.ustc.edu.cn>
Co-authored-by: Quxin <78459762+80610702-git@users.noreply.github.com>
Co-authored-by: jiyuyang <jiyuyang@mail.ustc.edu.cn>

* Revert "update (#2)" (#4)

This reverts commit 14b481f.

* fixed bug in stress-ewald

* reconstruction MD

* debug of merge before

* add FIRE option: md_mdtype = -1

Co-authored-by: Han Wang <amcadmus@gmail.com>
Co-authored-by: qianrui <Terry_Liu@pku.edu.cn>
Co-authored-by: mohan <mohan.chen.chen.mohan@gmail.com>
Co-authored-by: linpz <linpz@mail.ustc.edu.cn>
Co-authored-by: maki49 <1579492865@qq.com>
Co-authored-by: Yu Liu <77716030+YuLiu98@users.noreply.github.com>
Co-authored-by: YuLiu <liuyu@stu.pku.edu.cn>
Co-authored-by: 80610702-git <quxin@mail.ustc.edu.cn>
Co-authored-by: Quxin <78459762+80610702-git@users.noreply.github.com>
Co-authored-by: jiyuyang <jiyuyang@mail.ustc.edu.cn>
  • Loading branch information
11 people authored May 15, 2021
1 parent 7393ee1 commit ca011a5
Show file tree
Hide file tree
Showing 30 changed files with 1,367 additions and 3,715 deletions.
7 changes: 4 additions & 3 deletions ABACUS.develop/source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ chi0_hilbert.o\
chi0_standard.o\
epsilon0_pwscf.o\
epsilon0_vasp.o\
md.o\
mdNVE.o\
mdNVT.o\
MD_basic.o\
MD_thermo.o\
MD_fire.o\
MD_func.o\
exx_lip.o\
soc.o\
to_wannier90.o \
Expand Down
120 changes: 37 additions & 83 deletions ABACUS.develop/source/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,27 +292,6 @@ void Input::Default(void)
md_tstep=1; //reduec md_delt every md_tstep step.
md_delt=1.0;
*/
//md and related parameters(added by zheng da ye)
md_mdtype=1;
md_tauthermo=0;
md_taubaro=0;
md_dt=-1;
md_nresn=3;
md_nyosh=3;
md_qmass=1;
md_tfirst=-1; //kelvin
md_tlast=md_tfirst;
md_dumpmdfred=1;
md_mdoutpath="mdoutput";
md_domsd=0;
md_domsdatom=0;
md_rstmd=0;
md_outputstressperiod=1;
md_fixtemperature=1;
md_ediff=1e-4;
md_ediffg=1e-3;
md_msdstartTime=1;
//end of zhengdaye's add.

/* //----------------------------------------------------------
// vdwD2 //Peize Lin add 2014-03-31, update 2015-09-30
Expand Down Expand Up @@ -1128,79 +1107,59 @@ bool Input::Read(const string &fn)
//added begin by zheng daye
else if (strcmp("md_mdtype",word) == 0)
{
read_value(ifs, md_mdtype);
read_value(ifs, mdp.mdtype);
}
else if (strcmp("md_tauthermo",word) == 0)
else if (strcmp("NVT_tau",word) == 0)
{
read_value(ifs, md_tauthermo);
read_value(ifs, mdp.NVT_tau);
}
else if (strcmp("md_taubaro",word) == 0)
else if (strcmp("NVT_control",word) == 0)
{
read_value(ifs,md_taubaro );
read_value(ifs,mdp.NVT_control );
}
else if (strcmp("md_dt",word) == 0)
{
read_value(ifs, md_dt);
read_value(ifs, mdp.dt);
}
else if (strcmp("md_nresn",word) == 0)
else if (strcmp("mnhc",word) == 0)
{
read_value(ifs,md_nresn );
}
else if (strcmp("md_nyosh",word) == 0)
{
read_value(ifs, md_nyosh);
read_value(ifs,mdp.MNHC );
}
else if (strcmp("md_qmass",word) == 0)
{
read_value(ifs,md_qmass );
read_value(ifs,mdp.Qmass );
}
else if (strcmp("md_tfirst",word) == 0)
{
read_value(ifs, md_tfirst);
read_value(ifs, mdp.tfirst);
}
else if (strcmp("md_tlast",word) == 0)
{
read_value(ifs,md_tlast );
read_value(ifs,mdp.tlast );
}
else if (strcmp("md_dumpmdfred",word) == 0)
{
read_value(ifs, md_dumpmdfred);
read_value(ifs, mdp.recordFreq);
}
else if (strcmp("md_mdoutpath",word) == 0)
{
read_value(ifs,md_mdoutpath );
}
else if (strcmp("md_domsd",word) == 0)
{
read_value(ifs, md_domsd);
}
else if (strcmp("md_domsdatom",word) == 0)
{
read_value(ifs, md_domsdatom);
read_value(ifs,mdp.mdoutputpath );
}
else if (strcmp("md_rstmd",word) == 0)
{
read_value(ifs,md_rstmd );
}
else if (strcmp("md_outputstressperiod",word) == 0)
{
read_value(ifs,md_outputstressperiod );
read_value(ifs,mdp.rstMD );
}
else if (strcmp("md_fixtemperature",word) == 0)
{
read_value(ifs,md_fixtemperature );
read_value(ifs,mdp.fixTemperature );
}
else if (strcmp("md_ediff",word) == 0)
{
read_value(ifs,md_ediff );
read_value(ifs,mdp.ediff );
}
else if (strcmp("md_ediffg",word) == 0)
{
read_value(ifs,md_ediffg );
}
else if (strcmp("md_msdstarttime",word) == 0)
{
read_value(ifs,md_msdstartTime );
read_value(ifs,mdp.ediffg );
}
//added by zheng daye
//----------------------------------------------------------
Expand Down Expand Up @@ -2087,7 +2046,7 @@ void Input::Bcast()
Parallel_Common::bcast_int( selinv_niter);
/*
// mohan add 2011-11-07
Parallel_Common::bcast_double( md_dt );
Parallel_Common::bcast_double( mdp.dt );
Parallel_Common::bcast_int( md_restart );
Parallel_Common::bcast_double( md_tolv );
Parallel_Common::bcast_string( md_thermostat );
Expand All @@ -2096,25 +2055,20 @@ void Input::Bcast()
Parallel_Common::bcast_double( md_delt );
*/
//zheng daye add 2014/5/5
Parallel_Common::bcast_int(md_mdtype);
Parallel_Common::bcast_double(md_tauthermo);
Parallel_Common::bcast_double(md_taubaro);
Parallel_Common::bcast_double(md_dt);
Parallel_Common::bcast_int(md_nresn);
Parallel_Common::bcast_int(md_nyosh);
Parallel_Common::bcast_double(md_qmass);
Parallel_Common::bcast_double(md_tfirst);
Parallel_Common::bcast_double(md_tlast);
Parallel_Common::bcast_int(md_dumpmdfred);
Parallel_Common::bcast_string(md_mdoutpath);
Parallel_Common::bcast_bool(md_domsd);
Parallel_Common::bcast_bool(md_domsdatom);
Parallel_Common::bcast_int(md_rstmd);
Parallel_Common::bcast_int(md_outputstressperiod);
Parallel_Common::bcast_int(md_fixtemperature);
Parallel_Common::bcast_double(md_ediff);
Parallel_Common::bcast_double(md_ediffg);
Parallel_Common::bcast_int(md_msdstartTime);
Parallel_Common::bcast_int(mdp.mdtype);
Parallel_Common::bcast_double(mdp.NVT_tau);
Parallel_Common::bcast_int(mdp.NVT_control);
Parallel_Common::bcast_double(mdp.dt);
Parallel_Common::bcast_int(mdp.MNHC);
Parallel_Common::bcast_double(mdp.Qmass);
Parallel_Common::bcast_double(mdp.tfirst);
Parallel_Common::bcast_double(mdp.tlast);
Parallel_Common::bcast_int(mdp.recordFreq);
Parallel_Common::bcast_string(mdp.mdoutputpath);
Parallel_Common::bcast_int(mdp.rstMD);
Parallel_Common::bcast_int(mdp.fixTemperature);
Parallel_Common::bcast_double(mdp.ediff);
Parallel_Common::bcast_double(mdp.ediffg);
/* // Peize Lin add 2014-04-07
Parallel_Common::bcast_bool( vdwD2 );
Parallel_Common::bcast_double( vdwD2_scaling );
Expand Down Expand Up @@ -2483,10 +2437,10 @@ void Input::Check(void)

//deal with input parameters , 2019-04-30
if(basis_type == "pw" ) WARNING_QUIT("Input::Check","calculate = MD is only availble for LCAO.");
if(md_dt == -1) WARNING_QUIT("Input::Check","time interval of MD calculation should be set!");
if(md_tfirst == -1) WARNING_QUIT("Input::Check","temperature of MD calculation should be set!");
if(md_tlast == -1) md_tlast = md_tfirst;
if(md_tfirst!=md_tlast)
if(mdp.dt < 0) WARNING_QUIT("Input::Check","time interval of MD calculation should be set!");
if(mdp.tfirst < 0) WARNING_QUIT("Input::Check","temperature of MD calculation should be set!");
if(mdp.tlast < 0.0) mdp.tlast = mdp.tfirst;
if(mdp.tfirst!=mdp.tlast)
{
ifstream file1;
file1.open("ChangeTemp.dat");
Expand All @@ -2496,7 +2450,7 @@ void Input::Check(void)
file.open("ChangeTemp.dat");
for(int ii=0;ii<30;ii++)
{
file<<md_tfirst+(md_tlast-md_tfirst)/double(30)*double(ii+1)<<" ";
file<<mdp.tfirst+(mdp.tlast-mdp.tfirst)/double(30)*double(ii+1)<<" ";
}
file.close();
}
Expand Down
6 changes: 4 additions & 2 deletions ABACUS.develop/source/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "src_global/vector3.h"
#include <string>
#include "src_pw/MD_parameters.h"
using namespace std;

class Input
Expand Down Expand Up @@ -244,7 +245,7 @@ class Input
// molecular dynamics
// added by Daye Zheng
//==========================================================
int md_mdtype; //choose ensemble
/* int md_mdtype; //choose ensemble
double md_tauthermo;
double md_taubaro;
double md_dt; //time step
Expand All @@ -262,7 +263,8 @@ class Input
int md_fixtemperature; //period to change temperature
double md_ediff; //parameter for constraining total energy change
double md_ediffg; //parameter for constraining max force change
int md_msdstartTime; //choose which step that msd be calculated
int md_msdstartTime; //choose which step that msd be calculated */
MD_parameters mdp;

//==========================================================
// vdw
Expand Down
9 changes: 5 additions & 4 deletions ABACUS.develop/source/src_io/print_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ void Print_Info::setup_parameters(void)

cout << " ---------------------------------------------------------" << endl;

if(INPUT.md_mdtype ==1 || INPUT.md_mdtype==2)
if(INPUT.mdp.mdtype ==1 || INPUT.mdp.mdtype==2)
{
cout << " ENSEMBLE : " << "NVT" << endl;
cout << " Qmass for NVT(a.u.) : " << INPUT.mdp.Qmass/6.02/9.109*1e5 << endl;
}
else if(INPUT.md_mdtype==0)
else if(INPUT.mdp.mdtype==0)
{
cout << " ENSEMBLE : " << "NVE" << endl;
}
cout << " Qmass for NVT(a.u.) : " << INPUT.md_qmass/6.02/9.109*1e5 << endl;
cout << " Time interval(fs) : " << INPUT.md_dt << endl;

cout << " Time interval(fs) : " << INPUT.mdp.dt << endl;
}
cout << " ---------------------------------------------------------" << endl;

Expand Down
30 changes: 14 additions & 16 deletions ABACUS.develop/source/src_io/write_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,20 @@ void Input::Print(const string &fn)const
OUTP(ofs,"selinv_niter",selinv_niter,"max number of steps to update mu");

ofs << "\n#Parameters (10.Molecular dynamics)" << endl;
OUTP(ofs,"md_mdtype",md_mdtype,"choose ensemble");
OUTP(ofs,"md_dt",md_dt,"time step");
OUTP(ofs,"md_nresn",md_nresn,"parameter during integrater");
OUTP(ofs,"md_nyosh",md_nyosh,"parameter during integrater");
OUTP(ofs,"md_qmass",md_qmass,"mass of thermostat");
OUTP(ofs,"md_tfirst",md_tfirst,"temperature first");
OUTP(ofs,"md_tlast",md_tlast,"temperature last");
OUTP(ofs,"md_dumpmdfred",md_dumpmdfred,"The period to dump MD information for monitoring and restarting MD");
OUTP(ofs,"md_mdoutpath",md_mdoutpath,"output path of md");
OUTP(ofs,"md_domsd",md_domsd,"whether compute <r(t)-r(0)>");
OUTP(ofs,"md_domsdatom",md_domsdatom,"whether compute msd for each atom");
OUTP(ofs,"md_rstmd",md_rstmd,"whether restart");
OUTP(ofs,"md_fixtemperature",md_fixtemperature,"period to change temperature");
OUTP(ofs,"md_ediff",md_ediff,"parameter for constraining total energy change");
OUTP(ofs,"md_ediffg",md_ediffg,"parameter for constraining max force change");
OUTP(ofs,"md_msdstarttime",md_msdstartTime,"choose which step that msd be calculated");
OUTP(ofs,"md_mdtype",mdp.mdtype,"choose ensemble");
OUTP(ofs,"md_dt",mdp.dt,"time step");
OUTP(ofs,"mnhc",mdp.MNHC,"number of Nose-Hoover chains");
OUTP(ofs,"md_qmass",mdp.Qmass,"mass of thermostat");
OUTP(ofs,"md_tfirst",mdp.tfirst,"temperature first");
OUTP(ofs,"md_tlast",mdp.tlast,"temperature last");
OUTP(ofs,"md_dumpmdfred",mdp.recordFreq,"The period to dump MD information for monitoring and restarting MD");
OUTP(ofs,"md_mdoutpath",mdp.mdoutputpath,"output path of md");
OUTP(ofs,"md_rstmd",mdp.rstMD,"whether restart");
OUTP(ofs,"md_fixtemperature",mdp.fixTemperature,"period to change temperature");
OUTP(ofs,"md_ediff",mdp.ediff,"parameter for constraining total energy change");
OUTP(ofs,"md_ediffg",mdp.ediffg,"parameter for constraining max force change");
OUTP(ofs,"NVT_tau",mdp.NVT_tau,"parameter for adjust effect of thermostat");
OUTP(ofs,"NVT_control",mdp.NVT_control,"choose which thermostat used in NVT ensemble");

ofs << "\n#Parameters (11.Efield)" << endl;
OUTP(ofs,"efield",efield,"add electric field");
Expand Down
2 changes: 1 addition & 1 deletion ABACUS.develop/source/src_ions/variable_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void Variable_Cell::final_calculation_after_vc(void)
cout<<" -----------------------------------------------------------------"<<endl;

cout<<"\n -----------------------------------------------------------------"<<endl;
cout<<" The structure has been fully relaxed, and the following is a scf"<<endl;
cout<<" The structure has been fully relaxed or MD finished, and the following is a scf"<<endl;
cout<<" calculation at the final structure. The fft grids and G-vectors "<<endl;
cout<<" are recalculated for the final relaxed unit cell."<<endl;
cout<<" -----------------------------------------------------------------"<<endl;
Expand Down
8 changes: 4 additions & 4 deletions ABACUS.develop/source/src_lcao/ELEC_evolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ void ELEC_evolve::using_LAPACK_complex(const int &ik, complex<double>** c, compl
double delta_t;
// delta_t = 0.2; //identity: fs;
ComplexMatrix Numerator(NLOCAL,NLOCAL);
Numerator = Idmat - 0.5*INPUT.md_dt*41.34*Denominator;
Denominator = Idmat + 0.5*INPUT.md_dt*41.34*Denominator;
Numerator = Idmat - 0.5*INPUT.mdp.dt*41.34*Denominator;
Denominator = Idmat + 0.5*INPUT.mdp.dt*41.34*Denominator;

int info;
int lwork=3*NLOCAL-1; //tmp
Expand Down Expand Up @@ -368,8 +368,8 @@ void ELEC_evolve::using_LAPACK_complex_2(const int &ik, complex<double>** c, com
}
double delta_t;
ComplexMatrix Numerator(NLOCAL,NLOCAL);
Numerator = Idmat - 0.5*INPUT.md_dt*41.34*Denominator;
Denominator = Idmat + 0.5*INPUT.md_dt*41.34*Denominator;
Numerator = Idmat - 0.5*INPUT.mdp.dt*41.34*Denominator;
Denominator = Idmat + 0.5*INPUT.mdp.dt*41.34*Denominator;

int info;
int lwork=3*NLOCAL-1; //tmp
Expand Down
1 change: 1 addition & 0 deletions ABACUS.develop/source/src_lcao/FORCE_STRESS.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Force_Stress_LCAO
friend void Input_Conv::Convert();
friend class Update_input;
friend class LOOP_ions;
friend class MD_func;

public :

Expand Down
4 changes: 2 additions & 2 deletions ABACUS.develop/source/src_lcao/LCAO_evolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ void Evolve_LCAO_Matrix::using_LAPACK_complex(const int &ik, complex<double>** c
double delta_t;
// delta_t = 0.2; //identity: fs;
ComplexMatrix Numerator(NLOCAL,NLOCAL);
Numerator = Idmat - 0.5*INPUT.md_dt*41.34*Denominator;
Denominator = Idmat + 0.5*INPUT.md_dt*41.34*Denominator;
Numerator = Idmat - 0.5*INPUT.mdp.dt*41.34*Denominator;
Denominator = Idmat + 0.5*INPUT.mdp.dt*41.34*Denominator;

int info;
int lwork=3*NLOCAL-1; //tmp
Expand Down
Loading

0 comments on commit ca011a5

Please sign in to comment.