Class MultipoleTensor

java.lang.Object
ffx.numerics.multipole.MultipoleTensor
Direct Known Subclasses:
CoulombTensorGlobal, CoulombTensorQI

public abstract class MultipoleTensor extends Object
The abstract MultipoleTensor is extended by classes that compute derivatives of 1/|r| via recursion to arbitrary order using Cartesian multipoles in either a global frame or a quasi-internal frame.
This class serves as the abstract parent to both and defines all shared logic. Non-abstract methods are declared final to disallow unnecessary overrides.
Since:
1.0
Author:
Michael J. Schnieders
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Global and Quasi-Internal (QI) coordinate systems are supported.
    static enum 
    Operators that are supported.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The coordinate system in use (global or QI).
    protected final double[]
    These are the "source" terms for the recursion for the Coulomb operator (1/R).
    protected final int
    Order plus one.
    protected final int
    im = (Order plus one)^2.
    protected final int
    in = (Order plus one)^3.
    protected final int
    Order plus 1.
    The OPERATOR in use.
    protected final int
    Order of the tensor recursion (5th is needed for AMOEBA forces).
    protected double
    Separation distance.
    protected double
    Separation distance squared.
    protected final int
    Size = (order + 1) * (order + 2) * (order + 3) / 6;
    protected final int
     
    protected final double[]
    Store the auxiliary tensor memory to avoid memory consumption.
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected final double[]
    Store the work array to avoid memory consumption.
    protected double
    Xk - Xi.
    protected double
    Yk - Yi.
    protected double
    Zk - Zi.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for MultipoleTensor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    Compute the field components due to charge I at site K.
    protected abstract void
    Compute the field components due to multipole K at site I.
    protected void
    codePotentialMultipoleI(PolarizableMultipole mI, double[] T, int l, int m, int n, StringBuilder sb)
    Collect the potential its partial derivatives at K due to multipole moments at the origin.
    protected void
    codePotentialMultipoleK(PolarizableMultipole mK, double[] T, int l, int m, int n, StringBuilder sb)
    Collect the potential its partial derivatives at the origin due to multipole moments at site K.
    protected abstract String
    codeTensorRecursion(double[] r, double[] tensor)
    This function is a driver to collect elements of the Cartesian multipole tensor.
    protected double
    contractMultipoleI(PolarizableMultipole mI, double[] T, int l, int m, int n)
    Contract multipole moments with their respective electrostatic potential derivatives.
    protected abstract void
    dipoleIPotentialAtK(double uxi, double uyi, double uzi, int order)
    Compute the induced dipole field components due to site I at site K.
    protected abstract void
    dipoleKPotentialAtI(double uxk, double uyk, double uzk, int order)
    Compute the induced dipole field components due to site K at site I.
    protected final void
    dipoleTorque(PolarizableMultipole m, double[] torque)
    Compute the torque on a permanent dipole.
    void
    Generate the tensor using hard-coded methods or via recursion.
    final void
    generateTensor(double[] r)
    For the MultipoleTensorTest class and testing.
    double
    getd2EdZ2.
    double
    getdEdZ.
    protected final void
    getTensor(double[] T)
    Load the tensor components.
    void
    log(double[] tensor)
    log.
    protected final double
    Contract a multipole with the potential and its derivatives.
    double
    Permanent multipole energy.
    double
    multipoleEnergyAndGradient(PolarizableMultipole mI, PolarizableMultipole mK, double[] Gi, double[] Gk, double[] Ti, double[] Tk)
    Permanent multipole energy and gradient.
    protected final void
    Compute the permanent multipole gradient.
    protected abstract void
    Compute the field components due to multipole I at site K.
    protected abstract void
    Compute the field components due to multipole K at site I.
    protected final void
    Compute the torque on a permanent multipole.
    protected abstract void
    noStorageRecursion(double[] tensor)
    This method is a driver to collect elements of the Cartesian multipole tensor given the recursion relationships implemented by the method "Tlmnj", which can be called directly to get a single tensor element.
    protected abstract void
    noStorageRecursion(double[] r, double[] tensor)
    This method is a driver to collect elements of the Cartesian multipole tensor given the recursion relationships implemented by the method "Tlmnj", which can be called directly to get a single tensor element.
    protected abstract void
    Hard coded computation of the Cartesian multipole tensors up to 1st order.
    protected abstract void
    Hard coded computation of the Cartesian multipole tensors up to 2nd order.
    protected abstract void
    Hard coded computation of the Cartesian multipole tensors up to 3rd order.
    protected abstract void
    Hard coded computation of the Cartesian multipole tensors up to 4th order.
    protected abstract void
    Hard coded computation of the Cartesian multipole tensors up to 5th order, which is needed for quadrupole-quadrupole forces.
    protected abstract void
    Hard coded computation of the Cartesian multipole tensors up to 6th order, which is needed for quadrupole-quadrupole forces and orthogonal space sampling.
    protected final double
    Contract an induced dipole with the potential and its derivatives.
    double
    Polarization Energy.
    double
    polarizationEnergyAndGradient(PolarizableMultipole mI, PolarizableMultipole mK, double inductionMask, double energyMask, double mutualMask, double[] Gi, double[] Ti, double[] Tk)
    Polarization Energy and Gradient.
    protected final double
    Contract an induced dipole with the potential and its derivatives.
    protected final void
    potentialMultipoleI(PolarizableMultipole mI, double[] T, int l, int m, int n)
    Collect the field at R due to Q multipole moments at the origin (site I).
    protected abstract void
    Compute the field components due to quadrupole I at site K.
    protected abstract void
    Compute the field components due to multipole K at site I.
    protected final void
    Compute the torque on a permanent quadrupole.
    protected abstract void
    recursion(double[] tensor)
    This method is a driver to collect elements of the Cartesian multipole tensor using recursion relationships and storing intermediate values.
    protected abstract void
    recursion(double[] r, double[] tensor)
    This method is a driver to collect elements of the Cartesian multipole tensor using recursion relationships and storing intermediate values.
    protected static String
    rlmn(int l, int m, int n)
    Convenience method for writing out tensor indices.
    final void
    setR(double[] r)
    Set the separation vector.
    abstract void
    setR(double dx, double dy, double dz)
    Set the separation vector.
    protected final void
    setTensor(double[] T)
    Set the tensor components.
    protected abstract void
    source(double[] T000)
    Generate source terms for the Challacombe et al.
    static int
    tensorCount(int order)
    Returns the number of tensors for derivatives to the given order.
    protected static String
    term(int l, int m, int n)
    Convenience method for writing out intermediate terms in the recursion.
    protected static String
    term(int l, int m, int n, int j)
    Convenience method for writing out intermediate terms in the recursion.
    protected final int
    ti(int dx, int dy, int dz)
    The index is based on the idea of filling tetrahedron.
    protected static int
    ti(int dx, int dy, int dz, int order)
    The index is based on the idea of filling tetrahedron.
    protected abstract double
    Tlmnj(int l, int m, int n, int j, double[] r, double[] T000)
    This routine implements the recurrence relations for computation of any Cartesian multipole tensor in ~O(L^8) time, where L is the total order l + m + n, given the auxiliary elements T0000.
    double
    totalEnergy(PolarizableMultipole mI, PolarizableMultipole mK, double scaleEnergy, double[] energyComponents)
    Permanent Multipole + Polarization Energy.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • order

      protected final int order
      Order of the tensor recursion (5th is needed for AMOEBA forces).
    • o1

      protected final int o1
      Order plus 1.
    • il

      protected final int il
      Order plus one.
    • im

      protected final int im
      im = (Order plus one)^2.
    • in

      protected final int in
      in = (Order plus one)^3.
    • size

      protected final int size
      Size = (order + 1) * (order + 2) * (order + 3) / 6;
    • operator

      protected MultipoleTensor.OPERATOR operator
      The OPERATOR in use.
    • coulombSource

      protected final double[] coulombSource
      These are the "source" terms for the recursion for the Coulomb operator (1/R).
    • work

      protected final double[] work
      Store the work array to avoid memory consumption. Note that rather than use an array for intermediate values, a 4D matrix was tried. It was approximately 50% slower than the linear work array.
    • T000

      protected final double[] T000
      Store the auxiliary tensor memory to avoid memory consumption.
    • coordinates

      protected final MultipoleTensor.COORDINATES coordinates
      The coordinate system in use (global or QI).
    • R

      protected double R
      Separation distance.
    • r2

      protected double r2
      Separation distance squared.
    • x

      protected double x
      Xk - Xi.
    • y

      protected double y
      Yk - Yi.
    • z

      protected double z
      Zk - Zi.
    • t000

      protected final int t000
    • t100

      protected final int t100
    • t010

      protected final int t010
    • t001

      protected final int t001
    • t200

      protected final int t200
    • t020

      protected final int t020
    • t002

      protected final int t002
    • t110

      protected final int t110
    • t101

      protected final int t101
    • t011

      protected final int t011
    • t300

      protected final int t300
    • t030

      protected final int t030
    • t003

      protected final int t003
    • t210

      protected final int t210
    • t201

      protected final int t201
    • t120

      protected final int t120
    • t021

      protected final int t021
    • t102

      protected final int t102
    • t012

      protected final int t012
    • t111

      protected final int t111
    • t400

      protected final int t400
    • t040

      protected final int t040
    • t004

      protected final int t004
    • t310

      protected final int t310
    • t301

      protected final int t301
    • t130

      protected final int t130
    • t031

      protected final int t031
    • t103

      protected final int t103
    • t013

      protected final int t013
    • t220

      protected final int t220
    • t202

      protected final int t202
    • t022

      protected final int t022
    • t211

      protected final int t211
    • t121

      protected final int t121
    • t112

      protected final int t112
    • t500

      protected final int t500
    • t050

      protected final int t050
    • t005

      protected final int t005
    • t410

      protected final int t410
    • t401

      protected final int t401
    • t140

      protected final int t140
    • t041

      protected final int t041
    • t104

      protected final int t104
    • t014

      protected final int t014
    • t320

      protected final int t320
    • t302

      protected final int t302
    • t230

      protected final int t230
    • t032

      protected final int t032
    • t203

      protected final int t203
    • t023

      protected final int t023
    • t311

      protected final int t311
    • t131

      protected final int t131
    • t113

      protected final int t113
    • t221

      protected final int t221
    • t212

      protected final int t212
    • t122

      protected final int t122
    • t600

      protected final int t600
    • t060

      protected final int t060
    • t006

      protected final int t006
    • t510

      protected final int t510
    • t501

      protected final int t501
    • t150

      protected final int t150
    • t051

      protected final int t051
    • t105

      protected final int t105
    • t015

      protected final int t015
    • t420

      protected final int t420
    • t402

      protected final int t402
    • t240

      protected final int t240
    • t042

      protected final int t042
    • t204

      protected final int t204
    • t024

      protected final int t024
    • t411

      protected final int t411
    • t141

      protected final int t141
    • t114

      protected final int t114
    • t330

      protected final int t330
    • t303

      protected final int t303
    • t033

      protected final int t033
    • t321

      protected final int t321
    • t231

      protected final int t231
    • t213

      protected final int t213
    • t312

      protected final int t312
    • t132

      protected final int t132
    • t123

      protected final int t123
    • t222

      protected final int t222
  • Constructor Details

  • Method Details

    • getd2EdZ2

      public double getd2EdZ2()
      getd2EdZ2.
      Returns:
      a double.
    • getdEdZ

      public double getdEdZ()
      getdEdZ.
      Returns:
      a double.
    • log

      public void log(double[] tensor)
      log.
      Parameters:
      tensor - an array of
      invalid reference
      double
      objects.
    • multipoleEnergy

      public double multipoleEnergy(PolarizableMultipole mI, PolarizableMultipole mK)
      Permanent multipole energy.
      Parameters:
      mI - PolarizableMultipole at site I.
      mK - PolarizableMultipole at site K.
      Returns:
      a double.
    • multipoleEnergyAndGradient

      public double multipoleEnergyAndGradient(PolarizableMultipole mI, PolarizableMultipole mK, double[] Gi, double[] Gk, double[] Ti, double[] Tk)
      Permanent multipole energy and gradient.
      Parameters:
      mI - PolarizableMultipole at site I.
      mK - PolarizableMultipole at site K.
      Gi - Coordinate gradient at site I.
      Gk - Coordinate gradient at site K.
      Ti - Torque at site I.
      Tk - Torque at site K.
      Returns:
      the permanent multipole energy.
    • polarizationEnergy

      public double polarizationEnergy(PolarizableMultipole mI, PolarizableMultipole mK, double scaleEnergy)
      Polarization Energy.
      Parameters:
      mI - PolarizableMultipole at site I.
      mK - PolarizableMultipole at site K.
      scaleEnergy - a double.
      Returns:
      a double.
    • polarizationEnergyAndGradient

      public double polarizationEnergyAndGradient(PolarizableMultipole mI, PolarizableMultipole mK, double inductionMask, double energyMask, double mutualMask, double[] Gi, double[] Ti, double[] Tk)
      Polarization Energy and Gradient.
      Parameters:
      mI - PolarizableMultipole at site I.
      mK - PolarizableMultipole at site K.
      inductionMask - a double.
      energyMask - a double.
      mutualMask - a double.
      Gi - an array of
      invalid reference
      double
      objects.
      Ti - an array of
      invalid reference
      double
      objects.
      Tk - an array of
      invalid reference
      double
      objects.
      Returns:
      a double.
    • totalEnergy

      public double totalEnergy(PolarizableMultipole mI, PolarizableMultipole mK, double scaleEnergy, double[] energyComponents)
      Permanent Multipole + Polarization Energy.
      Parameters:
      mI - PolarizableMultipole at site I.
      mK - PolarizableMultipole at site K.
      scaleEnergy - a double.
      Returns:
      a double.
    • setR

      public final void setR(double[] r)
      Set the separation vector.
      Parameters:
      r - The separation vector.
    • setR

      public abstract void setR(double dx, double dy, double dz)
      Set the separation vector.
      Parameters:
      dx - Separation along the X-axis.
      dy - Separation along the Y-axis.
      dz - Separation along the Z-axis.
    • generateTensor

      public final void generateTensor(double[] r)
      For the MultipoleTensorTest class and testing.
      Parameters:
      r - an array of
      invalid reference
      double
      objects.
    • generateTensor

      public void generateTensor()
      Generate the tensor using hard-coded methods or via recursion.
    • source

      protected abstract void source(double[] T000)
      Generate source terms for the Challacombe et al. recursion.
      Parameters:
      T000 - Location to store the source terms.
    • ti

      protected final int ti(int dx, int dy, int dz)
      The index is based on the idea of filling tetrahedron.

      1/r has an index of 0.
      derivatives of x are first; indices from 1..o for d/dx..(d/dx)^o
      derivatives of x and y are second; base triangle of size (o+1)(o+2)/2
      derivatives of x, y and z are last; total size (o+1)*(o+2)*(o+3)/6

      This function is useful to set up masking constants:
      static int Tlmn = ti(l,m,n,order)
      For example the (d/dy)^2 (1/R) storage location:
      static int T020 = ti(0,2,0,order)

      Parameters:
      dx - int The number of d/dx operations.
      dy - int The number of d/dy operations.
      dz - int The number of d/dz operations.
      Returns:
      int in the range (0..binomial(order + 3, 3) - 1)
    • contractMultipoleI

      protected double contractMultipoleI(PolarizableMultipole mI, double[] T, int l, int m, int n)
      Contract multipole moments with their respective electrostatic potential derivatives.
      Parameters:
      mI - PolarizableMultipole at site I.
      T - array of electrostatic potential and partial derivatives
      l - apply (d/dx)^l to the potential
      m - apply (d/dy)^l to the potential
      n - apply (d/dz)^l to the potential
      Returns:
      the contracted interaction.
    • potentialMultipoleI

      protected final void potentialMultipoleI(PolarizableMultipole mI, double[] T, int l, int m, int n)
      Collect the field at R due to Q multipole moments at the origin (site I).
      Parameters:
      mI - PolarizableMultipole at site I.
      T - Electrostatic potential and partial derivatives
      l - apply (d/dx)^l to the potential
      m - apply (d/dy)^l to the potential
      n - apply (d/dz)^l to the potential
    • codeTensorRecursion

      protected abstract String codeTensorRecursion(double[] r, double[] tensor)

      This function is a driver to collect elements of the Cartesian multipole tensor. Collecting all tensors scales slightly better than O(order^4).

      For a multipole expansion truncated at quadrupole order, for example, up to order 5 is needed for energy gradients. The number of terms this requires is binomial(5 + 3, 3) or 8! / (5! * 3!), which is 56.

      The packing of the tensor elements for order = 1
      tensor[0] = 1/|r|
      tensor[1] = -x/|r|^3
      tensor[2] = -y/|r|^3
      tensor[3] = -z/|r|^3

      Since:
      1.0
    • codePotentialMultipoleI

      protected void codePotentialMultipoleI(PolarizableMultipole mI, double[] T, int l, int m, int n, StringBuilder sb)
      Collect the potential its partial derivatives at K due to multipole moments at the origin.
      Parameters:
      mI - PolarizableMultipole at site I.
      T - Electrostatic potential and partial derivatives.
      l - apply (d/dx)^l to the potential.
      m - apply (d/dy)^l to the potential.
      n - apply (d/dz)^l to the potential.
      sb - Append the code to the StringBuilder.
    • codePotentialMultipoleK

      protected void codePotentialMultipoleK(PolarizableMultipole mK, double[] T, int l, int m, int n, StringBuilder sb)
      Collect the potential its partial derivatives at the origin due to multipole moments at site K.
      Parameters:
      mK - PolarizableMultipole at site I.
      T - Electrostatic potential and partial derivatives.
      l - apply (d/dx)^l to the potential.
      m - apply (d/dy)^l to the potential.
      n - apply (d/dz)^l to the potential.
      sb - Append the code to the StringBuilder.
    • multipoleEnergy

      protected final double multipoleEnergy(PolarizableMultipole m)
      Contract a multipole with the potential and its derivatives.
      Parameters:
      m - PolarizableMultipole at the site of the potential.
      Returns:
      The permanent multipole energy.
    • multipoleGradient

      protected final void multipoleGradient(PolarizableMultipole m, double[] g)
      Compute the permanent multipole gradient.
      Parameters:
      m - PolarizableMultipole at the site of the potential.
      g - The atomic gradient.
    • multipoleTorque

      protected final void multipoleTorque(PolarizableMultipole m, double[] torque)
      Compute the torque on a permanent multipole.
      Parameters:
      m - PolarizableMultipole at the site of the potential.
      torque - an array of
      invalid reference
      double
      objects.
    • dipoleTorque

      protected final void dipoleTorque(PolarizableMultipole m, double[] torque)
      Compute the torque on a permanent dipole.
      Parameters:
      m - PolarizableMultipole at the site of the potential.
      torque - an array of
      invalid reference
      double
      objects.
    • quadrupoleTorque

      protected final void quadrupoleTorque(PolarizableMultipole m, double[] torque)
      Compute the torque on a permanent quadrupole.
      Parameters:
      m - PolarizableMultipole at the site of the potential.
      torque - an array of
      invalid reference
      double
      objects.
    • polarizationEnergy

      protected final double polarizationEnergy(PolarizableMultipole m)
      Contract an induced dipole with the potential and its derivatives.
      Parameters:
      m - PolarizableMultipole at the site of the potential.
      Returns:
      The polarization energy.
    • polarizationEnergyS

      protected final double polarizationEnergyS(PolarizableMultipole m)
      Contract an induced dipole with the potential and its derivatives.
      Parameters:
      m - PolarizableMultipole at the site of the potential.
      Returns:
      The polarization energy.
    • getTensor

      protected final void getTensor(double[] T)
      Load the tensor components.
      Parameters:
      T - an array of
      invalid reference
      double
      objects.
    • setTensor

      protected final void setTensor(double[] T)
      Set the tensor components.
      Parameters:
      T - an array of
      invalid reference
      double
      objects.
    • noStorageRecursion

      protected abstract void noStorageRecursion(double[] tensor)
      This method is a driver to collect elements of the Cartesian multipole tensor given the recursion relationships implemented by the method "Tlmnj", which can be called directly to get a single tensor element. It does not store intermediate values of the recursion, causing it to scale O(order^8). For order = 5, this approach is a factor of 10 slower than recursion.
      Parameters:
      tensor - double[] length must be at least binomial(order + 3, 3).
    • noStorageRecursion

      protected abstract void noStorageRecursion(double[] r, double[] tensor)
      This method is a driver to collect elements of the Cartesian multipole tensor given the recursion relationships implemented by the method "Tlmnj", which can be called directly to get a single tensor element. It does not store intermediate values of the recursion, causing it to scale O(order^8). For order = 5, this approach is a factor of 10 slower than recursion.
      Parameters:
      r - double[] vector between two sites.
      tensor - double[] length must be at least binomial(order + 3, 3).
    • Tlmnj

      protected abstract double Tlmnj(int l, int m, int n, int j, double[] r, double[] T000)
      This routine implements the recurrence relations for computation of any Cartesian multipole tensor in ~O(L^8) time, where L is the total order l + m + n, given the auxiliary elements T0000.
      It implements the recursion relationships in brute force fashion, without saving intermediate values. This is useful for finding a single tensor, rather than all binomial(L + 3, 3).
      The specific recursion equations (41-43) and set of auxiliary tensor elements from equation (40) can be found in Challacombe et al.
      Parameters:
      l - int The number of (d/dx) operations.
      m - int The number of (d/dy) operations.
      n - int The number of (d/dz) operations.
      j - int j = 0 is the Tlmn tensor, j .GT. 0 is an intermediate.
      r - double[] The {x,y,z} coordinates.
      T000 - double[] Initial auxiliary tensor elements from Eq. (40).
      Returns:
      double The requested Tensor element (intermediate if j .GT. 0).
      Since:
      1.0
    • recursion

      protected abstract void recursion(double[] tensor)
      This method is a driver to collect elements of the Cartesian multipole tensor using recursion relationships and storing intermediate values. It scales approximately O(order^4).
      Parameters:
      tensor - double[] length must be at least binomial(order + 3, 3).
    • recursion

      protected abstract void recursion(double[] r, double[] tensor)
      This method is a driver to collect elements of the Cartesian multipole tensor using recursion relationships and storing intermediate values. It scales approximately O(order^4).
      Parameters:
      r - double[] vector between two sites.
      tensor - double[] length must be at least binomial(order + 3, 3).
    • order1

      protected abstract void order1()
      Hard coded computation of the Cartesian multipole tensors up to 1st order.
    • order2

      protected abstract void order2()
      Hard coded computation of the Cartesian multipole tensors up to 2nd order.
    • order3

      protected abstract void order3()
      Hard coded computation of the Cartesian multipole tensors up to 3rd order.
    • order4

      protected abstract void order4()
      Hard coded computation of the Cartesian multipole tensors up to 4th order.
    • order5

      protected abstract void order5()
      Hard coded computation of the Cartesian multipole tensors up to 5th order, which is needed for quadrupole-quadrupole forces.
    • order6

      protected abstract void order6()
      Hard coded computation of the Cartesian multipole tensors up to 6th order, which is needed for quadrupole-quadrupole forces and orthogonal space sampling.
    • multipoleIPotentialAtK

      protected abstract void multipoleIPotentialAtK(PolarizableMultipole mI, int order)
      Compute the field components due to multipole I at site K.
      Parameters:
      mI - PolarizableMultipole at site I.
      order - Compute derivatives of the potential up to this order. Order 0: Electrostatic potential (E000) Order 1: First derivatives: d/dX is E100, d/dY is E010, d/dZ is E001. Order 2: Second derivatives: d2/dXdX is E200, d2/dXdY is E110 (needed for quadrupole energy) Order 3: 3rd derivatives: (needed for quadrupole forces).
    • chargeIPotentialAtK

      protected abstract void chargeIPotentialAtK(PolarizableMultipole mI, int order)
      Compute the field components due to charge I at site K.
      Parameters:
      mI - PolarizableMultipole at site I.
      order - Compute derivatives of the potential up to this order. Order 0: Electrostatic potential (E000) Order 1: First derivatives: d/dX is E100, d/dY is E010, d/dZ is E001. Order 2: Second derivatives: d2/dXdX is E200, d2/dXdY is E110 (needed for quadrupole energy) Order 3: 3rd derivatives: (needed for quadrupole forces).
    • dipoleIPotentialAtK

      protected abstract void dipoleIPotentialAtK(double uxi, double uyi, double uzi, int order)
      Compute the induced dipole field components due to site I at site K.
      Parameters:
      uxi - X-dipole component.
      uyi - Y-dipole component.
      uzi - Z-dipole component.
      order - Potential order.
    • quadrupoleIPotentialAtK

      protected abstract void quadrupoleIPotentialAtK(PolarizableMultipole mI, int order)
      Compute the field components due to quadrupole I at site K.
      Parameters:
      mI - PolarizableMultipole at site I.
      order - Compute derivatives of the potential up to this order. Order 0: Electrostatic potential (E000) Order 1: First derivatives: d/dX is E100, d/dY is E010, d/dZ is E001. Order 2: Second derivatives: d2/dXdX is E200, d2/dXdY is E110 (needed for quadrupole energy) Order 3: 3rd derivatives: (needed for quadrupole forces).
    • multipoleKPotentialAtI

      protected abstract void multipoleKPotentialAtI(PolarizableMultipole mK, int order)
      Compute the field components due to multipole K at site I.
      Parameters:
      mK - PolarizableMultipole at site K.
      order - Compute derivatives of the potential up to this order. Order 0: Electrostatic potential (E000) Order 1: First derivatives: d/dX is E100, d/dY is E010, d/dZ is E001. Order 2: Second derivatives: d2/dXdX is E200, d2/dXdY is E110 (needed for quadrupole energy) Order 3: 3rd derivatives: (needed for quadrupole forces).
    • chargeKPotentialAtI

      protected abstract void chargeKPotentialAtI(PolarizableMultipole mK, int order)
      Compute the field components due to multipole K at site I.
      Parameters:
      mK - PolarizableMultipole at site K.
      order - Compute derivatives of the potential up to this order. Order 0: Electrostatic potential (E000) Order 1: First derivatives: d/dX is E100, d/dY is E010, d/dZ is E001. Order 2: Second derivatives: d2/dXdX is E200, d2/dXdY is E110 (needed for quadrupole energy) Order 3: 3rd derivatives: (needed for quadrupole forces).
    • dipoleKPotentialAtI

      protected abstract void dipoleKPotentialAtI(double uxk, double uyk, double uzk, int order)
      Compute the induced dipole field components due to site K at site I.
      Parameters:
      uxk - X-dipole component.
      uyk - Y-dipole component.
      uzk - Z-dipole component.
      order - Potential order.
    • quadrupoleKPotentialAtI

      protected abstract void quadrupoleKPotentialAtI(PolarizableMultipole mK, int order)
      Compute the field components due to multipole K at site I.
      Parameters:
      mK - PolarizableMultipole at site K.
      order - Compute derivatives of the potential up to this order. Order 0: Electrostatic potential (E000) Order 1: First derivatives: d/dX is E100, d/dY is E010, d/dZ is E001. Order 2: Second derivatives: d2/dXdX is E200, d2/dXdY is E110 (needed for quadrupole energy) Order 3: 3rd derivatives: (needed for quadrupole forces).
    • tensorCount

      public static int tensorCount(int order)
      Returns the number of tensors for derivatives to the given order.
      Parameters:
      order - maximum number of derivatives.
      Returns:
      the number of tensors.
      Since:
      1.0
    • rlmn

      protected static String rlmn(int l, int m, int n)
      Convenience method for writing out tensor indices.
      Parameters:
      l - number of d/dx partial derivatives.
      m - number of d/dx partial derivatives.
      n - number of d/dx partial derivatives.
      Returns:
      a String of the form Rlmn.
    • term

      protected static String term(int l, int m, int n)
      Convenience method for writing out intermediate terms in the recursion.
      Parameters:
      l - number of d/dx partial derivatives.
      m - number of d/dx partial derivatives.
      n - number of d/dx partial derivatives.
      Returns:
      a String of the form termLMN.
    • term

      protected static String term(int l, int m, int n, int j)
      Convenience method for writing out intermediate terms in the recursion.
      Parameters:
      l - number of d/dx partial derivatives.
      m - number of d/dx partial derivatives.
      n - number of d/dx partial derivatives.
      j - the jth intermediate term.
      Returns:
      a String of the form termLMNJ.
    • ti

      protected static int ti(int dx, int dy, int dz, int order)
      The index is based on the idea of filling tetrahedron.

      1/r has an index of 0.
      derivatives of x are first; indices from 1..o for d/dx..(d/dx)^o
      derivatives of x and y are second; base triangle of size (o+1)(o+2)/2
      derivatives of x, y and z are last; total size (o+1)*(o+2)*(o+3)/6

      This function is useful to set up masking constants:
      static int Tlmn = ti(l,m,n,order)
      For example the (d/dy)^2 (1/R) storage location:
      static int T020 = ti(0,2,0,order)

      Parameters:
      dx - int The number of d/dx operations.
      dy - int The number of d/dy operations.
      dz - int The number of d/dz operations.
      order - int The maximum tensor order (0 .LE. dx + dy + dz .LE. order).
      Returns:
      int in the range (0..binomial(order + 3, 3) - 1)