Skip to content

Commit

Permalink
use primed function for dipole
Browse files Browse the repository at this point in the history
  • Loading branch information
m-julian committed Oct 17, 2024
1 parent c12b475 commit 89c9371
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 69 deletions.
3 changes: 2 additions & 1 deletion ichor_core/ichor/core/multipoles/dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np

from ichor.core.common.constants import coulombbohr_to_debye
from ichor.core.multipoles.primed_functions import mu_prime

# links to papers relating to dipole moment origin change
# https://doi.org/10.1021/jp067922u
Expand Down Expand Up @@ -105,7 +106,7 @@ def dipole_one_term_general_expression(
:returns: The x,y or z component of the dipole moment as seen from a new origin.
"""

mu_alpha_disp = dipole[alpha] + displacement_vector[alpha] * monopole
mu_alpha_disp = dipole[alpha] + mu_prime(alpha, displacement_vector) * monopole

return mu_alpha_disp

Expand Down
74 changes: 6 additions & 68 deletions ichor_core/ichor/core/multipoles/hexadecapole.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
import numpy as np
from ichor.core.common import constants
from ichor.core.common.arith import kronecker_delta
from ichor.core.multipoles.primed_functions import (
mu_prime,
omega_prime,
phi_prime,
theta_prime,
)


def rotate_hexadecapole(
Expand Down Expand Up @@ -275,74 +281,6 @@ def hexadecapole_nontraceless_to_traceless(hexadecapole_tensor: np.ndarray):
return hexadecapole_tensor - tensor_to_subtract


def mu_prime(alpha, displacement_vector):

return displacement_vector[alpha]


def theta_prime(alpha, beta, displacement_vector):

norm = np.linalg.norm(displacement_vector)
displacement_alpha = displacement_vector[alpha]
displacement_beta = displacement_vector[beta]

return 0.5 * (
3 * displacement_alpha * displacement_beta
- norm**2 * kronecker_delta(alpha, beta)
)


def omega_prime(alpha, beta, gamma, displacement_vector):

norm = np.linalg.norm(displacement_vector)
displacement_alpha = displacement_vector[alpha]
displacement_beta = displacement_vector[beta]
displacement_gamma = displacement_vector[gamma]

return 0.5 * (
5 * displacement_alpha * displacement_beta * displacement_gamma
- norm**2
* (
displacement_alpha * kronecker_delta(beta, gamma)
+ displacement_beta * kronecker_delta(alpha, gamma)
+ displacement_gamma * kronecker_delta(alpha, beta)
)
)


def phi_prime(alpha, beta, gamma, chi, displacement_vector):

norm = np.linalg.norm(displacement_vector)
displacement_alpha = displacement_vector[alpha]
displacement_beta = displacement_vector[beta]
displacement_gamma = displacement_vector[gamma]
displacement_chi = displacement_vector[chi]

return 0.125 * (
35
* displacement_alpha
* displacement_beta
* displacement_gamma
* displacement_chi
- 5
* norm**2
* (
displacement_gamma * displacement_chi * kronecker_delta(alpha, beta)
+ displacement_beta * displacement_gamma * kronecker_delta(alpha, chi)
+ displacement_beta * displacement_chi * kronecker_delta(alpha, gamma)
+ displacement_alpha * displacement_chi * kronecker_delta(beta, gamma)
+ displacement_alpha * displacement_beta * kronecker_delta(gamma, chi)
+ displacement_alpha * displacement_gamma * kronecker_delta(beta, chi)
)
+ norm**4
* (
kronecker_delta(alpha, beta) * kronecker_delta(gamma, chi)
+ kronecker_delta(alpha, gamma) * kronecker_delta(beta, chi)
+ kronecker_delta(alpha, chi) * kronecker_delta(beta, gamma)
)
)


def f3(
alpha: int,
beta: int,
Expand Down
73 changes: 73 additions & 0 deletions ichor_core/ichor/core/multipoles/primed_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import numpy as np
from ichor.core.common.arith import kronecker_delta

# impmenentations of the prime functions which are used in the conversions of
# all the multipole moments


def mu_prime(alpha, displacement_vector):

return displacement_vector[alpha]


def theta_prime(alpha, beta, displacement_vector):

norm = np.linalg.norm(displacement_vector)
displacement_alpha = displacement_vector[alpha]
displacement_beta = displacement_vector[beta]

return 0.5 * (
3 * displacement_alpha * displacement_beta
- norm**2 * kronecker_delta(alpha, beta)
)


def omega_prime(alpha, beta, gamma, displacement_vector):

norm = np.linalg.norm(displacement_vector)
displacement_alpha = displacement_vector[alpha]
displacement_beta = displacement_vector[beta]
displacement_gamma = displacement_vector[gamma]

return 0.5 * (
5 * displacement_alpha * displacement_beta * displacement_gamma
- norm**2
* (
displacement_alpha * kronecker_delta(beta, gamma)
+ displacement_beta * kronecker_delta(alpha, gamma)
+ displacement_gamma * kronecker_delta(alpha, beta)
)
)


def phi_prime(alpha, beta, gamma, chi, displacement_vector):

norm = np.linalg.norm(displacement_vector)
displacement_alpha = displacement_vector[alpha]
displacement_beta = displacement_vector[beta]
displacement_gamma = displacement_vector[gamma]
displacement_chi = displacement_vector[chi]

return 0.125 * (
35
* displacement_alpha
* displacement_beta
* displacement_gamma
* displacement_chi
- 5
* norm**2
* (
displacement_gamma * displacement_chi * kronecker_delta(alpha, beta)
+ displacement_beta * displacement_gamma * kronecker_delta(alpha, chi)
+ displacement_beta * displacement_chi * kronecker_delta(alpha, gamma)
+ displacement_alpha * displacement_chi * kronecker_delta(beta, gamma)
+ displacement_alpha * displacement_beta * kronecker_delta(gamma, chi)
+ displacement_alpha * displacement_gamma * kronecker_delta(beta, chi)
)
+ norm**4
* (
kronecker_delta(alpha, beta) * kronecker_delta(gamma, chi)
+ kronecker_delta(alpha, gamma) * kronecker_delta(beta, chi)
+ kronecker_delta(alpha, chi) * kronecker_delta(beta, gamma)
)
)

0 comments on commit 89c9371

Please sign in to comment.