Skip to content

Commit 00571b4

Browse files
authored
Merge pull request #31 from Humourist/fluctuated_water_FF
Fluctuated leading term water force field
2 parents b2c71c3 + 24ad9a6 commit 00571b4

File tree

13 files changed

+6525
-11
lines changed

13 files changed

+6525
-11
lines changed

dmff/admp/pairwise.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def distribute_multipoles(multipoles, index):
4040
def distribute_dispcoeff(c_list, index):
4141
return c_list[index]
4242

43+
@jit_condition(static_argnums=())
44+
def distribute_matrix(multipoles,index1,index2):
45+
return multipoles[index1,index2]
4346

4447
def generate_pairwise_interaction(pair_int_kernel, covalent_map, static_args):
4548
'''

dmff/admp/parser.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import numpy as np
44
import warnings
55
from collections import defaultdict
6+
import jax.numpy as jnp
7+
from dmff.admp.multipole import convert_cart2harm
68

79
def read_atom_line(line_full):
810
"""
@@ -326,7 +328,8 @@ def read_xml(fileobj):
326328
set_axis_type(atomTemplates)
327329

328330
return atomTemplates, residueTemplates
329-
331+
332+
330333
class Atom:
331334

332335
def __init__(self, serial, name, resName, resSeq, position, charge, ) -> None:
@@ -474,4 +477,4 @@ def assemble_covalent(residueDicts, natoms):
474477
covalent_map[c][pp] = dr
475478

476479
return covalent_map
477-
480+

dmff/admp/pme.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
from dmff.admp.pairwise import (
2828
distribute_scalar,
2929
distribute_v3,
30-
distribute_multipoles
30+
distribute_multipoles,
31+
distribute_matrix
3132
)
3233

3334

@@ -792,7 +793,8 @@ def pme_real(positions, box, pairs,
792793
r2 = distribute_v3(positions, pairs[:, 1])
793794
Q_extendi = distribute_multipoles(Q_global, pairs[:, 0])
794795
Q_extendj = distribute_multipoles(Q_global, pairs[:, 1])
795-
nbonds = covalent_map[pairs[:, 0], pairs[:, 1]]
796+
nbonds = distribute_matrix(covalent_map,pairs[:, 0],pairs[:, 1])
797+
#nbonds = covalent_map[pairs[:, 0], pairs[:, 1]]
796798
indices = nbonds-1
797799
mscales = distribute_scalar(mScales, indices)
798800
mscales = mscales * buffer_scales
@@ -896,4 +898,4 @@ def pol_penalty(U_ind, pol):
896898
# this is to remove the singularity when pol=0
897899
pol_pi = trim_val_0(pol)
898900
# pol_pi = pol/(jnp.exp((-pol+1e-08)*1e10)+1) + 1e-08/(jnp.exp((pol-1e-08)*1e10)+1)
899-
return jnp.sum(0.5/pol_pi*(U_ind**2).T) * DIELECTRIC
901+
return jnp.sum(0.5/pol_pi*(U_ind**2).T) * DIELECTRIC

dmff/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ def createForce(self, system, data, nonbondedMethod, nonbondedCutoff, args):
203203
self.map_atomtype = map_atomtype
204204
# build covalent map
205205
covalent_map = build_covalent_map(data, 6)
206-
207206
# here box is only used to setup ewald parameters, no need to be differentiable
208207
a, b, c = system.getDefaultPeriodicBoxVectors()
209208
box = jnp.array([a._value, b._value, c._value]) * 10

0 commit comments

Comments
 (0)