htmd.util module#
- htmd.util.assertSameAsReferenceDir(compareDir, outdir='.')#
Check if files in refdir are present in the directory given as second argument AND their content matches.
Raise an exception if not.
- htmd.util.diffMolecules(mol1, mol2, sel=None)#
Check that name, resname, resid, insertion codes match between two molecules.
Coordinates are not checked.
- Parameters:
- Returns:
diff – a list of differences, as human-readable strings (empty if structures are equal).
- Return type:
Examples
>>> m=Molecule("3PTB") >>> m2=m.copy() >>> m2.set("resname","HIE","resid 91") >>> diffMolecules(m,m2,sel="name CA") ['CA HIS 91 vs CA HIE 91 ']
- htmd.util.ensurelist(tocheck, tomod=None)#
Convert np.ndarray and scalars to lists.
Lists and tuples are left as is. If a second argument is given, the type check is performed on the first argument, and the second argument is converted.
- htmd.util.getPdbStrings(mol, sel=None, onlyAtom=True)#
Return the PDB corresponding to molecule and selection, as a list of strings.
- Parameters:
Examples
>>> m = Molecule("3PTB") >>> getPdbStrings(m, "resname BEN") ['HETATM 1 C1 BEN A 1 -1.853 14.311 16.658 1.00 19.86 1 C ', 'HETATM 2 C2 BEN A 1 -2.107 15.653 16.758 1.00 19.86 1 C ', 'HETATM 3 C3 BEN A 1 -1.774 16.341 17.932 1.00 19.86 1 C ', 'HETATM 4 C4 BEN A 1 -1.175 15.662 19.005 1.00 19.86 1 C ', 'HETATM 5 C5 BEN A 1 -0.914 14.295 18.885 1.00 19.86 1 C ', 'HETATM 6 C6 BEN A 1 -1.257 13.634 17.708 1.00 19.86 1 C ', 'HETATM 7 C BEN A 1 -2.193 13.627 15.496 1.00 19.86 1 C ', 'HETATM 8 N1 BEN A 1 -2.797 14.235 14.491 1.00 19.86 1 N ', 'HETATM 9 N2 BEN A 1 -1.762 12.391 15.309 1.00 19.86 1 N ']
- htmd.util.tempname(suffix='', create=False)#
- htmd.util.testDHFR()#