"serialization/tests/TestSerializeCustomVolumeForce.cpp" did not exist on "ff88ddadca8ed8a67946efda9550253745401fe4"
Commit 2c83421c authored by Robert McGibbon's avatar Robert McGibbon
Browse files

reorder the exclusion before the pair_12_6_es_term so simplify code

parent 8244403c
...@@ -343,6 +343,9 @@ class DesmondDMSFile(object): ...@@ -343,6 +343,9 @@ class DesmondDMSFile(object):
for charge, sigma, epsilon in self._conn.execute(q): for charge, sigma, epsilon in self._conn.execute(q):
nb.addParticle(charge, sigma*angstrom, epsilon*kilocalorie_per_mole) nb.addParticle(charge, sigma*angstrom, epsilon*kilocalorie_per_mole)
for p0, p1 in self._conn.execute('SELECT p0, p1 FROM exclusion'):
nb.addException(p0, p1, 0.0, 1.0, 0.0)
q = '''SELECT p0, p1, aij, bij, qij q = '''SELECT p0, p1, aij, bij, qij
FROM pair_12_6_es_term INNER JOIN pair_12_6_es_param FROM pair_12_6_es_term INNER JOIN pair_12_6_es_param
ON pair_12_6_es_term.param=pair_12_6_es_param.id;''' ON pair_12_6_es_term.param=pair_12_6_es_param.id;'''
...@@ -357,7 +360,7 @@ class DesmondDMSFile(object): ...@@ -357,7 +360,7 @@ class DesmondDMSFile(object):
else: else:
new_epsilon = b_ij**2/(4*a_ij) new_epsilon = b_ij**2/(4*a_ij)
new_sigma = (a_ij / b_ij)**(1.0/6.0) new_sigma = (a_ij / b_ij)**(1.0/6.0)
nb.addException(p0, p1, q_ij, new_sigma, new_epsilon) nb.addException(p0, p1, q_ij, new_sigma, new_epsilon, True)
n_total = self._conn.execute('''SELECT COUNT(*) FROM pair_12_6_es_term''').fetchone() n_total = self._conn.execute('''SELECT COUNT(*) FROM pair_12_6_es_term''').fetchone()
n_in_exclusions= self._conn.execute('''SELECT COUNT(*) n_in_exclusions= self._conn.execute('''SELECT COUNT(*)
...@@ -366,19 +369,6 @@ class DesmondDMSFile(object): ...@@ -366,19 +369,6 @@ class DesmondDMSFile(object):
if not n_total == n_in_exclusions: if not n_total == n_in_exclusions:
raise NotImplementedError('All pair_12_6_es_terms must have a corresponding exclusion') raise NotImplementedError('All pair_12_6_es_terms must have a corresponding exclusion')
# Desmond puts scaled 1-4 interactions in the pair_12_6_es
# table, and then adds a corresponding exception here. We are
# using the exception part of NonbondedForce, so we're just
# adding the 1-4 interaction as an exception when its
# registered, and then NOT registering it as an exception here.
q = '''SELECT E.p0, E.p1
FROM exclusion E LEFT OUTER JOIN pair_12_6_es_term P ON
E.p0 = P.p0 and E.p1 = P.p1
WHERE P.p0 is NULL'''
# http://stackoverflow.com/questions/5464131/finding-pairs-that-do-not-exist-in-a-different-table
for p0, p1 in self._conn.execute(q):
nb.addException(p0, p1, 0.0, 1.0, 0.0)
return nb return nb
def _hasTable(self, table_name): def _hasTable(self, table_name):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment