Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mrdna
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tbgl
tools
mrdna
Commits
aacf4cba
Commit
aacf4cba
authored
5 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Added easy commands for ignoring long bonds during coarse-simulation
parent
d64e2892
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/mrdna
+3
-1
3 additions, 1 deletion
bin/mrdna
mrdna/simulate.py
+21
-6
21 additions, 6 deletions
mrdna/simulate.py
with
24 additions
and
7 deletions
bin/mrdna
+
3
−
1
View file @
aacf4cba
...
@@ -53,7 +53,8 @@ parser.add_argument('--oxdna-steps', type=float, default=None,
...
@@ -53,7 +53,8 @@ parser.add_argument('--oxdna-steps', type=float, default=None,
help
=
'
Perform an oxDNA simulation instead of creating atomic model
'
)
help
=
'
Perform an oxDNA simulation instead of creating atomic model
'
)
parser
.
add_argument
(
'
--oxdna-output-period
'
,
type
=
float
,
default
=
1e4
,
parser
.
add_argument
(
'
--oxdna-output-period
'
,
type
=
float
,
default
=
1e4
,
help
=
'
Simulation steps between oxDNA configuration and energy output
'
)
help
=
'
Simulation steps between oxDNA configuration and energy output
'
)
parser
.
add_argument
(
'
--coarse-bond-cutoff
'
,
type
=
float
,
default
=
0
,
help
=
'
Ignore bonds beyond this cutoff during first step of simulation; a value of 0 implies bonds are not ignored
'
)
parser
.
add_argument
(
'
--backbone-scale
'
,
type
=
float
,
default
=
1.0
,
parser
.
add_argument
(
'
--backbone-scale
'
,
type
=
float
,
default
=
1.0
,
help
=
'
Factor to scale DNA backbone in atomic model; try 0.25 to avoid clashes for atomistic simulations
'
)
help
=
'
Factor to scale DNA backbone in atomic model; try 0.25 to avoid clashes for atomistic simulations
'
)
...
@@ -155,6 +156,7 @@ def main():
...
@@ -155,6 +156,7 @@ def main():
minimization_output_period
=
int
(
args
.
output_period
),
minimization_output_period
=
int
(
args
.
output_period
),
coarse_local_twist
=
args
.
coarse_local_twist
,
coarse_local_twist
=
args
.
coarse_local_twist
,
fix_linking_number
=
args
.
fix_linking_number
,
fix_linking_number
=
args
.
fix_linking_number
,
bond_cutoff
=
args
.
coarse_bond_cutoff
,
coarse_output_period
=
int
(
args
.
output_period
),
coarse_output_period
=
int
(
args
.
output_period
),
fine_output_period
=
int
(
args
.
output_period
),
fine_output_period
=
int
(
args
.
output_period
),
minimization_steps
=
0
,
# int(args.minimization_steps),
minimization_steps
=
0
,
# int(args.minimization_steps),
...
...
This diff is collapsed.
Click to expand it.
mrdna/simulate.py
+
21
−
6
View file @
aacf4cba
...
@@ -4,8 +4,22 @@ from .arbdmodel.coords import readArbdCoords, readAvgArbdCoords
...
@@ -4,8 +4,22 @@ from .arbdmodel.coords import readArbdCoords, readAvgArbdCoords
import
shutil
import
shutil
from
.
import
get_resource_path
from
.
import
get_resource_path
import
numpy
as
np
## TODO: implement replicas, initial conditions specified through some restart, and a custom simulation schedule
## TODO: implement replicas, initial conditions specified through some restart, and a custom simulation schedule
def
_remove_bonds_beyond
(
model
,
cutoff
):
bonds
=
model
.
get_bonds
()
new_bonds
=
[]
for
bond
in
bonds
:
n1
,
n2
,
b
,
ex
=
bond
r2
=
np
.
sum
(
(
n1
.
position
-
n2
.
position
)
**
2
)
if
r2
>
cutoff
**
2
:
for
l
in
[
model
]
+
model
.
children
:
try
:
l
.
bonds
.
remove
(
bond
)
except
:
...
def
minimize_and_simulate_oxdna
(
model
,
def
minimize_and_simulate_oxdna
(
model
,
output_name
,
output_name
,
...
@@ -61,7 +75,7 @@ def multiresolution_simulation( model, output_name,
...
@@ -61,7 +75,7 @@ def multiresolution_simulation( model, output_name,
fine_output_period
=
1e5
,
fine_output_period
=
1e5
,
coarse_local_twist
=
False
,
coarse_local_twist
=
False
,
fix_linking_number
=
False
,
fix_linking_number
=
False
,
remove_long_bonds
=
False
,
bond_cutoff
=
0
,
backbone_scale
=
1.0
,
backbone_scale
=
1.0
,
oxdna_steps
=
None
,
oxdna_steps
=
None
,
oxdna_output_period
=
None
,
oxdna_output_period
=
None
,
...
@@ -123,10 +137,11 @@ def multiresolution_simulation( model, output_name,
...
@@ -123,10 +137,11 @@ def multiresolution_simulation( model, output_name,
# TODO: add the output directory in to the readArbdCoords functions or make it an attribute of the model object
# TODO: add the output directory in to the readArbdCoords functions or make it an attribute of the model object
"""
Prepare coarse model for minimization and coarse simulation
"""
"""
Prepare coarse model for minimization and coarse simulation
"""
if
remove_long_bonds
:
raise
NotImplementedError
(
"
TODO: remove long bonds
"
)
model
.
clear_beads
()
model
.
clear_beads
()
model
.
generate_bead_model
(
**
coarse_model_args
)
model
.
generate_bead_model
(
**
coarse_model_args
)
if
bond_cutoff
>
0
:
_remove_bonds_beyond
(
model
,
bond_cutoff
)
"""
Minimization
"""
"""
Minimization
"""
if
minimization_steps
>
0
:
if
minimization_steps
>
0
:
...
@@ -137,11 +152,11 @@ def multiresolution_simulation( model, output_name,
...
@@ -137,11 +152,11 @@ def multiresolution_simulation( model, output_name,
"""
Coarse simulation
"""
"""
Coarse simulation
"""
simargs
=
dict
(
timestep
=
150e-6
if
coarse_local_twist
else
200e-6
,
output_period
=
coarse_output_period
,
gpu
=
gpu
)
simargs
=
dict
(
timestep
=
150e-6
if
coarse_local_twist
else
200e-6
,
output_period
=
coarse_output_period
,
gpu
=
gpu
)
if
remove_long_bonds
:
if
bond_cutoff
>
0
and
minimization_steps
<=
0
:
run_step
(
num_steps
=
0.
0
5
*
coarse_steps
,
simargs
=
simargs
)
run_step
(
num_steps
=
0.
2
5
*
coarse_steps
,
simargs
=
simargs
)
model
.
clear_beads
()
model
.
clear_beads
()
model
.
generate_bead_model
(
**
coarse_model_args
)
model
.
generate_bead_model
(
**
coarse_model_args
)
run_step
(
num_steps
=
0.
9
5
*
coarse_steps
,
simargs
=
simargs
)
run_step
(
num_steps
=
0.
7
5
*
coarse_steps
,
simargs
=
simargs
)
else
:
else
:
run_step
(
num_steps
=
coarse_steps
,
simargs
=
simargs
)
run_step
(
num_steps
=
coarse_steps
,
simargs
=
simargs
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment