Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend tests for OpenBabelParser #18

Merged
merged 12 commits into from
Oct 8, 2024
11 changes: 6 additions & 5 deletions mda_openbabel_converter/OpenBabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def __init__(self, filename: OBMol, **kwargs):
if filename.NumConformers() == 1:
coordinates = np.array([
[(coords := atom.GetVector()).GetX(),
coords.GetY(),
coords.GetZ()] for atom in OBMolAtomIter(filename)],
coords.GetY(),
coords.GetZ()] for atom in OBMolAtomIter(filename)],
dtype=np.float32)
else:
# multiple conformers, such as for a trajectory
Expand All @@ -63,16 +63,17 @@ def __init__(self, filename: OBMol, **kwargs):
for atom in OBMolAtomIter(filename):
coordinates_inner = np.array([
[(coords := atom.GetVector()).GetX(),
coords.GetY(),
coords.GetZ()] for atom in OBMolAtomIter(filename)],
coords.GetY(),
coords.GetZ()] for atom in OBMolAtomIter(filename)],
dtype=np.float32)
coordinates[conf_id] = coordinates_inner
# no coordinates present
if not np.any(coordinates):
warnings.warn("No coordinates found in the OBMol")
coordinates = np.empty((1, n_atoms, 3), dtype=np.float32)
coordinates[:] = np.nan
super(OpenBabelReader, self).__init__(coordinates, order='fac', **kwargs)
super(OpenBabelReader, self).__init__(coordinates,
order='fac', **kwargs)

class OpenBabelConverter(ConverterBase):
"""
Expand Down
1 change: 0 additions & 1 deletion mda_openbabel_converter/OpenBabelParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def parse(self, **kwargs):
resid = atom.GetResidue()
resnums.append(resid.GetNum())
resnames.append(resid.GetName())
chainids.append(resid.GetChain())
icodes.append(resid.GetInsertionCode())

aromatics.append(atom.IsAromatic())
Expand Down
Loading
Loading