Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions source/module_cell/read_atoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -633,7 +633,6 @@ bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &o
tmp=ifpos.get();
}

cout<<"tmp"<<tmp<<'\n';
if((tmp >= 48 && tmp <= 57) or tmp=='-')
{
ifpos.putback(tmp);
Expand Down
53 changes: 35 additions & 18 deletions source/module_symmetry/symmetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; it<ucell.ntype; ++it)
Expand Down Expand Up @@ -156,21 +156,31 @@ void Symmetry::analy_sys(const UnitCell_pseudo &ucell, std::ofstream &ofs_runnin
}


Symm_Other::print1(ibrav, cel_const, ofs_running);

//Symm_Other::print1(ibrav, cel_const, ofs_running);
Symm_Other::print1(real_brav, cel_const, ofs_running);
this->change_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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -771,7 +782,6 @@ void Symmetry::lattice_type(
}
}
ofs.close();


}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1775,4 +1792,4 @@ void Symmetry::print_pos(const double* pos, const int &nat)
}
return;
}
}
}
1 change: 1 addition & 0 deletions source/module_symmetry/symmetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 18 additions & 10 deletions source/module_symmetry/symmetry_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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"<<std::endl;
Expand Down Expand Up @@ -939,14 +944,17 @@ void Symmetry_Basic::pointgroup(const int &nrot, int &pgnumber, std::string &pgn
else if(trace == -2 && det == -1) ++ns3; //mohan add 2012-01-15
}

ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"C2",nc2);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"C3",nc3);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"C4",nc4);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"C6",nc6);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"S1",ns1);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"S3",ns3);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"S4",ns4);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"S6",ns6);
if(test_brav)
{
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"C2",nc2);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"C3",nc3);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"C4",nc4);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"C6",nc6);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"S1",ns1);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"S3",ns3);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"S4",ns4);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"S6",ns6);
}

if(nrot == 2)
{
Expand Down Expand Up @@ -1176,4 +1184,4 @@ void Symmetry_Basic::rotate( ModuleBase::Matrix3 &gmatrix, ModuleBase::Vector3<d
rk = rk%nr3;
return;
}
}
}
4 changes: 4 additions & 0 deletions source/module_symmetry/symmetry_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class Symmetry_Basic
void order_y(double *pos, const int &oldpos, const int &newpos);
void order_z(double *pos, const int &oldpos, const int &newpos);
};

//for test only
extern bool test_brav;

}//end of define namespace

#endif
10 changes: 4 additions & 6 deletions source/src_pw/charge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,11 @@ void Charge::atomic_rho(const int spin_number_need, double** rho_in)const // Pe
// check the start magnetization
const int startmag_type = [&]()->int
{
if(GlobalV::NSPIN==4) //zhengdy-soc, type 2 is still wrong.
return 1;
for(int it=0; it<GlobalC::ucell.ntype; it++)
for(int ia=0; ia<GlobalC::ucell.atoms[it].na; ia++)
if(GlobalC::ucell.atoms[it].mag[ia]!=0.0)
return 2;
return 1;
{
if( GlobalC::ucell.magnet.start_magnetization[it] != 0.0) return 1;
}
return 2;
}();
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_warning,"startmag_type",startmag_type);

Expand Down
2 changes: 2 additions & 0 deletions source/src_pw/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
remove_definitions(-D__MPI)
remove_definitions(-D__CUDA)
remove_definitions(-D__ROCM)
AddTest(
TARGET hsolver_david
LIBS ${math_libs} base
Expand Down
4 changes: 2 additions & 2 deletions tests/integrate/207_NO_KP_OD/result.ref
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
totaldosref 1189.53
totaltimeref 1.0555
totaldosref 1189.51
totaltimeref 0.84239
1 change: 1 addition & 0 deletions tests/integrate/304_NO_GO_AF/jd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test for initial magnetization from elements, anti-ferromagnetic Fe2, LCAO
34 changes: 34 additions & 0 deletions tests/integrate/304_NO_GO_AF_atommag/INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
INPUT_PARAMETERS
suffix autotest
ntype 2
#nbands 40

calculation scf
ecutwfc 20
scf_thr 1.0e-8
scf_nmax 50
out_chg 0

#init_chg file
#out_dos 1
#dos_sigma 0.05
#out_band 1

smearing_method gaussian
smearing_sigma 0.02

#cal_force 1
#force_thr_ev 0.01
#relax_method cg
#relax_bfgs_init 0.5

mixing_type pulay
mixing_beta 0.4


ks_solver genelpa
basis_type lcao
gamma_only 1
symmetry 0
nspin 2

4 changes: 4 additions & 0 deletions tests/integrate/304_NO_GO_AF_atommag/KPT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
K_POINTS
0
Gamma
1 1 1 0 0 0
29 changes: 29 additions & 0 deletions tests/integrate/304_NO_GO_AF_atommag/STRU
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ATOMIC_SPECIES
Fe1 1.000 ../tools/PP_ORB/Fe_ONCV_PBE-1.0.upf
Fe2 1.000 ../tools/PP_ORB/Fe_ONCV_PBE-1.0.upf

NUMERICAL_ORBITAL
../tools/PP_ORB/Fe_gga_9au_100Ry_4s2p2d1f.orb
../tools/PP_ORB/Fe_gga_9au_100Ry_4s2p2d1f.orb

LATTICE_CONSTANT
15

LATTICE_VECTORS
1.00 0.50 0.50
0.50 1.00 0.50
0.50 0.50 1.00
ATOMIC_POSITIONS
Direct

Fe1
0.0
1
0.00 0.00 0.00 1 1 1 mag 1.0

Fe2
0.0
1
0.50 0.50 0.50 1 1 1 mag -1.0


1 change: 1 addition & 0 deletions tests/integrate/304_NO_GO_AF_atommag/jd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test for initial magnetization from atoms, anti-ferromagnetic Fe2, LCAO
3 changes: 3 additions & 0 deletions tests/integrate/304_NO_GO_AF_atommag/result.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
etotref -6372.520190217967
etotperatomref -3186.2600951090
totaltimeref 12.081
1 change: 1 addition & 0 deletions tests/integrate/CASES
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
301_NO_GO_DJ_Si
#303_NO_GO_HP_15
304_NO_GO_AF
304_NO_GO_AF_atommag
304_NO_GO_FM
307_NO_GO_OH
308_NO_GO_CF_RE
Expand Down