ParM
parm
A molecular dynamics library
|
![Build Status](https://travis-ci.org/wackywendell/parm.svg?branch=master)
The purpose of this library is to provide methods to produce any MD simulation, with any type of integrator, any type of particles, and any type of force in 2D or 3D.
It is currently single-core only, and provides objects for many different integrators, and many different forces, which can be composed together for simulations from a few particles bouncing around in a box to a full protein simulation.
There are several examples in C++ in the src/bin
folder, all with good comments:
LJatoms.cpp
(LJatoms.cpp): a simulation of a Lennard-Jones simulation (2D, or 3D)packer.cpp
(packer.cpp): Generates packings (2D or 3D)hardspheres.cpp
(hardspheres.cpp): for a more unconventional example of collision-driven dynamicsSee pyparm/examples/LJ.py
(LJ.py) for an example of a simple Lennard-Jones simulation, with data analysis included.
See pyparm/packmin.py
for an example of how to make a packing.
Vec
: this is a "vector" in the physics sense, having either 2 or 3 dimensions.Atom
: an Atom
is the basic unit of the simulation; it represents a particle with mass, position, velocity, etc.AtomGroup
: an AtomGroup
is a set of atoms, grouped together for the sake of utility.
Interaction
: an Interaction
is a definition of a force and energy, such as a Lennard-Jones potential (use NListed<IEpsSigCutAtom, LJAttractRepulsePair>
), springs for bonds (BondPairs
), etc.NeighborList
, then use NListed<FooAtom, FooPair>
as the InteractionBox
: a box is either infinite (InfiniteBox
) or periodic (OriginBox
), and takes care of the boundary conditionsCollection
: a grouping together of a Box
, AtomGroup
, and Interaction
s, with an integrator (such as velocity Verlet, CollectionVerlet
, or brownian motion, CollectionSol
).Box
. OriginBox
is a good standard choice for periodic boundary conditions.AtomVec
.box.rand_loc()
, for a random point inside the boxrand_vec()
, which generates a Gaussian distribution, like the expected Boltzmann distributionInteraction
s. For neighborlisted interactions, make NeighborList
first, then make interactions.NListed<EpsSigAtom, LJRepulsivePair>
(LJRepulsive
in Python) is a repulsive Lennard-Jones InteractionNListed<EpsSigExpAtom, RepulsionPair>
(Repulsion
in Python) is a Repulsion or Harmonic Interaction (exponent can be chosen)Collection
. Note that the NeighborList has to be added to trackers
CollectionVerlet
is a good NVE CollectionCollection.timestep()
many, many timesCollection.kinetic_energy()
or Collection.temp()
to get statisticstracker
s like RsqTracker
to track running statisticsOn Ubuntu, the following packages should suffice for Python 3:
For Python 2, simply use the same packages but with the python-
prefix instead of python3-
.
Note that you will need to make sure you include Boost and Eigen in you "include" path. On Ubuntu, Boost will be by default, but you may need to add Eigen:
Note that the attached .travis.yml
file are computer-readable instructions for automatically building and testing this module on an Ubuntu machine, so that should always be up to date.
This library includes a sim.i
file for use with SWIG for generating Python bindings.
make wraps
to generate the SWIG wrappers.python3 setup.py build_ext --inplace
to build it in place, or python3 setup.py install
to install.setup.py
files; run python3 setup.py --help
to see more options.Use import pyparm.d2 as sim
or import pyparm.d3 as sim
to import the module. Then use it freely.
This module uses the equation \(V\left(r\right)=\varepsilon\left(1-\frac{\sigma^{6}}{r^{6}}\right)^{2}\)
The other standard form is \(V\left(r\right)=4\varepsilon\left(\frac{\sigma^{\prime12}}{r^{12}}-\frac{\sigma^{12}}{r^{6}}\right)\)
To convert, use \(\sigma=2^{\frac{1}{6}}\sigma^{\prime}\).