diff --git a/source/module_cell/read_atoms.cpp b/source/module_cell/read_atoms.cpp index 6e924b3203..195f5fdc52 100644 --- a/source/module_cell/read_atoms.cpp +++ b/source/module_cell/read_atoms.cpp @@ -589,7 +589,7 @@ bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &o mv.z = true ; atoms[it].vel[ia].set(0,0,0); #ifndef __CMD - //atoms[it].mag[ia]=magnet.start_magnetization[it];//if this line is used, default startmag_type would be 2 + atoms[it].mag[ia]=magnet.start_magnetization[it];//if this line is used, default startmag_type would be 2 #endif atoms[it].angle1[ia]=0; atoms[it].angle2[ia]=0; @@ -633,7 +633,6 @@ bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &o tmp=ifpos.get(); } - cout<<"tmp"<= 48 && tmp <= 57) or tmp=='-') { ifpos.putback(tmp); diff --git a/source/module_symmetry/symmetry.cpp b/source/module_symmetry/symmetry.cpp index 5397295d13..d93b53686c 100644 --- a/source/module_symmetry/symmetry.cpp +++ b/source/module_symmetry/symmetry.cpp @@ -127,7 +127,7 @@ void Symmetry::analy_sys(const UnitCell_pseudo &ucell, std::ofstream &ofs_runnin new_lat.e11=a1.x; new_lat.e12=a1.y; new_lat.e13=a1.z; new_lat.e21=a2.x; new_lat.e22=a2.y; new_lat.e23=a2.z; new_lat.e31=a3.x; new_lat.e32=a3.y; new_lat.e33=a3.z; - output::printM3(ofs_running,"STANDARD LATTICE VECTORS: (CARTESIAN COORDINATE: IN UNIT OF A0)",new_lat); + //output::printM3(ofs_running,"STANDARD LATTICE VECTORS: (CARTESIAN COORDINATE: IN UNIT OF A0)",new_lat); int iat=0; for(int it=0; itchange_lattice(); //this->pricell(); // pengfei Li 2018-05-14 //for( iat =0 ; iat < ucell.nat ; iat++) // std::cout << " newpos_now = " << newpos[3*iat] << " " << newpos[3*iat+1] << " " << newpos[3*iat+2] << std::endl; - ModuleBase::GlobalFunc::OUT(ofs_running,"ibrav",ibrav); - this->setgroup(this->symop, this->nop, this->ibrav); - //now select all symmetry operations which reproduce the lattice - //to find those symmetry operations which reproduce the entire crystal - this->getgroup(this->nrot, this->nrotk, ofs_running); - // find the name of point group - this->pointgroup(this->nrot, this->pgnumber, this->pgname, this->gmatrix, ofs_running); - ModuleBase::GlobalFunc::OUT(ofs_running,"POINT GROUP", this->pgname); - //write(); + test_brav = true; // output the real ibrav and point group + ModuleBase::GlobalFunc::OUT(ofs_running,"ibrav",real_brav); + this->setgroup(this->symop, this->nop, this->real_brav); + this->getgroup(this->nrot, this->nrotk, ofs_running); + this->pointgroup(this->nrot, this->pgnumber, this->pgname, this->gmatrix, ofs_running); + ModuleBase::GlobalFunc::OUT(ofs_running,"POINT GROUP", this->pgname); + ofs_running<<"Warning : If the optimal symmetric configuration is not the input configuration, "<<'\n'; + ofs_running<<"you have to manually change configurations, ABACUS would only calculate the input structure!"<<'\n'; + + test_brav = false; // use the input ibrav to calculate + //ModuleBase::GlobalFunc::OUT(ofs_running,"ibrav",ibrav); + this->setgroup(this->symop, this->nop, this->ibrav); + //now select all symmetry operations which reproduce the lattice + //to find those symmetry operations which reproduce the entire crystal + this->getgroup(this->nrot, this->nrotk, ofs_running); + // find the name of point group + this->pointgroup(this->nrot, this->pgnumber, this->pgname, this->gmatrix, ofs_running); + // ModuleBase::GlobalFunc::OUT(ofs_running,"POINT GROUP", this->pgname); + //write(); delete[] dirpos; delete[] newpos; @@ -705,6 +715,7 @@ void Symmetry::lattice_type( // GlobalV::ofs_running << " pre_brav=" << pre_brav << std::endl; // GlobalV::ofs_running << " temp_brav=" << temp_brav << std::endl; + if ( temp_brav < pre_brav) { //if the symmetry of the new vectors is higher, store the new ones @@ -771,7 +782,6 @@ void Symmetry::lattice_type( } } ofs.close(); - } @@ -811,9 +821,12 @@ void Symmetry::lattice_type( } }*/ brav = pre_brav; - bravname = get_brav_name(brav); + //brav = temp_brav; + //bravname = get_brav_name(brav); + real_brav = temp_brav; // pengfei Li 15-3-2022 + bravname = get_brav_name(real_brav); - ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"BRAVAIS TYPE",brav); + ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"BRAVAIS TYPE",real_brav); ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"BRAVAIS LATTICE NAME",bravname); return; } @@ -1209,8 +1222,12 @@ void Symmetry::getgroup(int &nrot, int &nrotk, std::ofstream &ofs_running) //total number of space group operations //----------------------------------------------------- nrotk += nrot; - ModuleBase::GlobalFunc::OUT(ofs_running,"PURE POINT GROUP OPERATIONS",nrot); - ModuleBase::GlobalFunc::OUT(ofs_running,"SPACE GROUP OPERATIONS",nrotk); + + if(test_brav) + { + ModuleBase::GlobalFunc::OUT(ofs_running,"PURE POINT GROUP OPERATIONS",nrot); + ModuleBase::GlobalFunc::OUT(ofs_running,"SPACE GROUP OPERATIONS",nrotk); + } //----------------------------------------------------- //fill the rest of matrices and vectors with zeros @@ -1775,4 +1792,4 @@ void Symmetry::print_pos(const double* pos, const int &nat) } return; } -} \ No newline at end of file +} diff --git a/source/module_symmetry/symmetry.h b/source/module_symmetry/symmetry.h index 52893aa160..6c9ebefc7c 100644 --- a/source/module_symmetry/symmetry.h +++ b/source/module_symmetry/symmetry.h @@ -50,6 +50,7 @@ class Symmetry : public Symmetry_Basic int sym_test; int pbrav; int ibrav; + int real_brav; // the real ibrav for the cell pengfei Li 3-15-2022 std::string ilattname; //the bravais lattice type of the supercell std::string plattname; //the bravais lattice type of the primitive cell diff --git a/source/module_symmetry/symmetry_basic.cpp b/source/module_symmetry/symmetry_basic.cpp index 04ce843ea4..e07177234f 100644 --- a/source/module_symmetry/symmetry_basic.cpp +++ b/source/module_symmetry/symmetry_basic.cpp @@ -6,6 +6,7 @@ //#include "../src_pw/global.h" #include "../module_base/mymath.h" //#include "symm_other.h" +bool ModuleSymmetry::test_brav = 0; namespace ModuleSymmetry { @@ -811,7 +812,11 @@ void Symmetry_Basic::setgroup(ModuleBase::Matrix3* symop, int &nop, const int &i this->matrigen(symgen, 3, symop, nop); } - ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"ROTATION MATRICES",nop); + if(test_brav) + { + ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"ROTATION MATRICES",nop); + } + if(GlobalV::test_symmetry > 1) { GlobalV::ofs_running<<" THERE ARE " << nop << " ROTATION MATRICES FOR THE PURE BRAVAIS LATTICE"<int { - if(GlobalV::NSPIN==4) //zhengdy-soc, type 2 is still wrong. - return 1; for(int it=0; it