Skip to content

Commit

Permalink
remove older equations
Browse files Browse the repository at this point in the history
  • Loading branch information
m-julian committed Oct 17, 2024
1 parent e66f9eb commit c12b475
Showing 1 changed file with 2 additions and 205 deletions.
207 changes: 2 additions & 205 deletions ichor_core/ichor/core/multipoles/quadrupole.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ def get_gaussian_and_aimall_molecular_quadrupole(

# make sure we are in Bohr
atoms = gaussian_output.atoms
atoms = atoms.to_bohr()

if atom_names:
# ensure that the passed in atom names are a subset of the all of the atom names
Expand Down Expand Up @@ -330,212 +329,10 @@ def get_gaussian_and_aimall_molecular_quadrupole(
return traceless_gaussian_quadrupole, aimall_recovered_molecular_quadrupole


# equations below come from
# For spherical equations for quadrupole look at
# The newer equations above are generalized, so use these instead
# https://doi.org/10.1021/jp067922u
# The effects of hydrogen-bonding environment on the polarization and electronic properties of water molecules
# https://doi.org/10.1080/15533170701854189
# The Asymptotic Behavior of the Dipole and Quadrupole Moment of a Single Water Molecule from Gas Phase to
# Large Clusters: A QCT Analysis

# note that the units for distances are in Bohr
# Gaussian calculates multipole moments in Debye, while atomic units are using in AIMAll
# Units for quadrupole are Coulomb Bohr**2
# TODO: Gaussian defines the x,y,z axes a different way, therefore the values are switched around for dipole moment.
# TODO: Figure out how axes are swapped and what changes that has on quadrupole, octupole, hexadecapole values

# You should be able to recover the Gaussain molecular values by
# doing the necessary conversions of AIMAll values and summing across all atoms
# Note that the axes that Gaussian uses are different though.
# Importantly, there is NO NEED to rotate multipole moments in ALF frame if directly comparing AIMAll and Gaussian
# however, if making predictions with FFLUX, you WILL need to
# convert the local multipole moments to the global frame before summing up the components
# across atoms/molecules. Otherwise you will get the wrong answer.

# note that AIMAll multipole moments are in Spherical coordinates but Gaussian ones are in Cartesian
# for dipole moment, the number of values for spherical/Cartesian is the same (3)
# for higher multipole moments, there are less spherical ones than Cartesian


def q20_prime(
q20: float,
q10: float,
q11c: float,
q11s: float,
q00: float,
r_x: float,
r_y: float,
r_z: float,
):
"""Calculates math:Q'_{20}:, representing the total ATOMIC contribution for the molecular
quadrupole math:Q_{20}:
.. note::
This is the contribution of one atom, which needs to be summed over to get the molecular value.
Also, make sure the units for multipole moments / distances are correct.
:param q20: AIMAll q20 value
:param q10: AIMAll q10 value
:param q11c: AIMAll q11c value
:param q11s: AIMAll q11s value
:param q00: The charge of the atom (q00). Note that this AIMAll gives q00 without adding the nuclear charge.
When obtaining q00 through ichor, the nuclear charge is always added to the q00 value.
:param r_x: Distance of atom from the origin in the x-direction. In Bohr.
:param r_y: Distance of atom from the origin in the y-direction. In Bohr.
:param r_z: Distance of atom from the origin in the z-direction. In Bohr.
"""

return (
q20
+ (2 * r_z * q10)
- (r_x * q11c)
- (r_y * q11s)
+ (0.5 * ((3 * r_z**2) - (r_x**2 + r_y**2 + r_z**2)) * q00)
)


def q21c_prime(
q21c: float, q11c: float, q10: float, q00: float, r_x: float, r_z: float
):
"""Calculates math:Q'_{21c}:, representing the total ATOMIC contribution for the molecular
quadrupole math:Q_{21c}:
.. note::
This is the contribution of one atom, which needs to be summed over to get the molecular value.
Also, make sure the units for multipole moments / distances are correct.
:param q21c: AIMAll q21c value
:param q11c: AIMAll q11c value
:param q10: AIMAll q10 value
:param q00: The charge of the atom (q00). Note that this AIMAll gives q00 without adding the nuclear charge.
When obtaining q00 through ichor, the nuclear charge is always added to the q00 value.
:param r_x: Distance of atom from the origin in the x-direction. In Bohr.
:param r_z: Distance of atom from the origin in the z-direction. In Bohr.
"""

return (
q21c
+ (constants.rt3 * r_z * q11c)
+ (constants.rt3 * r_x * q10)
+ (constants.rt3 * r_x * r_z * q00)
)


def q21s_prime(
q21s: float, q11s: float, q10: float, q00: float, r_y: float, r_z: float
):
"""Calculates math:Q'_{21s}:, representing the total ATOMIC contribution for the molecular
quadrupole math:Q_{21s}:
.. note::
This is the contribution of one atom, which needs to be summed over to get the molecular value.
Also, make sure the units for multipole moments / distances are correct.
:param q21s: AIMAll q21s value
:param q11s: AIMAll q11s value
:param q10: AIMAll q10 value
:param q00: The charge of the atom (q00). Note that this AIMAll gives q00 without adding the nuclear charge.
When obtaining q00 through ichor, the nuclear charge is always added to the q00 value.
:param r_y: Distance of atom from the origin in the y-direction. In Bohr.
:param r_z: Distance of atom from the origin in the z-direction. In Bohr.
"""

return (
q21s
+ (constants.rt3 * r_z * q11s)
+ (constants.rt3 * r_y * q10)
+ (constants.rt3 * r_y * r_z * q00)
)


def q22c_prime(
q22c: float, q11c: float, q11s: float, q00: float, r_x: float, r_y: float
):
"""Calculates math:Q'_{22c}:, representing the total ATOMIC contribution for the molecular
quadrupole math:Q_{22c}:
.. note::
This is the contribution of one atom, which needs to be summed over to get the molecular value.
Also, make sure the units for multipole moments / distances are correct.
:param q22c: AIMAll q22c value
:param q11c: AIMAll q11c value
:param q11s: AIMAll q11s value
:param q00: The charge of the atom (q00). Note that this AIMAll gives q00 without adding the nuclear charge.
When obtaining q00 through ichor, the nuclear charge is always added to the q00 value.
:param r_x: Distance of atom from the origin in the x-direction. In Bohr.
:param r_y: Distance of atom from the origin in the y-direction. In Bohr.
"""

return (
q22c
+ (constants.rt3 * r_x * q11c)
- (constants.rt3 * r_y * q11s)
+ ((constants.rt3 / 2.0) * (r_x**2 - r_y**2) * q00)
)


def q22s_prime(
q22s: float, q11c: float, q11s: float, q00: float, r_x: float, r_y: float
):
"""Calculates math:Q'_{22s}:, representing the total ATOMIC contribution for the molecular
quadrupole math:Q_{22s}:
.. note::
This is the contribution of one atom, which needs to be summed over to get the molecular value.
Also, make sure the units for multipole moments / distances are correct.
:param q22s: AIMAll q22s value
:param q11c: AIMAll q11c value
:param q11s: AIMAll q11s value
:param q00: The charge of the atom (q00). Note that this AIMAll gives q00 without adding the nuclear charge.
When obtaining q00 through ichor, the nuclear charge is always added to the q00 value.
:param r_x: Distance of atom from the origin in the x-direction. In Bohr.
:param r_y: Distance of atom from the origin in the y-direction. In Bohr.
"""

return (
q22s
+ (constants.rt3 * r_y * q11c)
+ (constants.rt3 * r_x * q11s)
+ (constants.rt3 * r_x * r_y * q00)
)


def atomic_contribution_to_molecular_quadrupole(
q00, q10, q11c, q11s, q20, q21c, q21s, q22c, q22s, atomic_coordinates
):
"""Calculates the atomic contribution to the molecular quadrupole moment.
Note that the moments are in spherical coordinates.
Atomic coordinates are assumed to be Bohr.
.. note::
This is contribution of ONE atom.
:param q00: The charge of the atom (q00). Note that this AIMAll gives q00 without adding the nuclear charge.
When obtaining q00 through ichor, the nuclear charge is always added to the q00 value.
:param q10: AIMAll q10 value
:param q11c: AIMAll q11c value
:param q11s: AIMAll q11s value
:param q20: AIMAll q20 value
:param q21c: AIMAll q21c value
:param q21s: AIMAll q21s value
:param q22c: AIMAll q22c value
:param q22s: AIMAll q22s value
:param atomic_coordinates: 1D numpy array containing the x,y,z values (in bohr)
"""

q20_pr = q20_prime(q20, q10, q11c, q11s, q00, *atomic_coordinates)
q21c_pr = q21c_prime(
q21c, q11c, q10, q00, atomic_coordinates[0], atomic_coordinates[2]
)
q21s_pr = q21s_prime(
q21s, q11s, q10, q00, atomic_coordinates[1], atomic_coordinates[2]
)
q22c_pr = q22c_prime(
q22c, q11c, q11s, q00, atomic_coordinates[0], atomic_coordinates[1]
)
q22s_pr = q22s_prime(
q22s, q11c, q11s, q00, atomic_coordinates[0], atomic_coordinates[1]
)

return np.array([q20_pr, q21c_pr, q21s_pr, q22c_pr, q22s_pr])

0 comments on commit c12b475

Please sign in to comment.