Skip to content

Commit f3f9d2d

Browse files
committed
Merge branch 'develop' of https://gitee.com/linpeize/abacus-develop_abacusmodeling into develop
2 parents 6dd6454 + 126336c commit f3f9d2d

File tree

20 files changed

+171
-15
lines changed

20 files changed

+171
-15
lines changed

source/input.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void Input::Default(void)
221221
//----------------------------------------------------------
222222
dr2 = 1.0e-9;
223223
niter = 40;
224-
nstep = 1;
224+
this->nstep = 0;
225225
out_stru = 0;
226226
//----------------------------------------------------------
227227
// occupation
@@ -948,7 +948,7 @@ bool Input::Read(const std::string &fn)
948948
}
949949
else if (strcmp("nstep", word) == 0)
950950
{
951-
read_value(ifs, nstep);
951+
read_value(ifs, this->nstep);
952952
}
953953
else if (strcmp("out_stru", word) == 0)
954954
{
@@ -2204,7 +2204,7 @@ void Input::Bcast()
22042204

22052205
Parallel_Common::bcast_double( dr2 );
22062206
Parallel_Common::bcast_int( niter );
2207-
Parallel_Common::bcast_int( nstep );
2207+
Parallel_Common::bcast_int( this->nstep );
22082208
Parallel_Common::bcast_int( out_stru ); //mohan add 2012-03-23
22092209

22102210
//Parallel_Common::bcast_string( occupations );
@@ -2562,7 +2562,7 @@ void Input::Check(void)
25622562
std::cout<<"sorry, can't calculate force with soc now, would be implement in next version!"<<std::endl;
25632563
}
25642564
*/
2565-
nstep = 1;
2565+
this->nstep = 1;
25662566

25672567
}
25682568
else if (calculation == "scf-sto") // qianrui 2021-2-20
@@ -2572,6 +2572,7 @@ void Input::Check(void)
25722572
mem_saver = 0;
25732573
ModuleBase::GlobalFunc::AUTO_SET("mem_savre","0");
25742574
}
2575+
this->nstep = 1;
25752576
}
25762577
else if (calculation == "relax") // pengfei 2014-10-13
25772578
{
@@ -2581,12 +2582,13 @@ void Input::Check(void)
25812582
ModuleBase::GlobalFunc::AUTO_SET("mem_savre","0");
25822583
}
25832584
force = 1;
2585+
if(! this->nstep) this->nstep = 50;
25842586
}
25852587

