Skip to content

Commit ce72ac9

Browse files
committed
Don't remove H atoms when drawing Hydrogen bonds
This was added in PR #1961 which indroduced the ability to draw hydrogen bonds. It was removed without explanation in ec95153 which made drawing work for fragments. That broke drawing of hydrogen bonds. The unit test for drawing hydrogen bonds exists, but just checks that a PDF is made, not what it looks like. So this wasn't detected.
1 parent b30535b commit ce72ac9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rmgpy/molecule/draw.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ def draw(self, molecule, file_format, target=None):
184184
surface_sites = []
185185
for atom in self.molecule.atoms:
186186
if isinstance(atom, Atom) and atom.is_hydrogen() and atom.label == '':
187-
atoms_to_remove.append(atom)
187+
if not any(bond.is_hydrogen_bond() for bond in atom.bonds.values()):
188+
atoms_to_remove.append(atom)
188189
elif atom.is_surface_site():
189190
surface_sites.append(atom)
190191
if len(atoms_to_remove) < len(self.molecule.atoms) - len(surface_sites):

0 commit comments

Comments
 (0)