pDynamo is written in Python using an object-oriented approach. The principal pDynamo class that is used to represent molecular systems that are to be simulated is
System. A simple program that creates three instances of this class is
Example1.py from the pDynamo distribution:
# . Create a water molecule.
water = System.FromAtoms ( [ 8, 1, 1 ] )
water.label = "Water"
water.Summary ( )
# . Create a water dimer.
waterDimer = MergeByAtom ( water, water )
waterDimer.label = "Water Dimer"
waterDimer.Summary ( )
# . Create a hydroxyl.
oh = Selection ( [ 0, 1 ] )
hydroxyl = PruneByAtom ( water, oh )
hydroxyl.label = "Hydroxyl"
hydroxyl.Summary ( )
The program first creates a water molecule by instantiating the
System class directly with, as argument, a list containing the atomic numbers of the molecule's atoms. Two other instances of
System are then created indirectly. The first is a water dimer which is generated by merging two waters, and the second is a hydroxyl group which is created by taking water and then pruning one of its hydrogens.
It is unusual to instantiate systems directly using
System, except in the simplest cases. Instead it is normal to read their definitions from external files or employ special chemical notations. A program that generates a number of instances of the blocked alanine molecule (bALA) using different molecular representations is
# . Define the molecule.
moleculeName = "bala_c7eq"
smiles = "CC(=O)NC(C)C(=O)NC"
# . Initialize a list to contain the molecules.
molecules = 
# . Read all molecules.
molecules.append ( MOLFile_ToSystem ( os.path.join ( molPath, moleculeName + ".mol" ) ) )
molecules.append ( PDBFile_ToSystem ( os.path.join ( pdbPath, moleculeName + ".pdb" ) ) )
molecules.append ( XYZFile_ToSystem ( os.path.join ( xyzPath, moleculeName + ".xyz" ) ) )
# . Generate a molecule from a SMILES string.
molecules.append ( SMILES_ToSystem ( smiles ) )
# . Print summaries of the molecules.
for molecule in molecules:
molecule.Summary ( )
The program employs the four representations, MOL, PDB, SMILES and XYZ. SMILES is a string representation that specifies the system's composition and covalent bond arrangement, whereas the other three are file-based and contain a list of the system's atoms and a copy of their Cartesian coordinates. Links to sites describing some of these representations may be found on the documentation page.
- Interconvert different representations of a molecular system using the representations' appropriate
_ToSystemfunctions. What happens to the information defined in a particular representation — is it conserved or destroyed?