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
cebb9934
Commit
cebb9934
authored
Feb 26, 2019
by
tic20
Browse files
Corrected behaviour of improper caching.
parent
f9540d88
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+14
-3
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
cebb9934
...
@@ -1998,17 +1998,28 @@ class PeriodicTorsionGenerator(object):
...
@@ -1998,17 +1998,28 @@ class PeriodicTorsionGenerator(object):
if
match
.
k
[
i
]
!=
0
:
if
match
.
k
[
i
]
!=
0
:
force
.
addTorsion
(
torsion
[
0
],
torsion
[
1
],
torsion
[
2
],
torsion
[
3
],
match
.
periodicity
[
i
],
match
.
phase
[
i
],
match
.
k
[
i
])
force
.
addTorsion
(
torsion
[
0
],
torsion
[
1
],
torsion
[
2
],
torsion
[
3
],
match
.
periodicity
[
i
],
match
.
phase
[
i
],
match
.
k
[
i
])
impr_cache
=
{}
impr_cache
=
{}
# from collections import defaultdict
for
torsion
in
data
.
impropers
:
for
torsion
in
data
.
impropers
:
t1
,
t2
,
t3
,
t4
=
[
data
.
atomType
[
data
.
atoms
[
torsion
[
i
]]]
for
i
in
range
(
4
)]
t1
,
t2
,
t3
,
t4
=
tatoms
=
[
data
.
atomType
[
data
.
atoms
[
torsion
[
i
]]]
for
i
in
range
(
4
)]
sig
=
(
t1
,
frozenset
((
t2
,
t3
,
t4
)))
sig
=
(
t1
,
t2
,
t3
,
t4
)
# tcount = defaultdict(int)
# for t in (t2,t3,t4):
# tcount[t] += 1
# sig = (t1, frozenset((atype, count) for atype, count in tcount.items()))
match
=
impr_cache
.
get
(
sig
,
None
)
match
=
impr_cache
.
get
(
sig
,
None
)
if
match
==
-
1
:
if
match
==
-
1
:
# Previously checked, and doesn't appear in the database
# Previously checked, and doesn't appear in the database
continue
continue
elif
match
:
i1
,
i2
,
i3
,
i4
,
tordef
=
match
a1
,
a2
,
a3
,
a4
=
(
torsion
[
i
]
for
i
in
(
i1
,
i2
,
i3
,
i4
))
match
=
(
a1
,
a2
,
a3
,
a4
,
tordef
)
if
match
is
None
:
if
match
is
None
:
match
=
_matchImproper
(
data
,
torsion
,
self
)
match
=
_matchImproper
(
data
,
torsion
,
self
)
if
match
is
not
None
:
if
match
is
not
None
:
impr_cache
[
sig
]
=
match
order
=
match
[:
4
]
i1
,
i2
,
i3
,
i4
=
tuple
(
torsion
.
index
(
a
)
for
a
in
order
)
impr_cache
[
sig
]
=
(
i1
,
i2
,
i3
,
i4
,
match
[
-
1
])
else
:
else
:
impr_cache
[
sig
]
=
-
1
impr_cache
[
sig
]
=
-
1
if
match
is
not
None
:
if
match
is
not
None
:
...
...
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