Skip to content

Commit

Permalink
update constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiahsinChu committed Jun 25, 2024
1 parent cbd3890 commit b5915a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
7 changes: 4 additions & 3 deletions dmff/admp/qeq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import jax.numpy as jnp
from ..common.constants import DIELECTRIC
from scipy import constants
from ..common.constants import DIELECTRIC, ENERGY_COEFF
from jax import grad, vmap
from ..classical.inter import CoulNoCutoffForce, CoulombPMEForce
from typing import Tuple, List
Expand Down Expand Up @@ -126,13 +127,13 @@ def E_site(chi, J, q):

@jit_condition()
def E_site2(chi, J, q):
ene = (chi * q + 0.5 * J * q**2) * 96.4869
ene = (chi * q + 0.5 * J * q**2) * ENERGY_COEFF
return jnp.sum(ene)


@jit_condition()
def E_site3(chi, J, q):
ene = chi * q * 4.184 + J * q**2 * DIELECTRIC * 2 * jnp.pi
ene = chi * q * constants.calorie + J * q**2 * DIELECTRIC * 2 * jnp.pi
return jnp.sum(ene)


Expand Down
14 changes: 12 additions & 2 deletions dmff/common/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import numpy as np
from scipy import constants

DIELECTRIC = 1389.35455846
SQRT_PI = np.sqrt(np.pi)

SQRT_PI = np.sqrt(np.pi)

J2EV = constants.physical_constants["joule-electron volt relationship"][0]
# from kJ/mol to eV/particle
ENERGY_COEFF = J2EV * constants.kilo / constants.Avogadro

# vacuum electric permittivity in eV^-1 * angstrom^-1
EPSILON = constants.epsilon_0 / constants.elementary_charge * constants.angstrom
# DIELECTRIC = 1389.35455846
DIELECTRIC = 1 / (4 * np.pi * EPSILON) / ENERGY_COEFF

0 comments on commit b5915a5

Please sign in to comment.