Hacking Lammps

Post date: May 5, 2016 11:32:50 PM

The computational model of Red blood cells (RBCs) used in my work actually is based on coarse grained molecular dynamics. There are many molecular dynamics simulation package. The one I am familiar with is LAMMPS. It is a great opensource package. Once you have some basic understanding of c++, you can learn and modify lammps source code for your research purpose. You can also see how the data structure is used to store bond_list, angle_list and dihedral_list that is typically required for a molecular simulation code. Advanced topics such as geometry based decomposition can also be telescoped from the source code. Thus, knowing lammps is not only useful for doing numerical simulations for research, it also helps you improve skills on coding and software pattern design. If you are a beginner, I suggested you start from a nice lammps hacker guide.

Once you get some feelings about lammps, you can try to modify lammps source code. Steve Plimpton has slides on how to modify lammps, see here. Here I only give one simple example on implementing a new bond potential. Let us say if I want to implement a new worm like chain potential, I will check the most simple potential provided by lammps first, e.g, bond_harmonic.h and bond_harmonic.cpp. From bond_harmonic potential, through analogy, I determine what parameters I need to provide through the input file, how to read the parameters, initialize any necessary memory address, and how to calculate the force due to the potential. From my experience, this is the most effective way of learning or modifying lammps.