Simulations

From csml-wiki.northwestern.edu
Revision as of 21:22, 25 September 2014 by Homa (talk | contribs)
Jump to navigation Jump to search

Introduction

Assorted topics relevant to programming particle-based simulation codes and to using these codes for the modeling of a wide range of systems, notably complex fluids.

Molecular dynamics simulations

By and large the CSML uses LAMMPS for MD, though depending on the application NAMD, GROMACS, or any of a host of other packages may be useful. Most issues can be resolved by consulting the LAMMPS manual, though some common problems are addressed below.

LAMMPS Special Usage Notes

Temperature Normalization

By default LAMMPS normalizes the temperature by an amount , where is the system's total number of degrees of freedom and is the system's dimensionality. Subtracting accounts for the center-of-mass motion of the system. This leads to an incorrect reported value if the system has a proper frame of reference, e.g., when using a Langevin thermostat in which all particles interact with a stationary background solvent. In this case it is necessary to ensure is used instead of . To do this, use compute_modify as follows

compute myTemp all temp
compute_modify myTemp extra 0
thermo_modify temp myTemp

As a note, the above only affects the reported temperature. The dynamics are computed correctly regardless.

Compute RDF using 'rerun' command

The 'rerun' command in LAMMPS performs a post-processing simulation by reading the atom information line-by-line from the dump file(s) created from a previous simulation. The command syntax is as follows:

 rerun file1 file2 ... keyword args ... 

More information can be found on the LAMMPS website.

Besides the fact that the atoms' positions (and possibly velocities, etc.) are pre-determined from the dump file(s), we use the rerun command as if we are running a normal simulation (with some differences and limitations, explained below). When the rerun command is called, it invokes the read_dump command to read in lines from the dumpfile(s) line-by-line, each time invoking the run command to output computed energy, forces, and any thermo output or diagnostic info the user has defined. Thus, in the input file for this pseudo simulation, we must define a system, units, dimensions, box, etc, and these will typically be identical to the original simulation.

Commands from the original simulation that will not be included are ones such as dump commands and time integration fixes (e.g. fix nve; rerun only looks at single moments in time and cannot perform time integration). Fixes that constrain forces on atoms (such as fix langevin) can be invoked in general, but it does not make sense to do this for computing the RDF (even though the langevin thermostat may be employed in the original simulation).

For a typical one-component shifted truncated Lennard-Jones fluid, we will read in the positions of particles at any number of timesteps (see arguments for the rerun command) from dumpfile(s) of a previous simulation. The RDF is computed and output with the following commands:

compute    rdfID groupID rdf N #computes rdf with N bins
fix    fixID groupID ave/time Nevery Nrepeat Nfreq c_[rdfID] file rdf.dat mode vector # see note below
rerun    dump.dat dump x y z # 'dump.dat' is the dumpfile to be read 

Note: Since the compute rdf command will only compute the RDF up to the interaction cutoff distance, we must change this parameter in the pair_style and pair_coeff commands so that we can obtain the RDF over the desired domain (i.e. if we want to compute the RDF up to a cutoff of 4.0, we would set the 'cutoff' arguments in those commands to 4.0).

Monte Carlo simulations