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
6457307f
Commit
6457307f
authored
6 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
arbdmodel now preserves particle order
parent
47414bcf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arbdmodel.py
+17
-8
17 additions, 8 deletions
arbdmodel.py
with
17 additions
and
8 deletions
arbdmodel.py
+
17
−
8
View file @
6457307f
...
...
@@ -491,8 +491,8 @@ class ArbdModel(PdbModel):
def
_updateParticleOrder
(
self
):
## Create ordered list
particles
=
[
p
for
p
in
self
]
self
.
particles
=
sorted
(
particles
,
key
=
lambda
p
:
(
p
.
type_
,
p
.
idx
))
self
.
particles
=
[
p
for
p
in
self
]
#
self.particles = sorted(particles, key=lambda p: (p.type_, p.idx))
## Update particle indices
for
p
,
i
in
zip
(
self
.
particles
,
range
(
len
(
self
.
particles
))):
...
...
@@ -509,7 +509,7 @@ class ArbdModel(PdbModel):
assert
(
type
(
gpu
)
is
int
)
numSteps
=
int
(
numSteps
)
if
self
.
cacheUpToDate
==
False
:
if
self
.
cacheUpToDate
==
False
:
# TODO: remove cache?
self
.
_countParticleTypes
()
self
.
_updateParticleOrder
()
...
...
@@ -566,7 +566,8 @@ class ArbdModel(PdbModel):
self
.
_dihedral_filename
=
"
%s/%s.dihedrals.txt
"
%
(
d
,
prefix
)
self
.
_exclusion_filename
=
"
%s/%s.exculsions.txt
"
%
(
d
,
prefix
)
self
.
_writeArbdCoordFile
(
prefix
+
"
.coord.txt
"
)
# self._writeArbdCoordFile( prefix + ".coord.txt" )
self
.
_writeArbdParticleFile
(
prefix
+
"
.particles.txt
"
)
self
.
_writeArbdBondFile
()
self
.
_writeArbdAngleFile
()
self
.
_writeArbdDihedralFile
()
...
...
@@ -574,10 +575,17 @@ class ArbdModel(PdbModel):
self
.
_writeArbdPotentialFiles
(
prefix
,
directory
=
d
)
self
.
_writeArbdConf
(
prefix
,
numSteps
=
numSteps
,
outputPeriod
=
outputPeriod
)
def
_writeArbdCoordFile
(
self
,
filename
):
# def _writeArbdCoordFile(self, filename):
# with open(filename,'w') as fh:
# for p in self.particles:
# fh.write("%f %f %f\n" % tuple(x for x in p.collapsedPosition()))
def
_writeArbdParticleFile
(
self
,
filename
):
with
open
(
filename
,
'
w
'
)
as
fh
:
for
p
in
self
.
particles
:
fh
.
write
(
"
%f %f %f
\n
"
%
tuple
(
x
for
x
in
p
.
collapsedPosition
()))
data
=
tuple
([
p
.
idx
,
p
.
name
]
+
[
x
for
x
in
p
.
collapsedPosition
()])
fh
.
write
(
"
ATOM %d %s %f %f %f
\n
"
%
data
)
def
_writeArbdConf
(
self
,
prefix
,
randomSeed
=
None
,
numSteps
=
100000000
,
outputPeriod
=
10000
,
restartCoordinateFile
=
None
):
## TODO: raise exception if _writeArbdPotentialFiles has not been called
...
...
@@ -592,7 +600,8 @@ class ArbdModel(PdbModel):
params
[
'
randomSeed
'
]
=
"
seed %s
"
%
randomSeed
params
[
'
numSteps
'
]
=
int
(
numSteps
)
params
[
'
coordinateFile
'
]
=
"
%s.coord.txt
"
%
prefix
# params['coordinateFile'] = "%s.coord.txt" % prefix
params
[
'
particleFile
'
]
=
"
%s.particles.txt
"
%
prefix
if
restartCoordinateFile
is
None
:
params
[
'
restartCoordinates
'
]
=
""
else
:
...
...
@@ -646,7 +655,7 @@ diffusion {diffusivity}
## Write coordinates and interactions
fh
.
write
(
"""
## Input coordinates
input
Coordinates {coordinat
eFile}
input
Particles {particl
eFile}
{restartCoordinates}
## Interaction potentials
...
...
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