diff --git a/CMakeLists.txt b/CMakeLists.txt index b6bd57ee92..c92fb8c45d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,7 @@ add_executable(${ABACUS_BIN_NAME} target_link_libraries(${ABACUS_BIN_NAME} base cell + symmetry md neighbor orb diff --git a/source/module_md/run_md.cpp b/source/module_md/run_md.cpp index 39e93ea975..e6047f877e 100644 --- a/source/module_md/run_md.cpp +++ b/source/module_md/run_md.cpp @@ -60,7 +60,7 @@ void Run_md::ai_md_line(void) // symmetry analysis should be performed every time the cell is changed if (Symmetry::symm_flag) { - symm.analy_sys(); + symm.analy_sys(ucell, out); DONE(ofs_running, "SYMMETRY"); } diff --git a/source/module_symmetry/CMakeLists.txt b/source/module_symmetry/CMakeLists.txt index 95fa96db2f..d4024385f6 100644 --- a/source/module_symmetry/CMakeLists.txt +++ b/source/module_symmetry/CMakeLists.txt @@ -1,5 +1,5 @@ add_library( - base + symmetry OBJECT symm_other.cpp symmetry_basic.cpp diff --git a/source/module_symmetry/symm_other.h b/source/module_symmetry/symm_other.h index aabdb1db3c..8a1701b8bd 100644 --- a/source/module_symmetry/symm_other.h +++ b/source/module_symmetry/symm_other.h @@ -1,8 +1,9 @@ #ifndef SYMM_OTHER_H #define SYMM_OTHER_H -#include "../src_pw/tools.h" - +//#include "../src_pw/tools.h" +#include "../module_base/vector3.h" +#include "../module_base/global_function.h" namespace Symm_Other { void print1(const int &ibrav, const double *cel_const); diff --git a/source/module_symmetry/symmetry.cpp b/source/module_symmetry/symmetry.cpp index fb81743fcc..b4275248e3 100644 --- a/source/module_symmetry/symmetry.cpp +++ b/source/module_symmetry/symmetry.cpp @@ -1,7 +1,7 @@ #include #include "symmetry.h" -#include "../src_pw/global.h" -#include "symm_other.h" +//#include "../src_pw/global.h" +//#include "symm_other.h" Symmetry::Symmetry() { @@ -18,7 +18,7 @@ Symmetry::~Symmetry() bool Symmetry::symm_flag=false; -void Symmetry::analy_sys(void) +void Symmetry::analy_sys(const UnitCell_pseudo &ucell, const output &out) { if (available == false) return; TITLE("Symmetry","init"); @@ -109,7 +109,7 @@ void Symmetry::analy_sys(void) s3 = a3; // find the lattice type accordiing to lattice vectors. - this->lattice_type(a1,a2,a3,ibrav,cel_const,ilattname); + this->lattice_type(a1,a2,a3,ibrav,cel_const,ilattname, ucell); // cout << "a1 = " << a1.x << " " << a1.y << " " << a1.z < &v3, int &brav, double *cel_const, - string &bravname + string &bravname, + const UnitCell_pseudo &ucell ) { TITLE("Symmetry","lattice_type"); @@ -837,8 +838,8 @@ void Symmetry::change_lattice(void) } return; } - -void Symmetry::pricell(void) +/* +void Symmetry::pricell(const UnitCell_pseudo &ucell) { //detect the generating cell (primitive cell) of a supercell if (test_symmetry) TITLE("Symmetry","pricell"); @@ -1074,12 +1075,12 @@ void Symmetry::pricell(void) double celvolume = 0; double pcelvolume = 0.0; - this->lattice_type(p1, p2, p3, pbrav, pcel_const, plattname); + this->lattice_type(p1, p2, p3, pbrav, pcel_const, plattname, ucell); pcelvolume = std::fabs( Symm_Other::celvol(p1,p2,p3) ); OUT(ofs_running,"pcelvolume",pcelvolume); - this->lattice_type(a1, a2, a3, ibrav, cel_const, ilattname); + this->lattice_type(a1, a2, a3, ibrav, cel_const, ilattname, ucell); celvolume = std::fabs( Symm_Other::celvol(a1, a2, a3) ); OUT(ofs_running,"celvolume",celvolume); @@ -1117,7 +1118,7 @@ void Symmetry::pricell(void) } //cout<<"pricell ends!"< s1, s2, s3; @@ -68,7 +68,7 @@ class Symmetry : public Symmetry_Basic int standard_lat(Vector3 &a,Vector3 &b,Vector3 &c,double *celconst ); void lattice_type(Vector3 &v1,Vector3 &v2,Vector3 &v3, - int &ibrav,double *cel_const,string &bravname); + int &ibrav,double *cel_const,string &bravname, const UnitCell_pseudo &ucell); void recip( const double a, @@ -83,12 +83,12 @@ class Symmetry : public Symmetry_Basic void change_lattice(void); // check if the input cell is a primitive cell. - void pricell(void); + //void pricell(const UnitCell_pseudo &ucell); void getgroup(int &nrot, int &nrotk); void checksym(Matrix3 &s, Vector3 >rans, double *pos); void rho_symmetry(double *rho, const int &nr1, const int &nr2, const int &nr3); - void force_symmetry(matrix &force, double* pos); - void stress_symmetry(matrix &sigma); + void force_symmetry(matrix &force, double* pos, const UnitCell_pseudo &ucell); + void stress_symmetry(matrix &sigma, const UnitCell_pseudo &ucell); void write(); void print_pos(const double* pos, const int &nat); diff --git a/source/module_symmetry/symmetry_basic.cpp b/source/module_symmetry/symmetry_basic.cpp index f6927a7456..6f769099b9 100644 --- a/source/module_symmetry/symmetry_basic.cpp +++ b/source/module_symmetry/symmetry_basic.cpp @@ -3,9 +3,9 @@ // DATE : 2007-9 //========================================================== #include "symmetry.h" -#include "../src_pw/global.h" +//#include "../src_pw/global.h" #include "../module_base/mymath.h" -#include "symm_other.h" +//#include "symm_other.h" Symmetry_Basic::Symmetry_Basic() { diff --git a/source/module_symmetry/symmetry_basic.h b/source/module_symmetry/symmetry_basic.h index 27e304debb..2f4d3a1982 100644 --- a/source/module_symmetry/symmetry_basic.h +++ b/source/module_symmetry/symmetry_basic.h @@ -4,9 +4,12 @@ //========================================================== #ifndef SYMMETRY_BASIC_H #define SYMMETRY_BASIC_H -#include "../src_pw/tools.h" -#include "symmetry_basic.h" - +//#include "../src_pw/tools.h" +//#include "symmetry_basic.h" +#include "symm_other.h" +#include "../module_base/mymath.h" +#include "../module_base/ylm.h" +#include "../module_base/matrix3.h" class Symmetry_Basic { public: diff --git a/source/module_symmetry/symmetry_rho.cpp b/source/module_symmetry/symmetry_rho.cpp index de91a491f4..dffd605b13 100644 --- a/source/module_symmetry/symmetry_rho.cpp +++ b/source/module_symmetry/symmetry_rho.cpp @@ -1,5 +1,5 @@ #include "symmetry_rho.h" -#include "../src_pw/global.h" +//#include "../src_pw/global.h" Symmetry_rho::Symmetry_rho() { @@ -11,14 +11,14 @@ Symmetry_rho::~Symmetry_rho() } -void Symmetry_rho::begin(const int &spin_now) const +void Symmetry_rho::begin(const int &spin_now, const Charge_Broyden &CHR, const PW_Basis &pw, const Parallel_Grid &Pgrid, const Symmetry &symm) const { assert(spin_now < 4);//added by zhengdy-soc if(!Symmetry::symm_flag) return; #ifdef __MPI // parallel version - psymm(CHR.rho[spin_now]); + psymm(CHR.rho[spin_now], pw, Pgrid, symm); #else // series version. symm.rho_symmetry(CHR.rho[spin_now], pw.ncx, pw.ncy, pw.ncz); @@ -26,7 +26,7 @@ void Symmetry_rho::begin(const int &spin_now) const return; } -void Symmetry_rho::psymm(double* rho_part) const +void Symmetry_rho::psymm(double* rho_part, const PW_Basis &pw, const Parallel_Grid &Pgrid, const Symmetry &symm) const { #ifdef __MPI // (1) reduce all rho from the first pool. diff --git a/source/module_symmetry/symmetry_rho.h b/source/module_symmetry/symmetry_rho.h index 015d5f7401..9a3eb73b31 100644 --- a/source/module_symmetry/symmetry_rho.h +++ b/source/module_symmetry/symmetry_rho.h @@ -1,5 +1,8 @@ #ifndef SYMMETRY_RHO_H #define SYMMETRY_RHO_H +#include "../src_pw/charge_broyden.h" +#include "../src_pw/pw_basis.h" +#include "../src_parallel/parallel_grid.h" #include "symmetry.h" @@ -9,11 +12,11 @@ class Symmetry_rho Symmetry_rho(); ~Symmetry_rho(); - void begin(const int &spin_now) const; + void begin(const int &spin_now, const Charge_Broyden &CHR, const PW_Basis &pw, const Parallel_Grid &Pgrid, const Symmetry &symm) const; private: - void psymm(double *rho_part) const; + void psymm(double *rho_part, const PW_Basis &pw, const Parallel_Grid &Pgrid, const Symmetry &symm) const; }; diff --git a/source/run_lcao.cpp b/source/run_lcao.cpp index 392e61467a..79492fe140 100644 --- a/source/run_lcao.cpp +++ b/source/run_lcao.cpp @@ -61,7 +61,7 @@ void Run_lcao::lcao_line(void) // symmetry analysis should be performed every time the cell is changed if (Symmetry::symm_flag) { - symm.analy_sys(); + symm.analy_sys(ucell, out); DONE(ofs_running, "SYMMETRY"); } diff --git a/source/run_pw.cpp b/source/run_pw.cpp index 5c23bb46a6..b239e9671a 100644 --- a/source/run_pw.cpp +++ b/source/run_pw.cpp @@ -44,7 +44,7 @@ void Run_pw::plane_wave_line(void) // symmetry analysis should be performed every time the cell is changed if (Symmetry::symm_flag) { - symm.analy_sys(); + symm.analy_sys(ucell, out); DONE(ofs_running, "SYMMETRY"); } diff --git a/source/src_io/output.h b/source/src_io/output.h index a60a0a7035..fa630aab2c 100644 --- a/source/src_io/output.h +++ b/source/src_io/output.h @@ -5,8 +5,10 @@ #ifndef OUTPUT_H #define OUTPUT_H -#include "../src_pw/tools.h" - +//#include "../src_pw/tools.h" +#include "../module_base/realarray.h" +#include "../module_base/matrix3.h" +#include "../module_base/complexmatrix.h" class output { public: diff --git a/source/src_ions/variable_cell.cpp b/source/src_ions/variable_cell.cpp index 63ad28ad84..9cabd17ec3 100644 --- a/source/src_ions/variable_cell.cpp +++ b/source/src_ions/variable_cell.cpp @@ -14,7 +14,7 @@ void Variable_Cell::init_after_vc(void) if(Symmetry::symm_flag) { - symm.analy_sys(); + symm.analy_sys(ucell, out); DONE(ofs_running, "SYMMETRY"); } @@ -78,7 +78,7 @@ void Variable_Cell::final_calculation_after_vc(void) // (6) symmetry analysize. if(Symmetry::symm_flag) { - symm.analy_sys(); + symm.analy_sys(ucell, out); DONE(ofs_running, "SYMMETRY"); } diff --git a/source/src_lcao/ELEC_scf.cpp b/source/src_lcao/ELEC_scf.cpp index 461c25dbf4..cb02999945 100644 --- a/source/src_lcao/ELEC_scf.cpp +++ b/source/src_lcao/ELEC_scf.cpp @@ -37,7 +37,7 @@ void ELEC_scf::scf(const int &istep) Symmetry_rho srho; for(int is=0; isprint(ofs_running, "nonlocal stress", stresnl); diff --git a/source/src_pw/stress_pw.cpp b/source/src_pw/stress_pw.cpp index db9589a351..a9a657ff5b 100644 --- a/source/src_pw/stress_pw.cpp +++ b/source/src_pw/stress_pw.cpp @@ -96,7 +96,7 @@ void Stress_PW::cal_stress(matrix& sigmatot) if(Symmetry::symm_flag) { - symm.stress_symmetry(sigmatot); + symm.stress_symmetry(sigmatot, ucell); } bool ry = false;