Skip to content

Commit e02c9c0

Browse files
committed
fix : support both element magnetization and atomic magnetization for initial
1 parent 5eca0f1 commit e02c9c0

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

source/module_cell/read_atoms.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &o
589589
mv.z = true ;
590590
atoms[it].vel[ia].set(0,0,0);
591591
#ifndef __CMD
592-
//atoms[it].mag[ia]=magnet.start_magnetization[it];//if this line is used, default startmag_type would be 2
592+
atoms[it].mag[ia]=magnet.start_magnetization[it];//if this line is used, default startmag_type would be 2
593593
#endif
594594
atoms[it].angle1[ia]=0;
595595
atoms[it].angle2[ia]=0;
@@ -633,7 +633,6 @@ bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &o
633633
tmp=ifpos.get();
634634
}
635635

636-
cout<<"tmp"<<tmp<<'\n';
637636
if((tmp >= 48 && tmp <= 57) or tmp=='-')
638637
{
639638
ifpos.putback(tmp);

source/src_pw/charge.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,11 @@ void Charge::atomic_rho(const int spin_number_need, double** rho_in)const // Pe
212212
// check the start magnetization
213213
const int startmag_type = [&]()->int
214214
{
215-
if(GlobalV::NSPIN==4) //zhengdy-soc, type 2 is still wrong.
216-
return 1;
217215
for(int it=0; it<GlobalC::ucell.ntype; it++)
218-
for(int ia=0; ia<GlobalC::ucell.atoms[it].na; ia++)
219-
if(GlobalC::ucell.atoms[it].mag[ia]!=0.0)
220-
return 2;
221-
return 1;
216+
{
217+
if( GlobalC::ucell.magnet.start_magnetization[it] != 0.0) return 1;
218+
}
219+
return 2;
222220
}();
223221
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_warning,"startmag_type",startmag_type);
224222

0 commit comments

Comments
 (0)