Skip to content

Commit

Permalink
Fixed issues in the previous commitment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ttadano committed Jun 27, 2015
1 parent a5f6d9f commit d486fc1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
29 changes: 13 additions & 16 deletions alm/symmetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void Symmetry::init()
std::cout << " ========" << std::endl << std::endl;

setup_symmetry_operation(nat, nsym, nnp, system->lavec, system->rlavec,
system->xcoord, system->kd, interaction->is_periodic);
system->xcoord, system->kd);

memory->allocate(tnons, nsym, 3);
memory->allocate(symrel_int, nsym, 3, 3);
Expand Down Expand Up @@ -122,7 +122,7 @@ void Symmetry::init()
}

void Symmetry::setup_symmetry_operation(int nat, unsigned int &nsym, unsigned int &nnp,
double aa[3][3], double bb[3][3], double **x, int *kd, const int periodic_flag[3])
double aa[3][3], double bb[3][3], double **x, int *kd)
{
int i, j;

Expand All @@ -136,7 +136,7 @@ void Symmetry::setup_symmetry_operation(int nat, unsigned int &nsym, unsigned in
std::cout << " Please be patient. " << std::endl;
std::cout << " This can take a while for a large supercell." << std::endl << std::endl;

findsym(nat, aa, x, periodic_flag, SymmList);
findsym(nat, aa, x, SymmList);

std::sort(SymmList.begin() + 1, SymmList.end());
nsym = SymmList.size();
Expand Down Expand Up @@ -212,7 +212,7 @@ void Symmetry::setup_symmetry_operation(int nat, unsigned int &nsym, unsigned in
#endif
}

void Symmetry::findsym(int nat, double aa[3][3], double **x, const int periodic_flag[3], std::vector<SymmetryOperation> &symop) {
void Symmetry::findsym(int nat, double aa[3][3], double **x, std::vector<SymmetryOperation> &symop) {

unsigned int i;
int tran_int[3];
Expand All @@ -223,7 +223,7 @@ void Symmetry::findsym(int nat, double aa[3][3], double **x, const int periodic_
LatticeSymmList.clear();
find_lattice_symmetry(aa, LatticeSymmList);
CrystalSymmList.clear();
find_crystal_symmetry(nat, system->nclassatom, system->atomlist_class, x, periodic_flag,
find_crystal_symmetry(nat, system->nclassatom, system->atomlist_class, x,
LatticeSymmList, CrystalSymmList);

// findsym(nat, nnp, kd, aa, bb, x);
Expand Down Expand Up @@ -365,7 +365,7 @@ void Symmetry::find_lattice_symmetry(double aa[3][3], std::vector<RotationMatrix
}
}

void Symmetry::find_crystal_symmetry(int nat, int nclass, std::vector<unsigned int> *atomclass, double **x, const int periodic_flag[3],
void Symmetry::find_crystal_symmetry(int nat, int nclass, std::vector<unsigned int> *atomclass, double **x,
std::vector<RotationMatrix> LatticeSymmList,
std::vector<SymmetryOperationTransFloat> &CrystalSymmList)
{
Expand Down Expand Up @@ -404,7 +404,8 @@ void Symmetry::find_crystal_symmetry(int nat, int nclass, std::vector<unsigned i
CrystalSymmList.push_back(SymmetryOperationTransFloat(rot_int, tran));


for (std::vector<RotationMatrix>::iterator it_latsym = LatticeSymmList.begin(); it_latsym != LatticeSymmList.end(); ++it_latsym) {
for (std::vector<RotationMatrix>::iterator it_latsym = LatticeSymmList.begin();
it_latsym != LatticeSymmList.end(); ++it_latsym) {

iat = atomclass[0][0];

Expand All @@ -427,9 +428,9 @@ void Symmetry::find_crystal_symmetry(int nat, int nclass, std::vector<unsigned i
tran[i] = tran[i] - nint(tran[i]);
}

if ((std::abs(tran[0]) > eps12 && !periodic_flag[0]) ||
(std::abs(tran[1]) > eps12 && !periodic_flag[1]) ||
(std::abs(tran[2]) > eps12 && !periodic_flag[2])) continue;
if ((std::abs(tran[0]) > eps12 && !interaction->is_periodic[0]) ||
(std::abs(tran[1]) > eps12 && !interaction->is_periodic[1]) ||
(std::abs(tran[2]) > eps12 && !interaction->is_periodic[2])) continue;

is_identity_matrix =
( std::pow(rot[0][0] - 1.0, 2) + std::pow(rot[0][1], 2) + std::pow(rot[0][2], 2)
Expand Down Expand Up @@ -459,12 +460,8 @@ void Symmetry::find_crystal_symmetry(int nat, int nclass, std::vector<unsigned i
lat = atomclass[itype][kk];

for (i = 0; i < 3; ++i) {
if (periodic_flag[i]) {
tmp[i] = std::fmod(std::abs(x[lat][i] - x_rot_tmp[i]), 1.0);
tmp[i] = std::min<double>(tmp[i], 1.0 - tmp[i]);
} else {
tmp[i] = std::abs(x[lat][i] - x_rot_tmp[i]);
}
tmp[i] = std::fmod(std::abs(x[lat][i] - x_rot_tmp[i]), 1.0);
tmp[i] = std::min<double>(tmp[i], 1.0 - tmp[i]);
}
diff = tmp[0] * tmp[0] + tmp[1] * tmp[1] + tmp[2] * tmp[2];
if (diff < tolerance * tolerance) {
Expand Down
6 changes: 3 additions & 3 deletions alm/symmetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace ALM_NS {

void init();
void setup_symmetry_operation(int, unsigned int&, unsigned int&, double[3][3], double[3][3],
double **, int *, const int [3]);
double **, int *);

unsigned int nsym, nnp;
int ntran, natmin;
Expand Down Expand Up @@ -135,7 +135,7 @@ namespace ALM_NS {

private:

void findsym(int, double [3][3], double **, const int [3], std::vector<SymmetryOperation> &);
void findsym(int, double [3][3], double **, std::vector<SymmetryOperation> &);
bool is_translation(int **);

void symop_in_cart(double [3][3], double[3][3]);
Expand All @@ -144,7 +144,7 @@ namespace ALM_NS {
void symop_availability_check(double ***, bool *, const int, int &);

void find_lattice_symmetry(double [3][3], std::vector<RotationMatrix> &);
void find_crystal_symmetry(int, int, std::vector<unsigned int> *, double **x, const int [3],
void find_crystal_symmetry(int, int, std::vector<unsigned int> *, double **x,
std::vector<RotationMatrix>, std::vector<SymmetryOperationTransFloat> &);
void find_nnp_for_translation(unsigned int &, std::vector<SymmetryOperationTransFloat>);

Expand Down

0 comments on commit d486fc1

Please sign in to comment.