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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ add_executable(${ABACUS_BIN_NAME}
target_link_libraries(${ABACUS_BIN_NAME}
base
cell
symmetry
md
neighbor
orb
Expand Down
2 changes: 1 addition & 1 deletion source/module_md/run_md.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
2 changes: 1 addition & 1 deletion source/module_symmetry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add_library(
base
symmetry
OBJECT
symm_other.cpp
symmetry_basic.cpp
Expand Down
5 changes: 3 additions & 2 deletions source/module_symmetry/symm_other.h
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
25 changes: 13 additions & 12 deletions source/module_symmetry/symmetry.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <memory>
#include "symmetry.h"
#include "../src_pw/global.h"
#include "symm_other.h"
//#include "../src_pw/global.h"
//#include "symm_other.h"

Symmetry::Symmetry()
{
Expand All @@ -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");
Expand Down Expand Up @@ -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 <<endl;
// cout << "a1 = " << a2.x << " " << a2.y << " " << a2.z <<endl;
// cout << "a1 = " << a3.x << " " << a3.y << " " << a3.z <<endl;
Expand Down Expand Up @@ -489,7 +489,8 @@ void Symmetry::lattice_type(
Vector3<double> &v3,
int &brav,
double *cel_const,
string &bravname
string &bravname,
const UnitCell_pseudo &ucell
)
{
TITLE("Symmetry","lattice_type");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1117,7 +1118,7 @@ void Symmetry::pricell(void)
}
//cout<<"pricell ends!"<<endl;
return;
}
}*/


void Symmetry::getgroup(int &nrot, int &nrotk)
Expand Down Expand Up @@ -1504,7 +1505,7 @@ void Symmetry::rho_symmetry( double *rho,
timer::tick("Symmetry","rho_symmetry");
}

void Symmetry::force_symmetry(matrix &force , double* pos) // pengfei 2016-12-20
void Symmetry::force_symmetry(matrix &force , double* pos, const UnitCell_pseudo &ucell) // pengfei 2016-12-20
{
TITLE("Symmetry","force_symmetry");
double *protpos;
Expand Down Expand Up @@ -1584,7 +1585,7 @@ void Symmetry::force_symmetry(matrix &force , double* pos) // pengfei 2016-12-
return;
}

void Symmetry::stress_symmetry(matrix& sigma) //zhengdy added 2017
void Symmetry::stress_symmetry(matrix& sigma, const UnitCell_pseudo &ucell) //zhengdy added 2017
{
double *tot_sigma, *temp;
tot_sigma = new double[9];
Expand Down
14 changes: 7 additions & 7 deletions source/module_symmetry/symmetry.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef SYMMETRY_H
#define SYMMETRY_H

#include "../src_pw/tools.h"
#include "../module_cell/unitcell.h"
//#include "../src_pw/tools.h"
#include "../module_cell/unitcell_pseudo.h"
#include "symmetry_basic.h"

class Symmetry : public Symmetry_Basic
Expand All @@ -15,7 +15,7 @@ class Symmetry : public Symmetry_Basic
// mohan add 2021-02-21
static bool symm_flag;

void analy_sys();
void analy_sys(const UnitCell_pseudo &ucell, const output &out);
bool available;

Vector3<double> s1, s2, s3;
Expand Down Expand Up @@ -68,7 +68,7 @@ class Symmetry : public Symmetry_Basic
int standard_lat(Vector3<double> &a,Vector3<double> &b,Vector3<double> &c,double *celconst );

void lattice_type(Vector3<double> &v1,Vector3<double> &v2,Vector3<double> &v3,
int &ibrav,double *cel_const,string &bravname);
int &ibrav,double *cel_const,string &bravname, const UnitCell_pseudo &ucell);

void recip(
const double a,
Expand All @@ -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<double> &gtrans, 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);
Expand Down
4 changes: 2 additions & 2 deletions source/module_symmetry/symmetry_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
9 changes: 6 additions & 3 deletions source/module_symmetry/symmetry_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions source/module_symmetry/symmetry_rho.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "symmetry_rho.h"
#include "../src_pw/global.h"
//#include "../src_pw/global.h"

Symmetry_rho::Symmetry_rho()
{
Expand All @@ -11,22 +11,22 @@ 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);
#endif
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.
Expand Down
7 changes: 5 additions & 2 deletions source/module_symmetry/symmetry_rho.h
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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;

};

Expand Down
2 changes: 1 addition & 1 deletion source/run_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
2 changes: 1 addition & 1 deletion source/run_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
6 changes: 4 additions & 2 deletions source/src_io/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions source/src_ions/variable_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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");
}

