Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
58d2c69b
Unverified
Commit
58d2c69b
authored
Jul 13, 2022
by
Peter Eastman
Committed by
GitHub
Jul 13, 2022
Browse files
Avoid clashes when adding solvent to non-rectangular boxes (#3696)
parent
171b28b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
wrappers/python/openmm/app/modeller.py
wrappers/python/openmm/app/modeller.py
+13
-4
No files found.
wrappers/python/openmm/app/modeller.py
View file @
58d2c69b
...
@@ -602,7 +602,7 @@ class Modeller(object):
...
@@ -602,7 +602,7 @@ class Modeller(object):
filteredWaters
=
[]
filteredWaters
=
[]
cells
.
cells
=
{}
cells
.
cells
=
{}
for
i
in
range
(
len
(
lowerSkinPositions
)):
for
i
in
range
(
len
(
lowerSkinPositions
)):
cell
=
tuple
((
int
(
floor
(
lowerSkinPositions
[
i
]
[
j
]
/
cells
.
cellSize
[
j
]))
%
cells
.
numCells
[
j
]
for
j
in
range
(
3
))
)
cell
=
cells
.
cellForPosition
(
lowerSkinPositions
[
i
])
if
cell
in
cells
.
cells
:
if
cell
in
cells
.
cells
:
cells
.
cells
[
cell
].
append
(
i
)
cells
.
cells
[
cell
].
append
(
i
)
else
:
else
:
...
@@ -1587,6 +1587,8 @@ class _CellList(object):
...
@@ -1587,6 +1587,8 @@ class _CellList(object):
self
.
cells
=
{}
self
.
cells
=
{}
self
.
numCells
=
tuple
((
max
(
1
,
int
(
floor
(
vectors
[
i
][
i
]
/
maxCutoff
)))
for
i
in
range
(
3
)))
self
.
numCells
=
tuple
((
max
(
1
,
int
(
floor
(
vectors
[
i
][
i
]
/
maxCutoff
)))
for
i
in
range
(
3
)))
self
.
cellSize
=
tuple
((
vectors
[
i
][
i
]
/
self
.
numCells
[
i
]
for
i
in
range
(
3
)))
self
.
cellSize
=
tuple
((
vectors
[
i
][
i
]
/
self
.
numCells
[
i
]
for
i
in
range
(
3
)))
self
.
vectors
=
vectors
self
.
periodic
=
periodic
invBox
=
Vec3
(
1.0
/
vectors
[
0
][
0
],
1.0
/
vectors
[
1
][
1
],
1.0
/
vectors
[
2
][
2
])
invBox
=
Vec3
(
1.0
/
vectors
[
0
][
0
],
1.0
/
vectors
[
1
][
1
],
1.0
/
vectors
[
2
][
2
])
for
i
in
range
(
len
(
self
.
positions
)):
for
i
in
range
(
len
(
self
.
positions
)):
pos
=
self
.
positions
[
i
]
pos
=
self
.
positions
[
i
]
...
@@ -1595,19 +1597,26 @@ class _CellList(object):
...
@@ -1595,19 +1597,26 @@ class _CellList(object):
pos
-=
floor
(
pos
[
1
]
*
invBox
[
1
])
*
vectors
[
1
]
pos
-=
floor
(
pos
[
1
]
*
invBox
[
1
])
*
vectors
[
1
]
pos
-=
floor
(
pos
[
0
]
*
invBox
[
0
])
*
vectors
[
0
]
pos
-=
floor
(
pos
[
0
]
*
invBox
[
0
])
*
vectors
[
0
]
self
.
positions
[
i
]
=
pos
self
.
positions
[
i
]
=
pos
cell
=
tuple
((
int
(
floor
(
pos
[
j
]
/
self
.
cellSize
[
j
]))
%
self
.
numCells
[
j
]
for
j
in
range
(
3
))
)
cell
=
self
.
cellForPosition
(
pos
)
if
cell
in
self
.
cells
:
if
cell
in
self
.
cells
:
self
.
cells
[
cell
].
append
(
i
)
self
.
cells
[
cell
].
append
(
i
)
else
:
else
:
self
.
cells
[
cell
]
=
[
i
]
self
.
cells
[
cell
]
=
[
i
]
def
cellForPosition
(
self
,
pos
):
if
self
.
periodic
:
invBox
=
Vec3
(
1.0
/
self
.
vectors
[
0
][
0
],
1.0
/
self
.
vectors
[
1
][
1
],
1.0
/
self
.
vectors
[
2
][
2
])
pos
=
pos
-
floor
(
pos
[
2
]
*
invBox
[
2
])
*
self
.
vectors
[
2
]
pos
-=
floor
(
pos
[
1
]
*
invBox
[
1
])
*
self
.
vectors
[
1
]
pos
-=
floor
(
pos
[
0
]
*
invBox
[
0
])
*
self
.
vectors
[
0
]
return
tuple
((
int
(
floor
(
pos
[
j
]
/
self
.
cellSize
[
j
]))
%
self
.
numCells
[
j
]
for
j
in
range
(
3
)))
def
neighbors
(
self
,
pos
):
def
neighbors
(
self
,
pos
):
centralCell
=
tuple
((
int
(
floor
(
pos
[
i
]
/
self
.
cellSize
[
i
]))
for
i
in
range
(
3
)))
offsets
=
(
-
1
,
0
,
1
)
offsets
=
(
-
1
,
0
,
1
)
for
i
in
offsets
:
for
i
in
offsets
:
for
j
in
offsets
:
for
j
in
offsets
:
for
k
in
offsets
:
for
k
in
offsets
:
cell
=
((
centralCell
[
0
]
+
i
+
self
.
numCell
s
[
0
]
)
%
self
.
numCells
[
0
],
(
centralCell
[
1
]
+
j
+
self
.
numCells
[
1
])
%
self
.
numCells
[
1
],
(
centralCell
[
2
]
+
k
+
self
.
numCells
[
2
])
%
self
.
numCells
[
2
])
cell
=
self
.
cellForPosition
(
Vec3
(
po
s
[
0
]
+
i
*
self
.
cellSize
[
0
],
pos
[
1
]
+
j
*
self
.
cellSize
[
1
],
pos
[
2
]
+
k
*
self
.
cellSize
[
2
])
)
if
cell
in
self
.
cells
:
if
cell
in
self
.
cells
:
for
atom
in
self
.
cells
[
cell
]:
for
atom
in
self
.
cells
[
cell
]:
yield
atom
yield
atom
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment