Skip to content

Commit

Permalink
Fix bug in Hall group perception with " for = files
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Oct 17, 2023
1 parent 6eaad7e commit 1225015
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions avogadro/core/spacegroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,34 @@ unsigned short SpaceGroups::hallNumber(const std::string& spaceGroup)
{
unsigned short hall = 0; // can't find anything
const unsigned short hall_count = 530;
// some files use " instead of = for the space group symbol
std::string sg = spaceGroup;
std::replace(sg.begin(), sg.end(), '"', '=');

// space_group_hall_symbol
for (unsigned short i = 0; i < hall_count; ++i) {
if (spaceGroup == space_group_hall_symbol[i]) {
if (sg == space_group_hall_symbol[i]) {
return i; // found a match
}
}

// space_group_international
for (unsigned short i = 0; i < hall_count; ++i) {
if (spaceGroup == space_group_international[i]) {
if (sg == space_group_international[i]) {
return i; // found a match
}
}

// space_group_international_short
for (unsigned short i = 0; i < hall_count; ++i) {
if (spaceGroup == space_group_international_short[i]) {
if (sg == space_group_international_short[i]) {
return i; // found a match
}
}

// space_group_international_full
for (unsigned short i = 0; i < hall_count; ++i) {
if (spaceGroup == space_group_international_full[i]) {
if (sg == space_group_international_full[i]) {
return i; // found a match
}
}
Expand Down

1 comment on commit 1225015

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: clang-format-diff detected formatting issues. See the artifact for a patch or run clang-format on your branch.

Please sign in to comment.