Skip to content

Commit 4f39c35

Browse files
authored
Merge pull request #167 from OpenBioSim/fix_166
Fix issue #166
2 parents 72a8c85 + 90b81cd commit 4f39c35

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

corelib/src/libs/SireIO/mol2.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -2623,10 +2623,8 @@ MolEditor Mol2::getMolecule(int imol, const PropertyMap &map) const
26232623
types.set(cgatomidx, atom.getType());
26242624
status_bits.set(cgatomidx, atom.getStatusBits());
26252625

2626-
// Try to infer the element from the name of the atom.
2627-
// We'll strip all numeric digits and use a maximum of two characters.
2628-
auto name = atom.getName().remove(QRegExp("[0-9]")).mid(0, 2);
2629-
elements.set(cgatomidx, Element::biologicalElement(name));
2626+
// Infer the element from the SYBYL atom type.
2627+
elements.set(cgatomidx, Element::biologicalElement(atom.getType()));
26302628
}
26312629

26322630
// Instantiate the residue property objects that we need.

doc/source/changelog.rst

+4
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ organisation on `GitHub <https://github.com/openbiosim/sire>`__.
151151
extension for Amber RST7 files, and changes the scoring logic of the SDF parser
152152
to equal the number of molecules times the number of atoms.
153153

154+
* Switched to using the SYBL atom type to infer the element of an atom
155+
when reading Mol2 files. This is more robust than using the atom name.
156+
Fixes issue #166.
157+
154158
* Please add an item to this changelog when you create your PR
155159

156160
`2023.5.1 <https://github.com/openbiosim/sire/compare/2023.5.0...2023.5.1>`__ - January 2024

0 commit comments

Comments
 (0)