Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbdmodel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
arbdmodel
Commits
02b65fe7
Commit
02b65fe7
authored
5 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Brought in changes from mrdna package to arbdmodel.py from commits 8dafa9f..205bb86
parent
5ed0da54
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arbdmodel/__init__.py
+21
-6
21 additions, 6 deletions
arbdmodel/__init__.py
with
21 additions
and
6 deletions
arbdmodel/__init__.py
+
21
−
6
View file @
02b65fe7
...
...
@@ -99,17 +99,21 @@ class Parent():
x
.
parent
=
None
def
add_bond
(
self
,
i
,
j
,
bond
,
exclude
=
False
):
assert
(
i
is
not
j
)
## TODO: how to handle duplicating and cloning bonds
# beads = [b for b in self]
# for b in (i,j): assert(b in beads)
self
.
bonds
.
append
(
(
i
,
j
,
bond
,
exclude
)
)
def
add_angle
(
self
,
i
,
j
,
k
,
angle
):
assert
(
len
(
set
((
i
,
j
,
k
)))
==
3
)
# beads = [b for b in self]
# for b in (i,j,k): assert(b in beads)
self
.
angles
.
append
(
(
i
,
j
,
k
,
angle
)
)
def
add_dihedral
(
self
,
i
,
j
,
k
,
l
,
dihedral
):
assert
(
len
(
set
((
i
,
j
,
k
,
l
)))
==
4
)
# beads = [b for b in self]
# for b in (i,j,k,l): assert(b in beads)
self
.
dihedrals
.
append
(
(
i
,
j
,
k
,
l
,
dihedral
)
)
...
...
@@ -326,6 +330,7 @@ class ParticleType():
def
__hash_key
(
self
):
l
=
[
self
.
name
,
self
.
charge
]
for
keyval
in
sorted
(
self
.
__dict__
.
items
()):
if
isinstance
(
keyval
[
1
],
list
):
keyval
=
(
keyval
[
0
],
tuple
(
keyval
[
1
]))
l
.
extend
(
keyval
)
return
tuple
(
l
)
...
...
@@ -622,7 +627,7 @@ class PdbModel(Transformable, Parent):
class
ArbdModel
(
PdbModel
):
def
__init__
(
self
,
children
,
dimensions
=
(
1000
,
1000
,
1000
),
temperature
=
291
,
timestep
=
50e-6
,
cutoff
=
50
,
decompPeriod
=
10000
,
pairlistDistance
=
None
,
nonbondedResolution
=
0.1
,
remove_duplicate_bonded_terms
=
True
):
def
__init__
(
self
,
children
,
dimensions
=
(
1000
,
1000
,
1000
),
temperature
=
291
,
timestep
=
50e-6
,
cutoff
=
50
,
decompPeriod
=
10000
,
pairlistDistance
=
None
,
nonbondedResolution
=
0.1
,
remove_duplicate_bonded_terms
=
True
,
extra_bd_file_lines
=
""
):
PdbModel
.
__init__
(
self
,
children
,
dimensions
,
remove_duplicate_bonded_terms
)
self
.
temperature
=
temperature
...
...
@@ -635,6 +640,8 @@ class ArbdModel(PdbModel):
self
.
decompPeriod
=
decompPeriod
self
.
pairlistDistance
=
pairlistDistance
self
.
extra_bd_file_lines
=
extra_bd_file_lines
self
.
numParticles
=
0
self
.
particles
=
[]
self
.
type_counts
=
None
...
...
@@ -697,7 +704,7 @@ class ArbdModel(PdbModel):
if
typeA
!=
typeB
:
self
.
nbSchemes
.
append
(
(
nbScheme
,
typeB
,
typeA
)
)
def
simulate
(
self
,
output_name
,
output_directory
=
'
output
'
,
num_steps
=
100000000
,
timestep
=
None
,
gpu
=
0
,
output_period
=
1e4
,
arbd
=
None
,
directory
=
'
.
'
,
replicas
=
1
):
def
simulate
(
self
,
output_name
,
output_directory
=
'
output
'
,
num_steps
=
100000000
,
timestep
=
None
,
gpu
=
0
,
output_period
=
1e4
,
arbd
=
None
,
directory
=
'
.
'
,
replicas
=
1
,
log_file
=
None
):
assert
(
type
(
gpu
)
is
int
)
num_steps
=
int
(
num_steps
)
...
...
@@ -753,10 +760,16 @@ class ArbdModel(PdbModel):
cmd
=
tuple
(
str
(
x
)
for
x
in
cmd
)
print
(
"
Running ARBD with: %s
"
%
"
"
.
join
(
cmd
))
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
for
line
in
process
.
stdout
:
sys
.
stdout
.
write
(
line
)
sys
.
stdout
.
flush
()
if
log_file
is
None
or
(
hasattr
(
log_file
,
'
write
'
)
and
callable
(
log_file
.
write
)):
fd
=
sys
.
stdout
if
log_file
is
None
else
log_file
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
for
line
in
process
.
stdout
:
fd
.
write
(
line
)
fd
.
flush
()
else
:
with
open
(
log_file
,
'
w
'
)
as
fd
:
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
log_file
,
universal_newlines
=
True
)
process
.
communicate
()
except
:
raise
...
...
@@ -851,6 +864,8 @@ pairlistDistance {pairlistDistance}
origin {originX} {originY} {originZ}
systemSize {dimX} {dimY} {dimZ}
{extra_bd_file_lines}
\n
"""
.
format
(
**
params
))
## Write entries for each type of particle
...
...
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