Skip to content
Snippets Groups Projects
3-run-and-customized.ipynb 4.36 KiB

Learn to run simulation and implement customized coarsed-grained polymer models

As we've dived into the polymer objects in arbd and learned the basic usage of arbd, now it's time to put everything together and run coarsed-grained protein model using arbd! We will constructing a polymer model by coarse-graining the HpsModel.

Step 1: Model Construction testing

We will begin with

import numpy as np
from arbdmodel.polymer import PolymerSection
from arbdmodel.hps_polymer_model import _types
from arbdmodel.hps_polymer_model import HpsModel as NupModel

_seq = 'GLFG' * 8              # 10 repeats per polymer
## We're going to tile polymers along x and y in a square lattice
Nx = 5
Ny = 5
N_polymers = Nx*Ny

density = 55                    # mg / mL

""" Calculated parameters """
polymer_mass = sum( [_types[aa].mass for aa in _seq] ) # in daltons
## units "mg/ml" "dalton/AA**3"
_conversion = 0.0006022142

dimensions = (Nx*Ny*polymer_mass/(density*_conversion))**(1/3) # in Angstroms, the unit of length in ARBD
dimensions = [dimensions]*3                                 # along x,y,z

xs = np.linspace( -dimensions[0]*0.5, dimensions[0]*0.5, Nx+1 ) # row edges (one extra value)
ys = np.linspace( -dimensions[1]*0.5, dimensions[1]*0.5, Ny+1 ) # column edges
xs = (xs[1:] + xs[:-1])*0.5                                     # row centers
ys = (ys[1:] + ys[:-1])*0.5                                     # column centers

z = np.arange(len(_seq))*3.8*0.5         # times coordinate for every amino acid in a polymer, compressed a bit

""" Build peptide list consisting of sequence, coordinates"""
peptides = []

for x in xs:
    for y in ys:
        r = np.empty( (len(_seq),3) ) # allocate array for coordinates of each amino acid in polymer
        r[:,0] = x
        r[:,1] = y
        r[:,2] = z

        peptides.append( (_seq, r ) )

Then we can run the simulation with

from pathlib import Path
from arbdmodel import ArbdEngine
from arbdmodel.coords import readArbdCoords

#from info import NupModel, create_arbd_polymer_objects, dimensions

temperature = 298.15
ion_concentration = 250         # in mM
gpu = 0

decomp_period = 50
skin_depth = 8
## 3.2

model_name = 'HPS'
step = 1

## units "sqrt(80 epsilon0 k K /(2 * (mM/particle) * e**2))" AA
debye_length = 10

polymers, sequences = create_arbd_polymer_objects()

model = NupModel( polymers, sequences,
                  debye_length = debye_length,
                  temperature=temperature,
                  damping_coefficient = 50000, # units of 1/ns
                  decomp_period = decomp_period,
                  pairlist_distance = 50+skin_depth,
                  dimensions = dimensions
                  )