Expand Down
4 changes: 2 additions & 2 deletions source/src_lcao/ELEC_scf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void ELEC_scf::scf(const int &istep)
Symmetry_rho srho;
for(int is=0; is<NSPIN; is++)
{
srho.begin(is);
srho.begin(is, CHR, pw, Pgrid, symm);
}

// cout << scientific;
Expand Down Expand Up @@ -379,7 +379,7 @@ void ELEC_scf::scf(const int &istep)
Symmetry_rho srho;
for(int is=0; is<NSPIN; is++)
{
srho.begin(is);
srho.begin(is, CHR, pw, Pgrid, symm);
}

// (6) compute magnetization, only for spin==2
Expand Down
4 changes: 2 additions & 2 deletions source/src_lcao/FORCE_STRESS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void Force_Stress_LCAO::getForceStress(

if(Symmetry::symm_flag)
{
symm.stress_symmetry(scs);
symm.stress_symmetry(scs, ucell);
}//end symmetry

// print Rydberg stress or not
Expand Down Expand Up @@ -760,7 +760,7 @@ void Force_Stress_LCAO::forceSymmetry(matrix& fcs)

fcs(iat,0) = d1;fcs(iat,1) = d2;fcs(iat,2) = d3;
}
symm.force_symmetry(fcs , pos);
symm.force_symmetry(fcs , pos, ucell);
for(int iat=0; iat<ucell.nat; iat++)
{
Mathzone::Direct_to_Cartesian(fcs(iat,0),fcs(iat,1),fcs(iat,2),
Expand Down
4 changes: 0 additions & 4 deletions source/src_pw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ add_library(
stress_func_nl.cpp
stress_func_print.cpp
stress_pw.cpp
symm_other.cpp
symmetry.cpp
symmetry_basic.cpp
symmetry_rho.cpp
threshold_elec.cpp
use_fft.cpp
vdwd2.cpp
Expand Down
1 change: 1 addition & 0 deletions source/src_pw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ VPATH=../src_global\
:../src_io\
:../src_ions\
:../module_md\
:../module_symmetry\
:../\

#==========================
Expand Down
2 changes: 2 additions & 0 deletions source/src_pw/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ diago_cg.o\
electrons.o \
efield.o \
energy.o \
energy_dos_pw.o\
dos.o\
forces.o\
global.o \
hamilt_pw.o \
Expand Down
1 change: 1 addition & 0 deletions source/src_pw/Makefile.parallel
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ VPATH=../src_global\
:../src_io\
:../src_ions\
:../module_md\
:../module_symmetry\
:../\

#==========================
Expand Down
1 change: 1 addition & 0 deletions source/src_pw/Makefile.serial
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ VPATH=../src_global\
:../src_io\
:../src_ions\
:../module_md\
:../module_symmetry\
:../\

#==========================
Expand Down
1 change: 1 addition & 0 deletions source/src_pw/charge_broyden.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "charge_broyden.h"
#include "global.h"
#include "../module_base/global_variable.h"
#include "../module_base/inverse_matrix.h"

Charge_Broyden::Charge_Broyden()
Expand Down
1 change: 1 addition & 0 deletions source/src_pw/charge_broyden.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// (4) Modified Broden Mixing
//===================================
#include "tools.h"
#include "../module_base/matrix.h"
#include "charge_pulay.h"

class Charge_Broyden: public Charge_Pulay
Expand Down
Loading