I. Molecular Dynamics

Molecular dynamics simulations provide a powerful means of investigating the properties of molecular systems. They have two principal roles: (i) to study how a system changes as a function of time; and (ii) to explore a much wider range of conformational space that is accessible to a system than the geometry optimization and reaction path methods that we have discussed up to now.

Example16.py of the pDynamo distribution performs a simple dynamics simulation of the bALA molecule in vacuum using a velocity Verlet algorithm. The simulation consists of three phases: (i) a heating phase in which the temperature is increased gradually from 10 to 300 K; (ii) an equilibration phase in which the temperature is kept at around 300 K; and (iii) a data-collection phase in which no temperature manipulation is effected and during which structural data is saved at 100 fs intervals on an external trajectory. The program is:

# . Define the energy models.

mmModel = MMModelOPLS.WithParameterSet ( "bookSmallExamples" )

nbModel = NBModelFull.WithDefaults ( )


# . Generate the molecule.

molecule = ImportSystem ( os.path.join ( molPath, "bala_c7eq.mol" ) )

molecule.DefineMMModel ( mmModel )

molecule.DefineNBModel ( nbModel )

molecule.Summary ( )

molecule.Energy ( )


# . Optimization.

ConjugateGradientMinimize_SystemGeometry ( molecule ,

maximumIterations = 2000 ,

logFrequency = 100 ,

rmsGradientTolerance = 0.1 )


# . Define a random number generator in a given state.

normalDeviateGenerator = NormalDeviateGenerator.WithRandomNumberGenerator ( RandomNumberGenerator.WithSeed ( 175189 ) )


# . Heating.

VelocityVerletDynamics_SystemGeometry ( molecule ,

logFrequency = 100 ,

normalDeviateGenerator = normalDeviateGenerator ,

steps = 1000 ,

timeStep = 0.001 ,

temperatureScaleFrequency = 100 ,

temperatureScaleOption = "linear" ,

temperatureStart = 10.0 ,

temperatureStop = 300.0 )


# . Equilibration.

VelocityVerletDynamics_SystemGeometry ( molecule ,

logFrequency = 500 ,

steps = 5000 ,

timeStep = 0.001 ,

temperatureScaleFrequency = 100 ,

temperatureScaleOption = "constant" ,

temperatureStart = 300.0 )


# . Data-collection.

trajectory = ExportTrajectory ( os.path.join ( scratchPath, "bala_c7eq.ptGeo" ), molecule )

VelocityVerletDynamics_SystemGeometry ( molecule ,

logFrequency = 500 ,

steps = 10000 ,

timeStep = 0.001 ,

trajectories = [ ( trajectory, 100 ) ] )

To be of use, of course, the trajectory data generated during a dynamics has to be analyzed. Example17.py shows how to do a simple analysis by reading the frames in the trajectory and, for each frame, calculating the φ and ψ dihedral angles of the molecule. These values are printed out to a table at the end of the program along with their means and standard deviations.

# . Read the molecule definition.

molecule = ImportSystem ( os.path.join ( molPath, "bala_c7eq.mol" ) )

molecule.Summary ( )


# . Define the trajectory.

trajectory = ImportTrajectory ( os.path.join ( scratchPath, "bala_c7eq.ptGeo" ), molecule )

trajectory.ReadHeader ( )


# . Loop over the frames in the trajectory.

phi = []

psi = []

while trajectory.RestoreOwnerData ( ):

phi.append ( molecule.coordinates3.Dihedral ( 4, 6, 8, 14 ) )

psi.append ( molecule.coordinates3.Dihedral ( 6, 8, 14, 16 ) )


# . Finish up.

trajectory.ReadFooter ( )

trajectory.Close ( )


# . Set up the statistics calculation.

phiStatistics = Statistics ( phi )

psiStatistics = Statistics ( psi )


# . Output the results.

table = logFile.GetTable ( columns = [ 20, 20, 20 ] )

table.Start ( )

table.Title ( "Phi/Psi Angles" )

table.Heading ( "Frame" )

table.Heading ( "Phi" )

table.Heading ( "Psi" )

for ( i, ( h, s ) ) in enumerate ( zip ( phi, psi ) ):

table.Entry ( "{:d}" .format ( i ) )

table.Entry ( "{:.2f}".format ( h ) )

table.Entry ( "{:.2f}".format ( s ) )

table.Entry ( "Mean:", align = Align.Left )

table.Entry ( "{:.2f}".format ( phiStatistics.mean ) )

table.Entry ( "{:.2f}".format ( psiStatistics.mean ) )

table.Entry ( "Standard Deviation:", align = Align.Left )

table.Entry ( "{:.2f}".format ( phiStatistics.standardDeviation ) )

table.Entry ( "{:.2f}".format ( psiStatistics.standardDeviation ) )

table.Stop ( )

Exercises

    1. pDynamo has a number of dynamics algorithms. Try some of these (e.g. LangevinDynamics_SystemGeometry) and see how their behavior compares to that of the velocity Verlet method by analyzing the simulation data in different ways.

    2. Choosing a suitable dynamics algorithm, perform extended simulations of the bALA molecule – either a very long simulation or many small ones – and then plot the φ/ψ map of the simulation results. Is there any correspondence between the dynamic map and those determined previously using geometry optimization and reaction path calculations? If not, why not? What happens when the temperature of the simulations is changed?