A simple molecular dynamics simulation code written in Julia.
-
MD_sim.jl : A sample MD code with LJ Potential
-
MD_sim_custom_PES.jl: A sample code that works to use a custom PES. Here, it uses a
FORTRANPES for formaldehyde$^{1,2}$ . I have integrated theFORTRANcode with Julia to call the function using a shared library. -
Code/ : Conatins all the back-end codes.
Sample animation for an LJ cluster:
To use the code download the entire Code folder to your system. And run this code from your julia terminal.
import Pkg
Pkg.develop(path="/path/to/Code")
The code defines three main object types (implemented in types.jl):
- System: Contains positions, velocities, and all system-related information.
- SimulationParams: Includes number of steps, timestep (dt), output frequency, boundaries, and other simulation parameters
- Trajectory: Stores positions during the simulation, total energy, potential energy, temperature, and all trajectory-related data
Capabilities:
- Initialize geometry as a grid in 3D
- Optimize geometries using FIRE or dampened velocity Verlet.
- Perform MD simulations for any user-defined interatomic potential or custom PES.
- Outputs VMD-compatible files for visualization
Limitations:
- No explicit way to grab a force field. (The user can define a way to grab a force field from another library and use it with this code)
- No Thermostats, No PBC
- No explicit parallelization (The MD steps are vectorized natively in Julia (but not parallelized using MPI))
Use conda activate to initiuate the corerct python enviornment in which tblite is installed.
Then do:
export JULIA_CONDAPKG_BACKEND=Null # tell CondaPkg not to manage an env
export JULIA_PYTHONCALL_EXE="$(which python)" # use this env's interpreter
Verify this by:
julia -e 'using PythonCall; println(pyimport("sys").executable); println(pyimport("numpy").__version__)'
If using the FORTRAN PES for triplet formaldehyde additional configuration of files is needed. check readme.md inside the folder FORTRAN_Test_PES.
1: The sample H2CO PES was obtained from the chempotpy library, which used a PIP-NN from another publication: PIP NN: https://pubs.rsc.org/en/content/articlelanding/2017/cp/c7cp04578f, Li, Jun, Changjian Xie, and Hua Guo. “Kinetics and dynamics of the C (3 P)+ H 2 O reaction on a full-dimensional accurate triplet state potential energy surface.” Physical Chemistry Chemical Physics 19, no. 34 (2017): 23280-23288.
2: Chempotpy: https://pubs.acs.org/doi/full/10.1021/acs.jpca.3c05Shu, Yinan, Zoltan Varga, Dayou Zhang, and Donald G. Truhlar. “ChemPotPy: A Python Library for Analytic Representations of Potential Energy Surfaces and Diabatic Potential Energy Matrices.” The Journal of Physical Chemistry A 127, no. 45 (2023): 9635-9640.899.