Skip to content

Commit

Permalink
Changed the criterion to sort the symmetry operations.
Browse files Browse the repository at this point in the history
Now, it should be compatible with the previous release 0.9.6.
  • Loading branch information
ttadano committed Mar 10, 2016
1 parent 8184f23 commit 398aeaa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
16 changes: 12 additions & 4 deletions alm/symmetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,21 @@ namespace ALM_NS {
std::vector<double> v1, v2;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
v1.push_back(rot[i][j]);
v2.push_back(a.rot[i][j]);
v1.push_back(static_cast<double>(rot[i][j]));
v2.push_back(static_cast<double>(a.rot[i][j]));
}
}
for (int i = 0; i < 3; ++i) {
v1.push_back(tran[i]);
v2.push_back(a.tran[i]);
if (tran[i] < 0.0) {
v1.push_back(1.0+tran[i]);
} else {
v1.push_back(tran[i]);
}
if (a.tran[i] < 0.0) {
v2.push_back(1.0+a.tran[i]);
} else {
v2.push_back(a.tran[i]);
}
}
return std::lexicographical_compare(v1.begin(),v1.end(),v2.begin(),v2.end());
}
Expand Down
16 changes: 12 additions & 4 deletions anphon/symmetry_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,21 @@ namespace PHON_NS {
std::vector<double> v1, v2;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
v1.push_back(rot[i][j]);
v2.push_back(a.rot[i][j]);
v1.push_back(static_cast<double>(rot[i][j]));
v2.push_back(static_cast<double>(a.rot[i][j]));
}
}
for (int i = 0; i < 3; ++i) {
v1.push_back(tran[i]);
v2.push_back(a.tran[i]);
if (tran[i] < 0.0) {
v1.push_back(1.0+tran[i]);
} else {
v1.push_back(tran[i]);
}
if (a.tran[i] < 0.0) {
v2.push_back(1.0+a.tran[i]);
} else {
v2.push_back(a.tran[i]);
}
}
return std::lexicographical_compare(v1.begin(),v1.end(),v2.begin(),v2.end());
}
Expand Down

0 comments on commit 398aeaa

Please sign in to comment.