25862588
else if (calculation == "nscf")
25872589
{
25882590
GlobalV::CALCULATION = "nscf";
2589-
nstep = 1;
2591+
this->nstep = 1;
25902592
out_stru = 0;
25912593

25922594
//if (local_basis == 0 && linear_scaling == 0) xiaohui modify 2013-09-01
@@ -2610,7 +2612,7 @@ void Input::Check(void)
26102612
else if(calculation == "istate")
26112613
{
26122614
GlobalV::CALCULATION = "istate";
2613-
nstep = 1;
2615+
this->nstep = 1;
26142616
out_stru = 0;
26152617
out_dos = 0;
26162618
out_band = 0;
@@ -2631,7 +2633,7 @@ void Input::Check(void)
26312633
else if(calculation == "ienvelope")
26322634
{
26332635
GlobalV::CALCULATION = "ienvelope"; // mohan fix 2011-11-04
2634-
nstep = 1;
2636+
this->nstep = 1;
26352637
out_stru = 0;
26362638
out_dos = 0;
26372639
out_band = 0;
@@ -2653,6 +2655,10 @@ void Input::Check(void)
26532655
GlobalV::CALCULATION = "md";
26542656
symmetry = false;
26552657
force = 1;
2658+
if(this->nstep==0){
2659+
GlobalV::ofs_running<<"nstep should be set. Autoset nstep to 50!"<<endl;
2660+
this->nstep = 50;
2661+
}
26562662
if(!out_md_control) out_level = "m";//zhengdy add 2019-04-07
26572663

26582664
//deal with input parameters , 2019-04-30
@@ -2683,9 +2689,11 @@ void Input::Check(void)
26832689
{
26842690
force = 1;
26852691
stress = 1;
2692+
if(! this->nstep) this->nstep = 50;
26862693
}
26872694
else if(calculation == "test")
26882695
{
2696+
this->nstep = 1;
26892697
}
26902698
else
26912699
{

source/module_cell/read_atoms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ int UnitCell_pseudo::read_atom_species(std::ifstream &ifa, std::ofstream &ofs_ru
323323
latvec.e22 = bba * sinab;
324324
latvec.e23 = 0.0;
325325
latvec.e31 = cba * cosac;
326-
latvec.e32 = cba * (cosbc - cosac*cosab/sinab);
326+
latvec.e32 = cba * (cosbc - cosac*cosab) / sinab;
327327
term = 1.0 + 2.0 * cosab*cosac*cosbc - cosab*cosab - cosac*cosac - cosbc*cosbc;
328328
term = sqrt(term)/sinab;
329329
latvec.e33 = cba * term;
@@ -618,7 +618,7 @@ bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &o
618618
mv.z = true ;
619619
atoms[it].vel[ia].set(0,0,0);
620620
#ifndef __CMD
621-
atoms[it].mag[ia]=magnet.start_magnetization[it];
621+
//atoms[it].mag[ia]=magnet.start_magnetization[it];//if this line is used, default startmag_type would be 2
622622
#endif
623623
atoms[it].angle1[ia]=0;
624624
atoms[it].angle2[ia]=0;

source/src_pdiag/diag_scalapack_gvx.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ std::pair<int,std::vector<int>> Diag_Scalapack_gvx::pdsygvx_once(
4242
if (info)
4343
throw std::runtime_error("info = "+ModuleBase::GlobalFunc::TO_STRING(info)+".\n"+ModuleBase::GlobalFunc::TO_STRING(__FILE__)+" line "+ModuleBase::GlobalFunc::TO_STRING(__LINE__));
4444

45-
GlobalV::ofs_running<<"lwork="<<work[0]<<"\t"<<"liwork="<<iwork[0]<<std::endl;
45+
// GlobalV::ofs_running<<"lwork="<<work[0]<<"\t"<<"liwork="<<iwork[0]<<std::endl;
4646
lwork = work[0];
4747
work.resize(lwork,0);
4848
liwork = iwork[0];
@@ -55,7 +55,7 @@ std::pair<int,std::vector<int>> Diag_Scalapack_gvx::pdsygvx_once(
5555
work.data(), &lwork,
5656
iwork.data(), &liwork,
5757
ifail.data(), iclustr.data(), gap.data(), &info);
58-
GlobalV::ofs_running<<"M="<<M<<"\t"<<"NZ="<<NZ<<std::endl;
58+
// GlobalV::ofs_running<<"M="<<M<<"\t"<<"NZ="<<NZ<<std::endl;
5959

6060
if(info==0)
6161
return std::make_pair(info, std::vector<int>{});
@@ -110,7 +110,7 @@ std::pair<int,std::vector<int>> Diag_Scalapack_gvx::pzhegvx_once(
110110
if (info)
111111
throw std::runtime_error("info="+ModuleBase::GlobalFunc::TO_STRING(info)+". "+ModuleBase::GlobalFunc::TO_STRING(__FILE__)+" line "+ModuleBase::GlobalFunc::TO_STRING(__LINE__));
112112

113-
GlobalV::ofs_running<<"lwork="<<work[0]<<"\t"<<"lrwork="<<rwork[0]<<"\t"<<"liwork="<<iwork[0]<<std::endl;
113+
// GlobalV::ofs_running<<"lwork="<<work[0]<<"\t"<<"lrwork="<<rwork[0]<<"\t"<<"liwork="<<iwork[0]<<std::endl;
114114
lwork = work[0].real();
115115
work.resize(lwork,0);
116116
lrwork = rwork[0] + this->degeneracy_max * GlobalV::NLOCAL;
@@ -126,7 +126,7 @@ std::pair<int,std::vector<int>> Diag_Scalapack_gvx::pzhegvx_once(
126126
rwork.data(), &lrwork,
127127
iwork.data(), &liwork,
128128
ifail.data(), iclustr.data(), gap.data(), &info);
129-
GlobalV::ofs_running<<"M="<<M<<"\t"<<"NZ="<<NZ<<std::endl;
129+
// GlobalV::ofs_running<<"M="<<M<<"\t"<<"NZ="<<NZ<<std::endl;
130130

131131
if(info==0)
132132
return std::make_pair(info, std::vector<int>{});

source/src_pw/charge.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ void Charge::atomic_rho(const int spin_number_need, double** rho_in)const // Pe
331331
else if(spin_number_need==2)
332332
{
333333
if(startmag_type==1)
334-
{ cout<<"this should not be called";
334+
{
335335
for (int ig = 0; ig < GlobalC::pw.ngmc ; ig++)
336336
{
337337
const std::complex<double> swap = GlobalC::pw.strucFac(it, ig)* rho_lgl[GlobalC::pw.ig2ngg[ig]];
@@ -375,7 +375,7 @@ void Charge::atomic_rho(const int spin_number_need, double** rho_in)const // Pe
375375
{
376376
//noncolinear case
377377
if(startmag_type == 1)
378-
{cout<<"this would not be call";
378+
{
379379
for (int ig = 0; ig < GlobalC::pw.ngmc ; ig++)
380380
{
381381
const std::complex<double> swap = GlobalC::pw.strucFac(it, ig)* rho_lgl[GlobalC::pw.ig2ngg[ig]];

source/src_pw/forces.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ void Forces::print(const std::string &name, const ModuleBase::matrix &f, bool ry
264264

265265
GlobalV::ofs_running << " " << std::setw(8) << "atom" << std::setw(15) << "x" << std::setw(15) << "y" << std::setw(15) << "z" << std::endl;
266266
GlobalV::ofs_running << std::setiosflags(ios::showpos);
267+
GlobalV::ofs_running << std::setprecision(8);
267268

268269
const double fac = ModuleBase::Ry_to_eV / 0.529177;
269270

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
INPUT_PARAMETERS
2+
#Parameters (General)
3+
suffix autotest
4+
pseudo_dir ./
5+
ntype 1
6+
nbands 8
7+
calculation md
8+
9+
#Parameters (Accuracy)
10+
ecutwfc 20
11+
niter 20
12+
13+
basis_type lcao
14+
nstep 1
15+
16+
stress 1
17+
stress_thr 1e-6
18+
force 1
19+
force_thr_ev 1.0e-3
20+
21+
ks_solver genelpa
22+
mixing_type pulay
23+
mixing_beta 0.7
24+
25+
gamma_only 1
26+
27+
md_mdtype -1
28+
md_dt 1
29+
md_tfirst 0
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ATOMIC_SPECIES
2+
Si 1.000 ../tools/PP_ORB/Si_ONCV_PBE-1.0.upf #Element, Mass, Pseudopotential
3+
4+
NUMERICAL_ORBITAL
5+
../tools/PP_ORB/Si_gga_8au_60Ry_2s2p1d.orb
6+
7+
LATTICE_CONSTANT
8+
10.2 #Lattice constant
9+
10+
LATTICE_VECTORS
11+
0.5 0.5 0.0 #Lattice vector 1
12+
0.5 0.0 0.5 #Lattice vector 2
13+
0.0 0.5 0.5 #Lattice vector 3
14+
15+
ATOMIC_POSITIONS
16+
Cartesian #Cartesian(Unit is LATTICE_CONSTANT)
17+
Si #Name of element
18+
0.0 #Magnetic for this element.
19+
2 #Number of atoms
20+
0.00 0.00 0.00 1 1 1 #x,y,z, move_x, move_y, move_z
21+
0.241 0.255 0.251 1 1 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This test for FIRE-relax of Si2 crystal, 1step, gamma only
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
etotref -197.1251149938621836
2+
etotperatomref -98.5625574969
3+
totalforceref 4.771696
4+
totalstressref 1454.608711
5+
totaltimeref 24.73

tests/integrate/801_PW_LT_sc/INPUT

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
INPUT_PARAMETERS
2+
#Parameters (System)
3+
suffix autotest
4+
ntype 1
5+
nbands 4
6+
atom_file STRU
7+
kpoint_file KPT
8+
pseudo_dir ../tools/PP_ORB/
9+
calculation scf
10+
latname sc
11+
#Parameters (PW)
12+
ecutwfc 25.0 # Rydberg
13+
#Parameters (electronic)
14+
basis_type pw
15+
dr2 1e-10
16+
17+
force 1
18+
stress 1

0 commit comments

Comments
 (0)