This repository contains a LAMMPS interface for feedback control of molecular dynamics.
The process was tested on a desktop computer with Linux OS (Ubuntu 22.04.3 LTS, jammy)
For correct installation, the recommended steps are:
- Install Python 3 or newer
- Install MPI4PY library for Python
- Download and build latest version of LAMMPS
- Building flags: DBUILD_SHARED_LIBS=yes -DPKG_MANYBODY=yes
- The command:
cmake ../cmake -DBUILD_SHARED_LIBS=yes -DPKG_MANYBODY=yes
- The command:
- Building flags: DBUILD_SHARED_LIBS=yes -DPKG_MANYBODY=yes
- Install Python 3 virtual enviroment (required for correct link between python MPI4PY library and LAMMPS)
- Install python wrapper for LAMMPS
Several other standard Python libraries are also required.
Two examples are provided:
- sim1_prepare_system.py
- sim2_closed_loop_ctrl.py
The examples can be run direcly using python but for faster simulation, we recommend using mpirun
An example of running the example in parallel:
mpirun -np $N /bin/python3 ./sim1_prepare_system.py
where N is number of CPU cores used for execution.
A dataset of a simulation with PID control is available in ./sim_data/sim_data.rar. The data is compressed into a .rar to reduce the data size. You can then use script output_visualization.py to plot the .pkl data or VMD (https://www.ks.uiuc.edu/Research/vmd/) to visualize LAMMPS trajectory file .lammpstrj .