Class MultipoleTensorSIMD

java.lang.Object
ffx.numerics.multipole.MultipoleTensorSIMD
Direct Known Subclasses:
CoulombTensorGlobalSIMD, CoulombTensorQISIMD

public abstract class MultipoleTensorSIMD extends Object
The abstract MultipoleTensorSIMD 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
  • 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 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).
    • coordinates

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

      protected DoubleVector R
      Separation distance.
    • r2

      protected DoubleVector r2
      Separation distance squared.
    • x

      protected DoubleVector x
      Xk - Xi.
    • y

      protected DoubleVector y
      Yk - Yi.
    • z

      protected DoubleVector z
      Zk - Zi.
    • work

      protected final DoubleVector[] work
      A work array with auxiliary terms for the recursion.
    • R000

      protected DoubleVector R000
    • R100

      protected DoubleVector R100
    • R010

      protected DoubleVector R010
    • R001

      protected DoubleVector R001
    • R200

      protected DoubleVector R200
    • R020

      protected DoubleVector R020
    • R002

      protected DoubleVector R002
    • R110

      protected DoubleVector R110
    • R101

      protected DoubleVector R101
    • R011

      protected DoubleVector R011
    • R300

      protected DoubleVector R300
    • R030

      protected DoubleVector R030
    • R003

      protected DoubleVector R003
    • R210

      protected DoubleVector R210
    • R201

      protected DoubleVector R201
    • R120

      protected DoubleVector R120
    • R021

      protected DoubleVector R021
    • R102

      protected DoubleVector R102
    • R012

      protected DoubleVector R012
    • R111

      protected DoubleVector R111
    • R400

      protected DoubleVector R400
    • R040

      protected DoubleVector R040
    • R004

      protected DoubleVector R004
    • R310

      protected DoubleVector R310
    • R301

      protected DoubleVector R301
    • R130

      protected DoubleVector R130
    • R031

      protected DoubleVector R031
    • R103

      protected DoubleVector R103
    • R013

      protected DoubleVector R013
    • R220

      protected DoubleVector R220
    • R202

      protected DoubleVector R202
    • R022

      protected DoubleVector R022
    • R211

      protected DoubleVector R211
    • R121

      protected DoubleVector R121
    • R112

      protected DoubleVector R112
    • R500

      protected DoubleVector R500
    • R050

      protected DoubleVector R050
    • R005

      protected DoubleVector R005
    • R410

      protected DoubleVector R410
    • R401

      protected DoubleVector R401
    • R140

      protected DoubleVector R140
    • R041

      protected DoubleVector R041
    • R104

      protected DoubleVector R104
    • R014

      protected DoubleVector R014
    • R320

      protected DoubleVector R320
    • R302

      protected DoubleVector R302
    • R230

      protected DoubleVector R230
    • R032

      protected DoubleVector R032
    • R203

      protected DoubleVector R203
    • R023

      protected DoubleVector R023
    • R311

      protected DoubleVector R311
    • R131

      protected DoubleVector R131
    • R113

      protected DoubleVector R113
    • R221

      protected DoubleVector R221
    • R212

      protected DoubleVector R212
    • R122

      protected DoubleVector R122
    • R006

      protected DoubleVector R006
    • R402

      protected DoubleVector R402
    • R042

      protected DoubleVector R042
    • R204

      protected DoubleVector R204
    • R024

      protected DoubleVector R024
    • R222

      protected DoubleVector R222
    • R600

      protected DoubleVector R600
    • R060

      protected DoubleVector R060
    • R510

      protected DoubleVector R510
    • R501

      protected DoubleVector R501
    • R150

      protected DoubleVector R150
    • R051

      protected DoubleVector R051
    • R105

      protected DoubleVector R105
    • R015

      protected DoubleVector R015
    • R420

      protected DoubleVector R420
    • R240

      protected DoubleVector R240
    • R411

      protected DoubleVector R411
    • R141

      protected DoubleVector R141
    • R114

      protected DoubleVector R114
    • R330

      protected DoubleVector R330
    • R303

      protected DoubleVector R303
    • R033

      protected DoubleVector R033
    • R321

      protected DoubleVector R321
    • R231

      protected DoubleVector R231
    • R213

      protected DoubleVector R213
    • R312

      protected DoubleVector R312
    • R132

      protected DoubleVector R132
    • R123

      protected DoubleVector R123
    • E000

      protected DoubleVector E000
    • E100

      protected DoubleVector E100
    • E010

      protected DoubleVector E010
    • E001

      protected DoubleVector E001
    • E200

      protected DoubleVector E200
    • E020

      protected DoubleVector E020
    • E002

      protected DoubleVector E002
    • E110

      protected DoubleVector E110
    • E101

      protected DoubleVector E101
    • E011

      protected DoubleVector E011
    • E300

      protected DoubleVector E300
    • E030

      protected DoubleVector E030
    • E003

      protected DoubleVector E003
    • E210

      protected DoubleVector E210
    • E201

      protected DoubleVector E201
    • E120

      protected DoubleVector E120
    • E021

      protected DoubleVector E021
    • E102

      protected DoubleVector E102
    • E012

      protected DoubleVector E012
    • E111

      protected DoubleVector E111
    • t000

      protected final int t000
      No derivatives.
    • t100

      protected final int t100
      First derivative with respect to x.
    • t010

      protected final int t010
      First derivative with respect to y.
    • t001

      protected final int t001
      First derivative with respect to z.
    • t200

      protected final int t200
      Second derivative with respect to x.
    • t020

      protected final int t020
      Second derivative with respect to y.
    • t002

      protected final int t002
      Second derivative with respect to z.
    • t110

      protected final int t110
      Derivatives with respect to x and y.
    • t101

      protected final int t101
      Derivatives with respect to x and z.
    • t011

      protected final int t011
      Derivatives with respect to y and z.
    • t300

      protected final int t300
      Third derivative with respect to x.
    • t030

      protected final int t030
      Third derivative with respect to y.
    • t003

      protected final int t003
      Third derivative with respect to z.
    • t210

      protected final int t210
      Derivatives with respect to x and y.
    • t201

      protected final int t201
      Derivatives with respect to x and z.
    • t120

      protected final int t120
      Derivatives with respect to x and y.
    • t021

      protected final int t021
      Derivatives with respect to y and z.
    • t102

      protected final int t102
      Derivatives with respect to x and z.
    • t012

      protected final int t012
      Derivatives with respect to y and z.
    • t111

      protected final int t111
      Derivatives with respect to x, y and z.
    • t400

      protected final int t400
      Fourth derivative with respect to x.
    • t040

      protected final int t040
      Fourth derivative with respect to y.
    • t004

      protected final int t004
      Fourth derivative with respect to z.
    • t310

      protected final int t310
      Derivatives with respect to x and y.
    • t301

      protected final int t301
      Derivatives with respect to x and z.
    • t130

      protected final int t130
      Derivatives with respect to x and y.
    • t031

      protected final int t031
      Derivatives with respect to y and z.
    • t103

      protected final int t103
      Derivatives with respect to x and z.
    • t013

      protected final int t013
      Derivatives with respect to y and z.
    • t220

      protected final int t220
      Derivatives with respect to x and y.
    • t202

      protected final int t202
      Derivatives with respect to x and z.
    • t022

      protected final int t022
      Derivatives with respect to y and z.
    • t211

      protected final int t211
      Derivatives with respect to x, y and z.
    • t121

      protected final int t121
      Derivatives with respect to x, y and z.
    • t112

      protected final int t112
      Derivatives with respect to x, y and z.
    • t500

      protected final int t500
      Fifth derivative with respect to x.
    • t050

      protected final int t050
      Fifth derivative with respect to y.
    • t005

      protected final int t005
      Fifth derivative with respect to z.
    • t410

      protected final int t410
      Derivatives with respect to x and y.
    • t401

      protected final int t401
      Derivatives with respect to x and z.
    • t140

      protected final int t140
      Derivatives with respect to x and y.
    • t041

      protected final int t041
      Derivatives with respect to y and z.
    • t104

      protected final int t104
      Derivatives with respect to x and z.
    • t014

      protected final int t014
      Derivatives with respect to y and z.
    • t320

      protected final int t320
      Derivatives with respect to x and y.
    • t302

      protected final int t302
      Derivatives with respect to x and z.
    • t230

      protected final int t230
      Derivatives with respect to x and y.
    • t032

      protected final int t032
      Derivatives with respect to y and z.
    • t203

      protected final int t203
      Derivatives with respect to x and z.
    • t023

      protected final int t023
      Derivatives with respect to y and z.
    • t311

      protected final int t311
      Derivatives with respect to x, y and z.
    • t131

      protected final int t131
      Derivatives with respect to x, y and z.
    • t113

      protected final int t113
      Derivatives with respect to x, y and z.
    • t221

      protected final int t221
      Derivatives with respect to x, y and z.
    • t212

      protected final int t212
      Derivatives with respect to x, y and z.
    • t122

      protected final int t122
      Derivatives with respect to x, y and z.
    • t600

      protected final int t600
      Sixth derivative with respect to x.
    • t060

      protected final int t060
      Sixth derivative with respect to y.
    • t006

      protected final int t006
      Sixth derivative with respect to z.
    • t510

      protected final int t510
      Derivatives with respect to x and y.
    • t501

      protected final int t501
      Derivatives with respect to x and z.
    • t150

      protected final int t150
      Derivatives with respect to x and y.
    • t051

      protected final int t051
      Derivatives with respect to y and z.
    • t105

      protected final int t105
      Derivatives with respect to x and z.
    • t015

      protected final int t015
      Derivatives with respect to y and z.
    • t420

      protected final int t420
      Derivatives with respect to x and y.
    • t402

      protected final int t402
      Derivatives with respect to x and z.
    • t240

      protected final int t240
      Derivatives with respect to x and y.
    • t042

      protected final int t042
      Derivatives with respect to y and z.
    • t204

      protected final int t204
      Derivatives with respect to x and z.
    • t024

      protected final int t024
      Derivatives with respect to y and z.
    • t411

      protected final int t411
      Derivatives with respect to x, y and z.
    • t141

      protected final int t141
      Derivatives with respect to x, y and z.
    • t114

      protected final int t114
      Derivatives with respect to x, y and z.
    • t330

      protected final int t330
      Derivatives with respect to x and y.
    • t303

      protected final int t303
      Derivatives with respect to x and z.
    • t033

      protected final int t033
      Derivatives with respect to y and z.
    • t321

      protected final int t321
      Derivatives with respect to x, y and z.
    • t231

      protected final int t231
      Derivatives with respect to x, y and z.
    • t213

      protected final int t213
      Derivatives with respect to x, y and z.
    • t312

      protected final int t312
      Derivatives with respect to x, y and z.
    • t132

      protected final int t132
      Derivatives with respect to x, y and z.
    • t123

      protected final int t123
      Derivatives with respect to x, y and z.
    • t222

      protected final int t222
      Derivatives with respect to x, y and z.
  • Constructor Details

    • MultipoleTensorSIMD

      public MultipoleTensorSIMD(CoordinateSystem coordinates, int order)
      Constructor for MultipoleTensor.
      Parameters:
      coordinates - a CoordinateSystem object.
      order - The order of the tensor.
  • Method Details

    • setR

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

      public abstract void setR(DoubleVector dx, DoubleVector dy, DoubleVector 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 void generateTensor()
      Generate the tensor using hard-coded methods.
    • getSource

      public DoubleVector[] getSource()
      Return the source terms.
    • multipoleEnergy

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

    • multipoleGradient

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

      protected final void multipoleTorque(PolarizableMultipoleSIMD m, DoubleVector[] 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(PolarizableMultipoleSIMD m, DoubleVector[] 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(PolarizableMultipoleSIMD m, DoubleVector[] 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 DoubleVector polarizationEnergy(PolarizableMultipoleSIMD 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 DoubleVector polarizationEnergyS(PolarizableMultipoleSIMD m)
      Contract an induced dipole with the potential and its derivatives.
      Parameters:
      m - PolarizableMultipole at the site of the potential.
      Returns:
      The polarization energy.
    • polarizationEnergyAndGradient

      public DoubleVector polarizationEnergyAndGradient(PolarizableMultipoleSIMD mI, PolarizableMultipoleSIMD mK, DoubleVector inductionMask, DoubleVector energyMask, DoubleVector mutualMask, DoubleVector[] Gi, DoubleVector[] Ti, DoubleVector[] 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.
    • multipoleEnergyAndGradient

      public DoubleVector multipoleEnergyAndGradient(PolarizableMultipoleSIMD mI, PolarizableMultipoleSIMD mK, DoubleVector[] Gi, DoubleVector[] Gk, DoubleVector[] Ti, DoubleVector[] 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.
    • source

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

      protected abstract void order1()
      Hard coded tensor computation up to 1st order. This code is auto-generated for both Global and QI frames.
    • order2

      protected abstract void order2()
      Hard coded tensor computation up to 2nd order. This code is auto-generated for both Global and QI frames.
    • order3

      protected abstract void order3()
      Hard coded tensor computation up to 3rd order. This code is auto-generated for both Global and QI frames.
    • order4

      protected abstract void order4()
      Hard coded tensor computation up to 4th order. This code is auto-generated for both Global and QI frames.
    • order5

      protected abstract void order5()
      Hard coded tensor computation up to 5th order. This code is auto-generated for both Global and QI frames.
      The 5th order recursion is needed for quadrupole-quadrupole forces.
    • order6

      protected abstract void order6()
      Hard coded tensor computation up to 6th order. This code is auto-generated for both Global and QI frames.
      This is needed for quadrupole-quadrupole forces and orthogonal space sampling.
    • multipoleIPotentialAtK

      protected abstract void multipoleIPotentialAtK(PolarizableMultipoleSIMD mI, int order)
    • multipoleKPotentialAtI

      protected abstract void multipoleKPotentialAtI(PolarizableMultipoleSIMD mK, int order)
    • chargeKPotentialAtI

      protected abstract void chargeKPotentialAtI(PolarizableMultipoleSIMD mK, int order)
      Compute the field components due to site K charge at site I.
      Parameters:
      mK - MultipoleTensorSIMD at site K.
      order - Potential order.
    • dipoleKPotentialAtI

      protected abstract void dipoleKPotentialAtI(DoubleVector uxk, DoubleVector uyk, DoubleVector 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(PolarizableMultipoleSIMD mK, int order)
      Compute the field components due to site K quadrupole at site I.
      Parameters:
      mK - MultipoleTensorSIMD at site K.
      order - Potential order.
    • chargeIPotentialAtK

      protected abstract void chargeIPotentialAtK(PolarizableMultipoleSIMD mI, int order)
      Compute the field components due to site I charge at site K.
      Parameters:
      mI - MultipoleTensorSIMD at site I.
      order - Potential order.
    • dipoleIPotentialAtK

      protected abstract void dipoleIPotentialAtK(DoubleVector uxi, DoubleVector uyi, DoubleVector 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(PolarizableMultipoleSIMD mI, int order)
      Compute the field components due to site I quadrupole at site K.
      Parameters:
      mI - MultipoleTensorSIMD at site I.
      order - Potential order.
    • 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)