def GetTopology(self): """Determine bonded topology of molecules from coordinates.""" topology.GetBondGraph(self) topology.GetBonds(self) topology.GetAngles(self) topology.GetTorsions(self) topology.GetOutofplanes(self) topology.GetNonints(self)
def GetTopology(self): """Determine bonded topology of molecules from coordinates.""" self.bond_graph = topology.GetBondGraph(self.atoms) self.bonds = topology.GetBonds(self.atoms, self.bond_graph) self.angles = topology.GetAngles(self.atoms, self.bond_graph) self.torsions = topology.GetTorsions(self.atoms, self.bond_graph) self.outofplanes = topology.GetOutofplanes(self.atoms, self.bond_graph) self.nonints = topology.GetNonints(self.bonds, self.angles, self.torsions) self.n_bonds = len(self.bonds) self.n_angles = len(self.angles) self.n_torsions = len(self.torsions) self.n_outofplanes = len(self.outofplanes)
def ReadInPrm(self): """Read in prm data from .prm input file.""" input_rows = fileio.GetFileStringArray(self.infile) self.atoms = fileio.GetAtomsFromPrm(input_rows) self.bonds = fileio.GetBondsFromPrm(input_rows) self.angles = fileio.GetAnglesFromPrm(input_rows) self.torsions = fileio.GetTorsionsFromPrm(input_rows) self.outofplanes = fileio.GetOutofplanesFromPrm(input_rows) self.n_atoms = len(self.atoms) self.n_bonds = len(self.bonds) self.n_angles = len(self.angles) self.n_torsions = len(self.torsions) self.n_outofplanes = len(self.outofplanes) self.bond_graph = topology.GetBondGraphFromBonds( self.bonds, self.n_atoms) self.nonints = topology.GetNonints(self.bonds, self.angles, self.torsions)
def GetPrm(mol): """Parse contents of prm file into molecular topology / geometry data. Reads in and organizes contents of a prm parameter file into given mmlib.molecule.Molecule object. Contents of molecule object include Atom objects, Bond objects, Angle objects, Torsion objects, and Outofplane objects and associated parameters and values. Args: mol (mmlib.molecule.Molecule): Molecule to append data """ infile_array = _GetFileStringArray(mol.infile) for i in range(len(infile_array)): record = infile_array[i] rec_type = record[0].lower() if rec_type == 'atom': _GetAtom(mol, record) mol.n_atoms = len(mol.atoms) mol.bond_graph = [{} for i in range(mol.n_atoms)] for i in range(len(infile_array)): record = infile_array[i] rec_type = record[0].lower() if rec_type == 'bond': _GetBond(mol, record) elif rec_type == 'angle': _GetAngle(mol, record) elif rec_type == 'torsion': _GetTorsion(mol, record) elif rec_type == 'outofplane': _GetOutofplane(mol, record) mol.n_bonds = len(mol.bonds) mol.n_angles = len(mol.angles) mol.n_torsions = len(mol.torsions) mol.n_outofplanes = len(mol.outofplanes) topology.GetNonints(mol)