# ABC MD Setup pipeline using BioExcel Building Blocks (biobb) *** This **BioExcel Building Blocks library (BioBB) workflow** provides a pipeline to setup DNA structures for the **Ascona B-DNA Consortium** (ABC) members. It follows the work started with the [NAFlex](http://mmb.irbbarcelona.org/NAFlex/ABC) tool to offer a single, reproducible pipeline for structure preparation, ensuring **reproducibility** and **coherence** between all the members of the consortium. The **NAFlex pipeline** was used for the preparation of all the simulations done in the study: ***[The static and dynamic structural heterogeneities of B-DNA: extending Calladine–Dickerson rules](https://doi.org/10.1093/nar/gkz905)***. The workflow included in this **Jupyter Notebook** is **extending** and **updating** the **NAFlex pipeline**, following the best practices exposed by the *[Daniel R. Roe and Bernard R. Brooks](https://doi.org/10.1063/5.0013849)* work, and is being used for the **new ABC study**. The **setup process** is performed using the **biobb_amber** module from the **BioBB library**, which is wrapping the **AMBER MD package**. The forcefield used is the nucleic acids specific **[parmbsc1 forcefield](https://doi.org/10.1038/nmeth.3658)**, with **[Joung & Cheatham](https://doi.org/10.1021/jp8001614)** monovalent ion parameters for **Ewald** and **TIP4P/EW** water and **[SPC/E Water model](https://doi.org/10.1021/j100308a038)**. The main **steps of the pipeline** are: - Generate structure **topology** - **Solvate** structure with a truncated octahedron box, with **SCP/E water model** - **Neutralize** the system with Potassium ions - Add an **ionic concentration** of 150mM of Cl- / K+ ions - **Randomize ions** around the structure using cpptraj - Generate **H-mass repartitioned topology** to run the production simulations with a 4fs timestep - **Equilibrate** the system in solvent with a 10-steps protocol ([Daniel R. Roe and Bernard R. Brooks](https://doi.org/10.1063/5.0013849)) - **Production Run** (4fs timestep) *** ## Settings ### Biobb module used - [biobb_amber](https://github.com/bioexcel/biobb_amber): Tools to setup and run Molecular Dynamics simulations using the AMBER MD package. ### Auxiliary libraries used * [jupyter](https://jupyter.org/): Free software, open standards, and web services for interactive computing across all programming languages. * [plotly](https://plot.ly/python/offline/): Python interactive graphing library integrated in Jupyter notebooks. * [nglview](https://nglviewer.org/#nglview): Jupyter/IPython widget to interactively view molecular structures and trajectories in notebooks. * [simpletraj](https://github.com/arose/simpletraj): Lightweight coordinate-only trajectory reader based on code from GROMACS, MDAnalysis and VMD. * [gfortran](https://anaconda.org/conda-forge/gfortran): Fortran 95/2003/2008/2018 compiler for GCC, the GNU Compiler Collection. * [libgfortran5](https://anaconda.org/conda-forge/libgfortran5): Fortran compiler and libraries from the GNU Compiler Collection. ### Conda Installation ```console git clone https://github.com/bioexcel/biobb_wf_amber.git cd biobb_wf_amber conda env create -f conda_env/environment.yml conda activate biobb_wf_amber jupyter-notebook biobb_wf_amber/notebooks/abc_setup/biobb_wf_amber_abc_setup.ipynb ``` *** ## Pipeline steps 1. [Initial Parameters](#input) 2. [Generate Topology](#top) 3. [Add Water Box](#water) 4. [Adding additional ionic concentration](#ions) 5. [Randomize Ions](#random) 6. [Generate Topology with Hydrogen Mass Partitioning (4fs)](#top4fs) 7. [System Equilibration](#eq) 8. [Free MD Simulation](#free) 9. [Output files](#output) ***
|
|
## Generate Topology
Build the **DNA topology** from the **modelled structure** using the **leap tool** from the **AMBER MD package**.
## Adding Water Box
Creating a **water box** surrounding the **DNA structure** using the **leap tool** from the **AMBER MD package**.
## Adding additional ionic concentration
**Neutralizing** the system and adding an additional **ionic concentration** using the **leap tool** from the **AMBER MD package**.
## Randomize ions
**Randomly swap** the positions of **solvent** and **ions** using the **cpptraj tool** from the **AMBER MD package**.
## Generate Topology with Hydrogen Mass Partitioning (4fs)
Modifying the **DNA topology** from the **modelled structure**, tripling the mass of all hydrogens on the system and scaling down the mass of all other atoms using the **parmed tool** from the **AMBER MD package**.
### Equilibration Step 2: NVT equilibration
**Equilibrate** the **system** in **NVT** ensemble (constant number of particles -N-, Volume -V-, and Temperature -T-), using the **sander tool** from the **AMBER MD package**. Taking the system to the desired **temperature**.
**AMBER MD configuration file** used ([step2.in](ABCix_config_files/step2.in)) includes the following **simulation parameters**:
- imin = 0; Run MD (no minimization)
- nstlim = 15000; Number of MD steps
- dt = 0.001; Time step (in ps)
- ntx = 1; Only read initial coordinates from input files
- irest = 0; Do not restart a simulation, start a new one
- ig = -1; Seed for the pseudo-random number generator
- ntwx = 500; Coordinates will be written to the output trajectory file every 500 steps
- ntwv = -1; Velocities will be written to output trajectory file, making it a combined coordinate/velocity trajectory file, at the interval defined by ntwx
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 50; Write energy information to files 'mdout' and 'mdinfo' every 50 steps
- ntwr = 500; Write information to restart file every 500 steps
- iwrap = 0; Not wrapping coordinates into primary box
- nscm = 0; Not removing translational and rotational center-of-mass motions
- ntc = 2; Turn on SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 2; Force evaluation: Bond interactions involving H omitted (SHAKE)
- ntb = 1; Constant Volume Periodic Boundary Conditions (PBC)
- cut = 8.0; Cutoff for non bonded interactions in Angstroms
- ntt = 3; Constant temperature using Langevin dynamics
- gamma_ln = 5; Collision frequency for Langevin dynamics (in 1/ps)
- temp0 = 310.0; Final temperature (310 K)
- tempi = 310.0; Initial temperature (310 K)
- ntr = 1; Turn on positional restraints
- restraintmask = :1-40&!@H=; Restraints on DNA atoms only
- restraint_wt = 5.0; Restraint force constant
**NVT equilibration step** applying **restraints** on the **DNA heavy atoms** with a **force constant** of **5 Kcal/mol.$Å^{2}$**
***
**Building Blocks** used:
- [sander_mdrun](https://biobb-amber.readthedocs.io/en/latest/sander.html#module-sander.sander_mdrun) from **biobb_amber.sander.sander_mdrun**
- [process_mdout](https://biobb-amber.readthedocs.io/en/latest/process.html#module-process.process_mdout) from **biobb_amber.process.process_mdout**
***
```python
# Import module
from biobb_amber.sander.sander_mdrun import sander_mdrun
# Create prop dict and inputs/outputs
prop = {
"mdin" : {
'nstlim' : 500, # Overwrite number of MD steps if needed
'restraintmask' : '\":DA,DC,DG,DT,D=3,D=5&!@H=\"' # Overwrite DNA heavy atoms mask to make it more generic
},
# "sander_path" : "sander.MPI", # Change sander binary to parallel (MPI) execution (not included in AmberTools)
# "mpi_bin" : "mpirun", # MPI runner
# "mpi_np" : 16 # Number of cores to use in the MPI parallel calculation
}
output_eq2_traj_path = 'sander.eq2.nc'
output_eq2_rst_path = 'sander.eq2.ncrst'
output_eq2_log_path = 'sander.eq2.log'
output_eq2_mdinfo_path = 'sander.eq2.mdinfo'
# Create and launch bb
sander_mdrun(input_top_path=dna_leap_top_4fs_path,
input_mdin_path="ABCix_config_files/step2.in",
input_crd_path=output_eq1_rst_path,
input_ref_path=output_eq1_rst_path,
output_traj_path=output_eq2_traj_path,
output_rst_path=output_eq2_rst_path,
output_log_path=output_eq2_log_path,
output_mdinfo_path=output_eq2_mdinfo_path,
properties=prop)
```
### Checking Equilibration Step 2 results
Checking **Equilibration Step 2 - NVT Equilibration** results. Plotting **temperature** by time during the **equilibration process**.
```python
# Import module
from biobb_amber.process.process_mdout import process_mdout
# Create prop dict and inputs/outputs
prop = {
"terms" : ['TEMP']
}
output_dat_eq2_path = 'sander.eq2.energy.dat'
# Create and launch bb
process_mdout(input_log_path=output_eq2_log_path,
output_dat_path=output_dat_eq2_path,
properties=prop)
```
```python
import plotly.graph_objs as go
with open(output_dat_eq2_path, 'r') as energy_file:
x, y = zip(*[
(float(line.split()[0]), float(line.split()[1]))
for line in energy_file
if not line.startswith(("#", "@"))
if float(line.split()[1]) < 1000
])
# Create a scatter plot
fig = go.Figure(data=go.Scatter(x=x, y=y, mode='lines'))
# Update layout
fig.update_layout(title="Equilibration Step 2 - NVT equilibration",
xaxis_title="Energy equilibration time (ps)",
yaxis_title="Temperature (K)",
height=600)
# Show the figure (renderer changes for colab and jupyter)
rend = 'colab' if 'google.colab' in sys.modules else ''
fig.show(renderer=rend)
```
### Equilibration Step 3: System energetic minimization
**Energetically minimize** the **DNA structure** (in solvent) using the **sander tool** from the **AMBER MD package**. Relaxing **system** with **soft restraints** on the **DNA structure**.
**AMBER MD configuration file** used ([step3.in](ABCix_config_files/step3.in)) includes the following **simulation parameters**:
- imin = 1; Run minimization
- ntmin = 2; Steepest Descent minimization method
- maxcyc = 1000; Number of minimization steps
- ncyc = 10; Switch from steepest descent to conjugate gradient after 10 cycles (if ntmin = 1)
- ntwx = 500; Coordinates will be written to the output trajectory file every 500 steps
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 50; Write energy information to files 'mdout' and 'mdinfo' every 50 steps
- ntwr = 500; Write information to restart file every 500 steps
- ntc = 1; Turn off SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 1; Force evaluation: complete interactions are calculated
- ntb = 1; Constant Volume Periodic Boundary Conditions (PBC)
- cut = 8.0; Cutoff for non bonded interactions in Angstroms
- ntr = 1; Turn on positional restraints
- restraintmask = :1-40&!@H=; Restraints on DNA atoms only
- restraint_wt = 2.0; Restraint force constant
Further **minimization step** lowering the **restraints** on the **DNA heavy atoms** to **2 Kcal/mol.$Å^{2}$** force constant.
***
**Building Blocks** used:
- [sander_mdrun](https://biobb-amber.readthedocs.io/en/latest/sander.html#module-sander.sander_mdrun) from **biobb_amber.sander.sander_mdrun**
- [process_minout](https://biobb-amber.readthedocs.io/en/latest/process.html#module-process.process_minout) from **biobb_amber.process.process_minout**
***
```python
# Import module
from biobb_amber.sander.sander_mdrun import sander_mdrun
# Create prop dict and inputs/outputs
prop = {
"mdin" : {
'maxcyc' : 500, # Overwrite number of minimization steps if needed
'restraintmask' : '\":DA,DC,DG,DT,D=3,D=5&!@H=\"' # Overwrite DNA heavy atoms mask to make it more generic
},
# "sander_path" : "sander.MPI", # Change sander binary to parallel (MPI) execution (not included in AmberTools)
# "mpi_bin" : "mpirun", # MPI runner
# "mpi_np" : 16 # Number of cores to use in the MPI parallel calculation
}
output_eq3_traj_path = 'sander.eq3.nc'
output_eq3_rst_path = 'sander.eq3.ncrst'
output_eq3_log_path = 'sander.eq3.log'
output_eq3_mdinfo_path = 'sander.eq3.mdinfo'
# Create and launch bb
sander_mdrun(input_top_path=dna_leap_top_4fs_path,
input_mdin_path="ABCix_config_files/step3.in",
input_crd_path=output_eq2_rst_path,
input_ref_path=output_eq2_rst_path,
output_traj_path=output_eq3_traj_path,
output_rst_path=output_eq3_rst_path,
output_log_path=output_eq3_log_path,
output_mdinfo_path=output_eq3_mdinfo_path,
properties=prop)
```
### Checking Equilibration Step 3 results
Checking **Equilibration Step 3 - System Energetic Minimization** results. Plotting **potential energy** along time during the **minimization process**.
```python
# Import module
from biobb_amber.process.process_minout import process_minout
# Create prop dict and inputs/outputs
prop = {
"terms" : ['ENERGY']
}
output_dat_eq3_path = 'sander.eq3.energy.dat'
# Create and launch bb
process_minout(input_log_path=output_eq3_log_path,
output_dat_path=output_dat_eq3_path,
properties=prop)
```
```python
import plotly.graph_objs as go
with open(output_dat_eq3_path, 'r') as energy_file:
x, y = zip(*[
(float(line.split()[0]), float(line.split()[1]))
for line in energy_file
if not line.startswith(("#", "@"))
if float(line.split()[1]) < 1000
])
# Create a scatter plot
fig = go.Figure(data=go.Scatter(x=x, y=y, mode='lines'))
# Update layout
fig.update_layout(title="Equilibration Step 3",
xaxis_title="Energy Minimization Step",
yaxis_title="Potential Energy kcal/mol",
height=600)
# Show the figure (renderer changes for colab and jupyter)
rend = 'colab' if 'google.colab' in sys.modules else ''
fig.show(renderer=rend)
```
### Equilibration Step 4: System energetic minimization
**Energetically minimize** the **DNA structure** (in solvent) using the **sander tool** from the **AMBER MD package**. Relaxing **system** with **minimum restraints** on the **DNA structure**.
**AMBER MD configuration file** used ([step4.in](ABCix_config_files/step4.in)) includes the following **simulation parameters**:
- imin = 1; Run minimization
- ntmin = 2; Steepest Descent minimization method
- maxcyc = 1000; Number of minimization steps
- ncyc = 10; Switch from steepest descent to conjugate gradient after 10 cycles (if ntmin = 1)
- ntwx = 500; Coordinates will be written to the output trajectory file every 500 steps
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 50; Write energy information to files 'mdout' and 'mdinfo' every 50 steps
- ntwr = 500; Write information to restart file every 500 steps
- ntc = 1; Turn off SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 1; Force evaluation: complete interactions are calculated
- ntb = 1; Constant Volume Periodic Boundary Conditions (PBC)
- cut = 8.0; Cutoff for non bonded interactions in Angstroms
- ntr = 1; Turn on positional restraints
- restraintmask = :1-40&!@H=; Restraints on DNA atoms only
- restraint_wt = 0.1; Restraint force constant
Further **minimization step** lowering the **restraints** on the **DNA heavy atoms** to **0.1 Kcal/mol.$Å^{2}$** force constant.
***
**Building Blocks** used:
- [sander_mdrun](https://biobb-amber.readthedocs.io/en/latest/sander.html#module-sander.sander_mdrun) from **biobb_amber.sander.sander_mdrun**
- [process_minout](https://biobb-amber.readthedocs.io/en/latest/process.html#module-process.process_minout) from **biobb_amber.process.process_minout**
***
```python
# Import module
from biobb_amber.sander.sander_mdrun import sander_mdrun
# Create prop dict and inputs/outputs
prop = {
"mdin" : {
'maxcyc' : 500, # Overwrite number of minimization steps if needed
'restraintmask' : '\":DA,DC,DG,DT,D=3,D=5&!@H=\"' # Overwrite DNA heavy atoms mask to make it more generic
},
# "sander_path" : "sander.MPI", # Change sander binary to parallel (MPI) execution (not included in AmberTools)
# "mpi_bin" : "mpirun", # MPI runner
# "mpi_np" : 16 # Number of cores to use in the MPI parallel calculation
}
output_eq4_traj_path = 'sander.eq4.nc'
output_eq4_rst_path = 'sander.eq4.ncrst'
output_eq4_log_path = 'sander.eq4.log'
output_eq4_mdinfo_path = 'sander.eq4.mdinfo'
# Create and launch bb
sander_mdrun(input_top_path=dna_leap_top_4fs_path,
input_mdin_path="ABCix_config_files/step4.in",
input_crd_path=output_eq3_rst_path,
input_ref_path=output_eq3_rst_path,
output_traj_path=output_eq4_traj_path,
output_rst_path=output_eq4_rst_path,
output_log_path=output_eq4_log_path,
output_mdinfo_path=output_eq4_mdinfo_path,
properties=prop)
```
### Checking Equilibration Step 4 results
Checking **Equilibration Step 4 - System Energetic Minimization** results. Plotting **potential energy** along time during the **minimization process**.
```python
# Import module
from biobb_amber.process.process_minout import process_minout
# Create prop dict and inputs/outputs
prop = {
"terms" : ['ENERGY']
}
output_dat_eq4_path = 'sander.eq4.energy.dat'
# Create and launch bb
process_minout(input_log_path=output_eq4_log_path,
output_dat_path=output_dat_eq4_path,
properties=prop)
```
```python
import plotly.graph_objs as go
with open(output_dat_eq4_path, 'r') as energy_file:
x, y = zip(*[
(float(line.split()[0]), float(line.split()[1]))
for line in energy_file
if not line.startswith(("#", "@"))
if float(line.split()[1]) < 1000
])
# Create a scatter plot
fig = go.Figure(data=go.Scatter(x=x, y=y, mode='lines'))
# Update layout
fig.update_layout(title="Equilibration Step 4",
xaxis_title="Energy Minimization Step",
yaxis_title="Potential Energy kcal/mol",
height=600)
# Show the figure (renderer changes for colab and jupyter)
rend = 'colab' if 'google.colab' in sys.modules else ''
fig.show(renderer=rend)
```
### Equilibration Step 5: System energetic minimization
**Energetically minimize** the **DNA structure** (in solvent) using the **sander tool** from the **AMBER MD package**. Relaxing **system** **without restraints** on the **DNA structure**.
**AMBER MD configuration file** used ([step5.in](ABCix_config_files/step5.in)) includes the following **simulation parameters**:
- imin = 1; Run minimization
- ntmin = 2; Steepest Descent minimization method
- maxcyc = 1000; Number of minimization steps
- ncyc = 10; Switch from steepest descent to conjugate gradient after 10 cycles (if ntmin = 1)
- ntwx = 500; Coordinates will be written to the output trajectory file every 500 steps
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 50; Write energy information to files 'mdout' and 'mdinfo' every 50 steps
- ntwr = 500; Write information to restart file every 500 steps
- ntc = 1; Turn off SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 1; Force evaluation: complete interactions are calculated
- ntb = 1; Constant Volume Periodic Boundary Conditions (PBC)
- cut = 8.0; Cutoff for non bonded interactions in Angstroms
- ntr = 0; Turn off positional restraints
Further **minimization step**, with all **position restraints** on the **DNA heavy atoms** released.
***
**Building Blocks** used:
- [sander_mdrun](https://biobb-amber.readthedocs.io/en/latest/sander.html#module-sander.sander_mdrun) from **biobb_amber.sander.sander_mdrun**
- [process_minout](https://biobb-amber.readthedocs.io/en/latest/process.html#module-process.process_minout) from **biobb_amber.process.process_minout**
***
```python
# Import module
from biobb_amber.sander.sander_mdrun import sander_mdrun
# Create prop dict and inputs/outputs
prop = {
"mdin" : {
'maxcyc' : 500 # Overwrite number of minimization steps if needed
},
# "sander_path" : "sander.MPI", # Change sander binary to parallel (MPI) execution (not included in AmberTools)
# "mpi_bin" : "mpirun", # MPI runner
# "mpi_np" : 16 # Number of cores to use in the MPI parallel calculation
}
output_eq5_traj_path = 'sander.eq5.nc'
output_eq5_rst_path = 'sander.eq5.ncrst'
output_eq5_log_path = 'sander.eq5.log'
output_eq5_mdinfo_path = 'sander.eq5.mdinfo'
# Create and launch bb
sander_mdrun(input_top_path=dna_leap_top_4fs_path,
input_mdin_path="ABCix_config_files/step5.in",
input_crd_path=output_eq4_rst_path,
input_ref_path=output_eq4_rst_path,
output_traj_path=output_eq5_traj_path,
output_rst_path=output_eq5_rst_path,
output_log_path=output_eq5_log_path,
output_mdinfo_path=output_eq5_mdinfo_path,
properties=prop)
```
### Checking Equilibration Step 5 results
Checking **Equilibration Step 5 - System Energetic Minimization** results. Plotting **potential energy** along time during the **minimization process**.
```python
# Import module
from biobb_amber.process.process_minout import process_minout
# Create prop dict and inputs/outputs
prop = {
"terms" : ['ENERGY']
}
output_dat_eq5_path = 'sander.eq5.energy.dat'
# Create and launch bb
process_minout(input_log_path=output_eq5_log_path,
output_dat_path=output_dat_eq5_path,
properties=prop)
```
```python
import plotly.graph_objs as go
with open(output_dat_eq5_path, 'r') as energy_file:
x, y = zip(*[
(float(line.split()[0]), float(line.split()[1]))
for line in energy_file
if not line.startswith(("#", "@"))
if float(line.split()[1]) < 1000
])
# Create a scatter plot
fig = go.Figure(data=go.Scatter(x=x, y=y, mode='lines'))
# Update layout
fig.update_layout(title="Equilibration Step 5",
xaxis_title="Energy Minimization Step",
yaxis_title="Potential Energy kcal/mol",
height=600)
# Show the figure (renderer changes for colab and jupyter)
rend = 'colab' if 'google.colab' in sys.modules else ''
fig.show(renderer=rend)
```
### Equilibration Step 6: NPT equilibration
**Equilibrate** the **system** in **NPT** ensemble (constant number of particles -N-, Pressure -P-, and Temperature -T-), using the **sander tool** from the **AMBER MD package**.
**AMBER MD configuration file** used ([step6.in](ABCix_config_files/step6.in)) includes the following **simulation parameters**:
- imin = 0; Run MD (no minimization)
- nstlim = 5000; Number of MD steps
- dt = 0.001; Time step (in ps)
- ntx = 1; Only read initial coordinates from input files
- irest = 0; Do not restart a simulation, start a new one
- ig = -1; Seed for the pseudo-random number generator
- ntwx = 500; Coordinates will be written to the output trajectory file every 500 steps
- ntwv = -1; Velocities will be written to output trajectory file, making it a combined coordinate/velocity trajectory file, at the interval defined by ntwx
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 50; Write energy information to files 'mdout' and 'mdinfo' every 50 steps
- ntwr = 500; Write information to restart file every 500 steps
- iwrap = 0; Not wrapping coordinates into primary box
- nscm = 0; Not removing translational and rotational center-of-mass motions
- ntc = 2; Turn on SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 2; Force evaluation: Bond interactions involving H omitted (SHAKE)
- ntb = 2; Constant Pressure Periodic Boundary Conditions (PBC)
- cut = 8.0; Cutoff for non bonded interactions in Angstroms
- ntt = 3; Constant temperature using Langevin dynamics
- gamma_ln = 5; Collision frequency for Langevin dynamics (in 1/ps)
- temp0 = 310.0; Final temperature (310 K)
- tempi = 310.0; Initial temperature (310 K)
- ntp = 1; Constant pressure dynamics: md with isotropic position scaling
- barostat = 2; Monte Carlo Barostat
- pres0 = 1.0; Reference pressure at which the system is maintained
- ntr = 1; Turn on positional restraints
- restraintmask = :1-40&!@H=; Restraints on DNA atoms only
- restraint_wt = 1.0; Restraint force constant
**NPT equilibration step** applying **restraints** on the **DNA heavy atoms** with a **force constant** of **1 Kcal/mol.$Å^{2}$**
***
**Building Blocks** used:
- [sander_mdrun](https://biobb-amber.readthedocs.io/en/latest/sander.html#module-sander.sander_mdrun) from **biobb_amber.sander.sander_mdrun**
- [process_mdout](https://biobb-amber.readthedocs.io/en/latest/process.html#module-process.process_mdout) from **biobb_amber.process.process_mdout**
***
```python
# Import module
from biobb_amber.sander.sander_mdrun import sander_mdrun
# Create prop dict and inputs/outputs
prop = {
"mdin" : {
'nstlim' : 500, # Overwrite number of MD steps if needed
'restraintmask' : '\":DA,DC,DG,DT,D=3,D=5&!@H=\"' # Overwrite DNA heavy atoms mask to make it more generic
},
# "sander_path" : "sander.MPI", # Change sander binary to parallel (MPI) execution (not included in AmberTools)
# "mpi_bin" : "mpirun", # MPI runner
# "mpi_np" : 16 # Number of cores to use in the MPI parallel calculation
}
output_eq6_traj_path = 'sander.eq6.nc'
output_eq6_rst_path = 'sander.eq6.ncrst'
output_eq6_log_path = 'sander.eq6.log'
output_eq6_mdinfo_path = 'sander.eq6.mdinfo'
# Create and launch bb
sander_mdrun(input_top_path=dna_leap_top_4fs_path,
input_mdin_path="ABCix_config_files/step6.in",
input_crd_path=output_eq5_rst_path,
input_ref_path=output_eq5_rst_path,
output_traj_path=output_eq6_traj_path,
output_rst_path=output_eq6_rst_path,
output_log_path=output_eq6_log_path,
output_mdinfo_path=output_eq6_mdinfo_path,
properties=prop)
```
### Checking Equilibration Step 6 results
Checking **Equilibration Step 6 - NPT Equilibration** results. Plotting **density** and **pressure** by time during the **equilibration process**.
```python
# Import module
from biobb_amber.process.process_mdout import process_mdout
# Create prop dict and inputs/outputs
prop = {
"terms" : ['PRES','DENSITY']
}
output_dat_eq6_path = 'sander.eq6.pressure_and_density.dat'
# Create and launch bb
process_mdout(input_log_path=output_eq6_log_path,
output_dat_path=output_dat_eq6_path,
properties=prop)
```
```python
# Read pressure and density data from file
import plotly.graph_objs as go
from plotly import subplots
# Read pressure and density data from file
with open(output_dat_eq6_path, 'r') as pd_file:
x, y, z = zip(*[
(float(line.split()[0]), float(line.split()[1]), float(line.split()[2]))
for line in pd_file
if not line.startswith(("#", "@"))
])
# Create a scatter plot
trace1 = go.Scatter(
x=x,y=y
)
trace2 = go.Scatter(
x=x,y=z
)
fig = subplots.make_subplots(rows=1, cols=2, print_grid=False)
fig.append_trace(trace1, 1, 1)
fig.append_trace(trace2, 1, 2)
fig['layout']['xaxis1'].update(title='Time (ps)')
fig['layout']['xaxis2'].update(title='Time (ps)')
fig['layout']['yaxis1'].update(title='Pressure (bar)')
fig['layout']['yaxis2'].update(title='Density (Kg*m^-3)')
fig['layout'].update(title='Pressure and Density during NPT Equilibration')
fig['layout'].update(showlegend=False)
fig['layout'].update(height=500)
# Show the figure (renderer changes for colab and jupyter)
rend = 'colab' if 'google.colab' in sys.modules else ''
fig.show(renderer=rend)
```
### Equilibration Step 7: NPT equilibration
**Equilibrate** the **system** in **NPT** ensemble (constant number of particles -N-, Pressure -P-, and Temperature -T-), using the **sander tool** from the **AMBER MD package**. Lowering **restraints force constant**.
**AMBER MD configuration file** used ([step7.in](ABCix_config_files/step7.in)) includes the following **simulation parameters**:
- imin = 0; Run MD (no minimization)
- nstlim = 5000; Number of MD steps
- dt = 0.001; Time step (in ps)
- ntx = 5; Read initial coordinates and velocities from restart file
- irest = 1; Restart previous simulation from restart file
- ig = -1; Seed for the pseudo-random number generator
- ntwx = 500; Coordinates will be written to the output trajectory file every 500 steps
- ntwv = -1; Velocities will be written to output trajectory file, making it a combined coordinate/velocity trajectory file, at the interval defined by ntwx
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 50; Write energy information to files 'mdout' and 'mdinfo' every 50 steps
- ntwr = 500; Write information to restart file every 500 steps
- iwrap = 0; Not wrapping coordinates into primary box
- nscm = 0; Not removing translational and rotational center-of-mass motions
- ntc = 2; Turn on SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 2; Force evaluation: Bond interactions involving H omitted (SHAKE)
- ntb = 2; Constant Pressure Periodic Boundary Conditions (PBC)
- cut = 8.0; Cutoff for non bonded interactions in Angstroms
- ntt = 3; Constant temperature using Langevin dynamics
- gamma_ln = 5; Collision frequency for Langevin dynamics (in 1/ps)
- temp0 = 310.0; Final temperature (310 K)
- tempi = 310.0; Initial temperature (310 K)
- ntp = 1; Constant pressure dynamics: md with isotropic position scaling
- barostat = 2; Monte Carlo Barostat
- pres0 = 1.0; Reference pressure at which the system is maintained
- ntr = 1; Turn on positional restraints
- restraintmask = :1-40&!@H=; Restraints on DNA atoms only
- restraint_wt = 0.5; Restraint force constant
**NPT equilibration step** applying **restraints** on the **DNA heavy atoms** with a **force constant** of **0.5 Kcal/mol.$Å^{2}$**.
### Equilibration Step 8: NPT equilibration
**Equilibrate** the **system** in **NPT** ensemble (constant number of particles -N-, Pressure -P-, and Temperature -T-), using the **sander tool** from the **AMBER MD package**. Releasing **position restraints** from the atoms of the **DNA bases** (keeping only backbone atoms restrained).
**AMBER MD configuration file** used ([step8.in](ABCix_config_files/step8.in)) includes the following **simulation parameters**:
- imin = 0; Run MD (no minimization)
- nstlim = 10000; Number of MD steps
- dt = 0.001; Time step (in ps)
- ntx = 5; Read initial coordinates and velocities from restart file
- irest = 1; Restart previous simulation from restart file
- ig = -1; Seed for the pseudo-random number generator
- ntwx = 500; Coordinates will be written to the output trajectory file every 500 steps
- ntwv = -1; Velocities will be written to output trajectory file, making it a combined coordinate/velocity trajectory file, at the interval defined by ntwx
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 50; Write energy information to files 'mdout' and 'mdinfo' every 50 steps
- ntwr = 500; Write information to restart file every 500 steps
- iwrap = 0; Not wrapping coordinates into primary box
- nscm = 0; Not removing translational and rotational center-of-mass motions
- ntc = 2; Turn on SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 2; Force evaluation: Bond interactions involving H omitted (SHAKE)
- ntb = 2; Constant Pressure Periodic Boundary Conditions (PBC)
- cut = 8.0; Cutoff for non bonded interactions in Angstroms
- ntt = 3; Constant temperature using Langevin dynamics
- gamma_ln = 5; Collision frequency for Langevin dynamics (in 1/ps)
- temp0 = 310.0; Final temperature (310 K)
- tempi = 310.0; Initial temperature (310 K)
- ntp = 1; Constant pressure dynamics: md with isotropic position scaling
- barostat = 2; Monte Carlo Barostat
- pres0 = 1.0; Reference pressure at which the system is maintained
- ntr = 1; Turn on positional restraints
- restraintmask = :1-40@P,O5',C5',C4',C3',O3'; Restraints on DNA atoms only
- restraint_wt = 0.5; Restraint force constant
**NPT equilibration step** applying **restraints** on the **DNA backbone atoms** with a **force constant** of **0.5 Kcal/mol.$Å^{2}$**.
### Equilibration Step 9: NPT equilibration
**Equilibrate** the **system** in **NPT** ensemble (constant number of particles -N-, Pressure -P-, and Temperature -T-), using the **sander tool** from the **AMBER MD package**. Releasing all **position restraints**.
**AMBER MD configuration file** used ([step9.in](ABCix_config_files/step9.in)) includes the following **simulation parameters**:
- imin = 0; Run MD (no minimization)
- nstlim = 5000; Number of MD steps
- dt = 0.002; Time step (in ps)
- ntx = 5; Read initial coordinates and velocities from restart file
- irest = 1; Restart previous simulation from restart file
- ig = -1; Seed for the pseudo-random number generator
- ntwx = 500; Coordinates will be written to the output trajectory file every 500 steps
- ntwv = -1; Velocities will be written to output trajectory file, making it a combined coordinate/velocity trajectory file, at the interval defined by ntwx
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 50; Write energy information to files 'mdout' and 'mdinfo' every 50 steps
- ntwr = 500; Write information to restart file every 500 steps
- iwrap = 0; Not wrapping coordinates into primary box
- nscm = 1000; Removing translational and rotational center-of-mass motions every 1000 steps
- ntc = 2; Turn on SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 2; Force evaluation: Bond interactions involving H omitted (SHAKE)
- ntb = 2; Constant Pressure Periodic Boundary Conditions (PBC)
- cut = 8.0; Cutoff for non bonded interactions in Angstroms
- ntt = 3; Constant temperature using Langevin dynamics
- gamma_ln = 5; Collision frequency for Langevin dynamics (in 1/ps)
- temp0 = 310.0; Final temperature (310 K)
- tempi = 310.0; Initial temperature (310 K)
- ntp = 1; Constant pressure dynamics: md with isotropic position scaling
- barostat = 2; Monte Carlo Barostat
- pres0 = 1.0; Reference pressure at which the system is maintained
- ntr = 0; Turn off positional restraints
**NPT equilibration step** without any **position restraints**.
### Equilibration Step 10: NPT equilibration
**Equilibrate** the **system** in **NPT** ensemble (constant number of particles -N-, Pressure -P-, and Temperature -T-), using the **sander tool** from the **AMBER MD package**. Upon completion of the previous **equilibration steps**, the system is now well-equilibrated at the desired **temperature** and **pressure**. The last step of the **DNA** MD setup is a short, **free MD simulation**, to ensure the robustness of the system.
**AMBER MD configuration file** used ([step10.in](ABCix_config_files/step10.in)) includes the following **simulation parameters**:
- imin = 0; Run MD (no minimization)
- nstlim = 500000; Number of MD steps
- dt = 0.002; Time step (in ps)
- ntx = 5; Read initial coordinates and velocities from restart file
- irest = 1; Restart previous simulation from restart file
- ig = -1; Seed for the pseudo-random number generator
- ntwx = 5000; Coordinates will be written to the output trajectory file every 5000 steps
- ntwv = -1; Velocities will be written to output trajectory file, making it a combined coordinate/velocity trajectory file, at the interval defined by ntwx
- ioutfm = 1; Write trajectory in netcdf format
- ntxo = 2; Write restart in netcdf format
- ntpr = 500; Write energy information to files 'mdout' and 'mdinfo' every 500 steps
- ntwr = 50000; Write information to restart file every 50000 steps
- iwrap = 0; Not wrapping coordinates into primary box
- nscm = 1000; Removing translational and rotational center-of-mass motions every 1000 steps
- ntc = 2; Turn on SHAKE for constraining length of bonds involving Hydrogen atoms
- ntf = 2; Force evaluation: Bond interactions involving H omitted (SHAKE)
- ntb = 2; Constant Pressure Periodic Boundary Conditions (PBC)
- cut = 9.0; Cutoff for non bonded interactions in Angstroms
- ntt = 3; Constant temperature using Langevin dynamics
- gamma_ln = 5; Collision frequency for Langevin dynamics (in 1/ps)
- temp0 = 310.0; Final temperature (310 K)
- tempi = 310.0; Initial temperature (310 K)
- ntp = 1; Constant pressure dynamics: md with isotropic position scaling
- barostat = 2; Monte Carlo Barostat
- pres0 = 1.0; Reference pressure at which the system is maintained
- ntr = 0; Turn off positional restraints
**NPT equilibration step** without any **position restraints**.
***
## Free Molecular Dynamics Simulation
Upon completion of the **10 equilibration phases**, the system can now be used for the production simulation.