From ff972871ae5e3ff7358d2733dd0b349a72d2cee9 Mon Sep 17 00:00:00 2001 From: lunamorrow Date: Mon, 17 Jun 2024 21:26:05 +1000 Subject: [PATCH] Reset to clean slate, to enable work on Parser --- mda_openbabel_converter/OpenBabel.py | 37 ++-------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/mda_openbabel_converter/OpenBabel.py b/mda_openbabel_converter/OpenBabel.py index 838166c..a3b4993 100644 --- a/mda_openbabel_converter/OpenBabel.py +++ b/mda_openbabel_converter/OpenBabel.py @@ -4,7 +4,7 @@ import MDAnalysis as mda from MDAnalysis.converters.base import ConverterBase -from MDAnalysis.coordinates.base import SingleFrameReaderBase +from MDAnalysis.coordinates.memory import MemoryReader from MDAnalysis.core.groups import AtomGroup try: @@ -13,7 +13,7 @@ except ImportError: print("Cannot find openbabel, install with 'pip install openbabel==2.4.0'") -class OpenBabelReader(SingleFrameReaderBase): +class OpenBabelReader(MemoryReader): """ Convert an OpenBabel OBMol (from the file) to a MDAnalysis AtomGroup """ @@ -34,39 +34,6 @@ def __init__(self, filename: OBMol, **kwargs): """ Converts file to OBMol to AtomGroup """ - self.atoms = [] - self.n_atoms = 0 - self.residues = [] - self.n_residues = 0 - self.segments = [] - self.n_segments = 0 - - obmol = filename - - # Atoms - names = [] - chiralities = [] - resnums = [] - resnames = [] - elements = [] - masses = [] - charges = [] - aromatics = [] - ids = [] - atomtypes = [] - segids = [] - altlocs = [] - chainids = [] - icodes = [] - occupancies = [] - tempfactors = [] - - for i in range(1, obmol): - atom = obmol.GetAtomById(i-1) - # need to add handling incase attributes are invalid or null in OBMol - names.append(atom.GetType()) #char - - pass class OpenBabelConverter(ConverterBase):