Perform a simulation with an All-Atom Structure-Based Model using OpenSMOG¶
This tutorial should take between 5 to 15 minutes of reading and performing simulations.
Input files for this tutorial can be found here
The first step is to import the OpenSMOG module
[ ]:
from OpenSMOG import SBM
SBM class sets the parameters for the simulation:
name="2ci2"
Sets the name of each simulation (this name is used as prefix for the outputs). time_step=0.002
(reduced time unit) Sets the time step used in integration. collision_rate=1.0
(reduced inverse-time unit) Sets the collision rate in the Langevin integrator. r_cutoff=1.2
(nanometers) Sets the non-bonded cutoff. temperature=0.5
(reduced temperature unit) Sets the temperature for the simulation.
sbm_AA is an arbitrarily chosen variable name for the SBM object
[ ]:
sbm_AA = SBM(name='2ci2', time_step=0.002, collision_rate=1.0, r_cutoff=1.2, temperature=0.5)
There are three hardware platform options to run the simulations:
platform="cuda"
platform="HIP"
platform="opencl"
platform="cpu"
if cuda, opencl or HIP is choosen the GPUindex can be define as “0”. If two GPUs are used, one may give “0,1”
[ ]:
sbm_AA.setup_openmm(platform='cuda',GPUindex='default')
Sets the directory name where the output files are saved
[ ]:
sbm_AA.saveFolder('output_2ci2_AA')
Load the gro, top and xml files into the sbm_AA object
[ ]:
sbm_AA_grofile = 'SMOG2_AA_CI2/2ci2.AA.gro'
sbm_AA_topfile = 'SMOG2_AA_CI2/2ci2.AA.top'
sbm_AA_xmlfile = 'SMOG2_AA_CI2/2ci2.AA.xml'
sbm_AA.loadSystem(Grofile=sbm_AA_grofile, Topfile=sbm_AA_topfile, Xmlfile=sbm_AA_xmlfile)
This function returns the name of each contact potential that is being used in the current model. In this example, only a Lennard-Jones-style 6-12 potential is being applied.
The simulation context is created with all information given in the previous steps.
[ ]:
sbm_AA.createSimulation()
Create the reporters that will save the simulation data in an output folder.
trajectory=True
Save the trajectory in .dcd format. energies=True
Save the energy in text format separated by a comma. interval=10**3
The interval (in steps) at which the trajectory and energies are saved.
[ ]:
sbm_AA.createReporters(trajectory=True, energies=True, energy_components=True, interval=10**3)
The run
function receives the following parameters:
nsteps=10**6
Number of steps to perform in the simulation. report=True
Shows the simulation details (Progress (%), Step and Time Remaining) interval=10**3
The step interval to show the details
[ ]:
sbm_AA.run(nsteps=10**6, report=True, interval=10**3)
The output files are located in the output folder