Simulation with a C-alpha Structure-Based Model using OpenSMOG
This tutorial should take between 5 to 15 minutes to complete.
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.0005 (reduced time unit) Sets the time step used in integration. collision_rate=1.0 (reduced inverse-time unit) Sets the collision rate for the Langevin integrator. r_cutoff=1.1 (nanometers) Sets the non-bonded cutoff. temperature=0.5 (reduced temperature unit) Sets the temperature in the simulation.
sbm_CA is an arbitrarily chosen variable name for the SBM object
[ ]:
sbm_CA = SBM(name='2ci2', time_step=0.0005, collision_rate=1.0, r_cutoff=1.1, 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_CA.setup_openmm(platform='cuda',GPUindex='default')
Sets the directory name where to save the simulation outputs
[ ]:
sbm_CA.saveFolder('output_2ci2_CA')
Load the gro, top and xml files into the sbm_CA object
[ ]:
sbm_CA_grofile = 'SMOG2_CA_CI2/2ci2.CA.gro'
sbm_CA_topfile = 'SMOG2_CA_CI2/2ci2.CA.top'
sbm_CA_xmlfile = 'SMOG2_CA_CI2/2ci2.CA.xml'
sbm_CA.loadSystem(Grofile=sbm_CA_grofile, Topfile=sbm_CA_topfile, Xmlfile=sbm_CA_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 10-12 potential is being applied.
The simulation context is created with all information given in the previous steps.
[ ]:
sbm_CA.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_CA.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 be performed in the simulation. report=True Show the simulation details (Progress (%), Step and Time Remaining) interval=10**3 The step interval to show the details
[ ]:
sbm_CA.run(nsteps=10**6, report=True, interval=10**3)
The output files are located in the output folder