A Python library for building and running simple dissipative particle dynamics (DPD) simulations using HOOMD-blue.
Built using python3.6.9
- Python3 (Tested on version 3.6.9)
- HOOMD-blue (http://glotzerlab.engin.umich.edu/hoomd-blue/)
- numpy
- fresnel
- pillow
This library is used to automate DPD simulations of linear polymers using HOOMD-blue. It is intended to be used with Google Colab Notebooks to teach basic concepts of polymer physics to undergraduate students. The library is designed to perform three main functions:
- Build a linear polymer of N monomers and run a DPD simulation in HOOMD-blue
- Take monomer coordinates from the HOOMD-blue simulation and calculate the radius of gyration
- Render the 3-dimensional conformation of the polymer chain
The function simulate_polymer_dpd is used to set-up and run a DPD simulation of a linear polymer in HOOMD-blue. The function returns the monomer coordinates and save a trajectory file. Users must enter the number of monomers (gamma), the diameter of DPD bead (sigma), the MD timestep (dt), the number of timesteps (steps), the energy of the system (kT), the trajectory filename, (trajectory_filename), and the number of frames to save in the trajectory file ((traj_frames)
from polysim.main import simulate_polymer_dpd
## Enter number of monomers
N = 10;
## Enter alpha, the repulsive force constant in the DPD conservative force
alpha = 0.1;
## Enter the number of timesteps
steps = 1e5
## Run simulation: Save the XYZ coordinates of the monomers
coordinates = simulate_polymer_dpd(N, alpha, steps = steps);
## View monomer XYZ coordiantes
print(coordinates)
Once the polymer has been simulated, you can visualize the conformation using the render_polymer function. This function takes the monomer coordinates output (i.e. coordinates variable) from the simulate_polymer_dpd and renders a 3D visualization of the polymer using fresnel.
from polysim.main import render_polymer
render_polymer(coordinates)
