def GetOutofplanes(atoms, bond_graph): """Determine outofplane atom quartets and parameters from bond graph. Search bond graph for outofplane angle quartets, and parameter tables for mm parameters. Use to create a new Outofplane object and append to Molecule. Count as outofplane if il and jl and kl are bonded in quartet ijkl. Args: atoms (mmlib.molecule.Atom*): Array of molecule's Atom objects. bond_graph (int:(int:foat)): Dictionary of bond connectivity. Returns: outofplanes (mmlib.molecule.Outofplane*): Array of molecule's Outofplane objects. """ outofplanes = [] for k, at3 in enumerate(atoms): for i, j, l in itertools.combinations(bond_graph[k], 3): at1, at2, at4 = atoms[i], atoms[j], atoms[l] # Three unique oop angles with this central atom (k) and atom quartet combos = [(min(i, j), max(i, j), k, l), (min(j, l), max(j, l), k, i), (min(l, i), max(l, i), k, j)] for combo in combos: o_ijkl = geomcalc.GetOijkl(*[atoms[x].coords for x in combo]) v_n = param.GetOutofplaneParam( *[atoms[x].type_ for x in combo]) if v_n: outofplanes.append(molecule.Outofplane( *combo, v_n, o_ijkl)) outofplanes.sort(key=lambda o: (o.at1, o.at2, o.at3, o.at4)) return outofplanes
def GetOutofplanes(mol): """Determine outofplane atom quartets and parameters from bond graph. Search bond graph for outofplane angle quartets, and parameter tables for mm parameters. Use to create a new Outofplane object and append to Molecule. Count as outofplane if il and jl and kl are bonded in quartet ijkl. Args: mol (mmlib.molecule.Molecule): Molecule object with bond graph of atom pairs within covalent radius cutoff threshold. """ for k in range(mol.n_atoms): at3 = mol.atoms[k] for l in mol.bond_graph[k].keys(): if k == l: continue at4 = mol.atoms[l] r34 = mol.bond_graph[k][l] for i in mol.bond_graph[k].keys(): if i == k or i == l: continue at1 = mol.atoms[i] r31 = mol.bond_graph[k][i] for j in mol.bond_graph[k].keys(): if j >= i or j == k or j == l: continue at2 = mol.atoms[j] r32 = mol.bond_graph[k][j] o_ijkl = geomcalc.GetOijkl(at1.coords, at2.coords, at3.coords, at4.coords, r31, r32, r34) v_n = param.GetOutofplaneParam(at1.type_, at2.type_, at3.type_, at4.type_) if v_n > 0.0: mol.outofplanes.append( molecule.Outofplane(i, j, k, l, o_ijkl, v_n)) mol.outofplanes = sorted(mol.outofplanes, key=lambda o: o.at4) mol.outofplanes = sorted(mol.outofplanes, key=lambda o: o.at3) mol.outofplanes = sorted(mol.outofplanes, key=lambda o: o.at2) mol.outofplanes = sorted(mol.outofplanes, key=lambda o: o.at1) mol.n_outofplanes = len(mol.outofplanes)
def test1234(self): """Asserts correct paramter for complete atom quartet.""" self.assertEqual(param.GetOutofplaneParam('CA', 'CA', 'C', 'OH'), 1.1)
def test234(self): """Asserts correct parameter for ending atom triplet.""" self.assertEqual(param.GetOutofplaneParam('', 'CT', 'N', 'CT'), 1.0)
def test34(self): """Asserts correct parameter for ending atom pair.""" self.assertEqual(param.GetOutofplaneParam('', '', 'C', 'O'), 10.5)
def testEmptyInput(self): """Asserts zero value for empty string input.""" self.assertEqual(param.GetOutofplaneParam('', '', '', ''), 0.0)