Skip to content

Commit

Permalink
Fix bug reported in OpenChemistry#1637 with mis-parsing selenium atoms
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Mar 2, 2024
1 parent 12e5606 commit 863255f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions avogadro/io/pdbformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ bool PdbFormat::read(std::istream& in, Core::Molecule& mol)
if (buffer.size() >= 78) {
element = buffer.substr(76, 2);
element = trimmed(element);
if (element == "SE") // For Sulphur
element = 'S';
if (element.length() == 2)
element[1] = std::tolower(element[1]);

Expand All @@ -161,6 +159,9 @@ bool PdbFormat::read(std::istream& in, Core::Molecule& mol)
while (element.size() && std::isdigit(element.back()))
element.pop_back();

if (element == "SE") // For Sulphur
element = 'S';

atomicNum = Elements::atomicNumberFromSymbol(element);
if (atomicNum == 255) {
appendError("Invalid element");
Expand Down

0 comments on commit 863255f

Please sign in to comment.