Skip to content
Snippets Groups Projects
Commit cfa59271 authored by pinyili2's avatar pinyili2
Browse files

same as above

parent bc69d565
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:fba6117b tags:
%% Cell type:markdown id:024005b4 tags:
# 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
## Step 1: Model Construction
We will begin with
We will start with the Hps Model we just saw in section 2 following and run the initial conformation with the same procedures.
%% Cell type:code id:60d287ac tags:
%% Cell type:code id:04d59bef tags:
``` python
import numpy as np
from pathlib import Path
from arbdmodel import ArbdEngine
from arbdmodel.coords import readArbdCoords
from arbdmodel.polymer import PolymerSection
from arbdmodel.hps_polymer_model import _types
from arbdmodel.hps_polymer_model import HpsModel as NupModel
#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
)
engine = ArbdEngine( integrator = 'Langevin',
num_steps=1e7,
output_period=1e4,
gpu = 0
)
directory = f'1-one_bead_per_res-{model_name}'
outname = 'run'
if not Path(f'{directory}/output/{outname}.dcd').exists():
# """ "Minimization" """
# add_restraints(model,restraints)
# model.simulate(output_name='{}-min-{}'.format(model_name,step),
# num_steps=1e3, output_period=500,
# gpu=gpu,
# )
# coords = readArbdCoords('output/{}-min-{}.restart'.format(model_name,step))
# model.update_splines(coords)
""" Production """
model.set_damping_coefficient( 100 )
engine.simulate(model, output_name=outname,
directory = directory
)
```
%% Cell type:markdown id:5fb80332 tags:
Then we can run the simulation with
%% Cell type:code id:28a28e18 tags:
``` python
_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 ) )
```
%% Cell type:markdown id:e0987f4a tags:
Then we can run the simulation with
%% Cell type:code id:1ad8de8d tags:
``` python
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
)
```
%% Cell type:code id:6942a0b7 tags:
%% Cell type:code id:b5aef887 tags:
``` python
```
......
%% Cell type:markdown id:fba6117b tags:
%% Cell type:markdown id:024005b4 tags:
# 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
## Step 1: Model Construction
We will begin with
We will start with the Hps Model we just saw in section 2 following and run the initial conformation with the same procedures.
%% Cell type:code id:60d287ac tags:
%% Cell type:code id:04d59bef tags:
``` python
import numpy as np
from pathlib import Path
from arbdmodel import ArbdEngine
from arbdmodel.coords import readArbdCoords
from arbdmodel.polymer import PolymerSection
from arbdmodel.hps_polymer_model import _types
from arbdmodel.hps_polymer_model import HpsModel as NupModel
#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
)
engine = ArbdEngine( integrator = 'Langevin',
num_steps=1e7,
output_period=1e4,
gpu = 0
)
directory = f'1-one_bead_per_res-{model_name}'
outname = 'run'
if not Path(f'{directory}/output/{outname}.dcd').exists():
# """ "Minimization" """
# add_restraints(model,restraints)
# model.simulate(output_name='{}-min-{}'.format(model_name,step),
# num_steps=1e3, output_period=500,
# gpu=gpu,
# )
# coords = readArbdCoords('output/{}-min-{}.restart'.format(model_name,step))
# model.update_splines(coords)
""" Production """
model.set_damping_coefficient( 100 )
engine.simulate(model, output_name=outname,
directory = directory
)
```
%% Cell type:markdown id:5fb80332 tags:
Then we can run the simulation with
%% Cell type:code id:28a28e18 tags:
``` python
_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 ) )
```
%% Cell type:markdown id:e0987f4a tags:
Then we can run the simulation with
%% Cell type:code id:1ad8de8d tags:
``` python
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
)
```
%% Cell type:code id:6942a0b7 tags:
%% Cell type:code id:b5aef887 tags:
``` python
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment