Skip to content

Commit

Permalink
Fix: Abnormal energies in z direction mag for an isotropic magnetic s…
Browse files Browse the repository at this point in the history
…ystem (#3177)
  • Loading branch information
hongriTianqi authored Nov 9, 2023
1 parent e6dbde1 commit 49c4821
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions source/module_cell/read_atoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,9 @@ bool UnitCell::read_atom_positions(std::ifstream &ifpos, std::ofstream &ofs_runn
{
if(GlobalV::NONCOLIN)
{
//if magnetization only along z-axis, default settings are DOMAG_Z=true and DOMAG=false
GlobalV::DOMAG_Z = false;
GlobalV::DOMAG = true;
if(input_angle_mag)
{
atoms[it].m_loc_[ia].z = atoms[it].mag[ia] *
Expand All @@ -637,9 +640,6 @@ bool UnitCell::read_atom_positions(std::ifstream &ifpos, std::ofstream &ofs_runn
sin(atoms[it].angle1[ia]) * cos(atoms[it].angle2[ia]);
atoms[it].m_loc_[ia].y = atoms[it].mag[ia] *
sin(atoms[it].angle1[ia]) * sin(atoms[it].angle2[ia]);
//if magnetization only along z-axis, default settings are DOMAG_Z=true and DOMAG=false
GlobalV::DOMAG_Z = false;
GlobalV::DOMAG = true;
}
}
else if (input_vec_mag)
Expand All @@ -649,9 +649,6 @@ bool UnitCell::read_atom_positions(std::ifstream &ifpos, std::ofstream &ofs_runn
if(mxy>1e-8)
{
atoms[it].angle2[ia]=atan2(atoms[it].m_loc_[ia].y,atoms[it].m_loc_[ia].x);
//if magnetization only along z-axis, default settings are DOMAG_Z=true and DOMAG=false
GlobalV::DOMAG_Z = false;
GlobalV::DOMAG = true;
}
}
}
Expand Down

0 comments on commit 49c4821

Please sign in to comment.