Class Bond

All Implemented Interfaces:
BondedEnergy, ROLS, Serializable, Cloneable, Comparable<BondedTerm>, MutableTreeNode, TreeNode

public class Bond extends BondedTerm
The Bond class represents a covalent bond formed between two atoms.
Since:
1.0
Author:
Michael J. Schnieders
See Also:
  • Field Details

    • bondType

      public BondType bondType
      The force field BondType for this bond.
  • Constructor Details

    • Bond

      public Bond(String n)
      Simple Bond constructor that is intended to be used with the equals method.
      Parameters:
      n - Bond id
    • Bond

      public Bond(Atom a1, Atom a2)
      Bond constructor.
      Parameters:
      a1 - Atom number 1.
      a2 - Atom number 2.
  • Method Details

    • logNoBondType

      public static void logNoBondType(Atom a1, Atom a2, ForceField forceField)
      Log that no BondType exists.
      Parameters:
      a1 - Atom 1.
      a2 - Atom 2.
      forceField - The force field in use.
    • compareTo

      public int compareTo(BondedTerm b)
      Specified by:
      compareTo in interface Comparable<BondedTerm>
      Overrides:
      compareTo in class BondedTerm
    • energy

      public double energy(boolean gradient, int threadID, AtomicDoubleArray3D grad, AtomicDoubleArray3D lambdaGrad)
      energy.

      Evaluate this Bond energy.

      Parameters:
      gradient - If true, compute the gradient.
      threadID - The thread ID.
      grad - a AtomicDoubleArray3D object.
      lambdaGrad - a AtomicDoubleArray3D object.
      Returns:
      a double.
    • get1_2

      public Atom get1_2(Atom a)
      Find the other Atom in this Bond. These two atoms are said to be 1-2.
      Parameters:
      a - The known Atom.
      Returns:
      The other Atom that makes up this Bond, or Null if Atom a is not part of this Bond.
    • getCurrentDistance

      public double getCurrentDistance()
      Gets the current distance between the two Atoms in this Bond.
      Returns:
      Current distance.
    • log

      public void log()
      Log details for this Bond energy term.
    • removeFromParent

      public void removeFromParent()
      Specified by:
      removeFromParent in interface MutableTreeNode
      Overrides:
      removeFromParent in class DefaultMutableTreeNode
    • setBondType

      public void setBondType(BondType bondType)
      Set a reference to the force field parameters.
      Parameters:
      bondType - a BondType object.
    • getBondType

      public BondType getBondType()
      Return the BondType for this Bond.
      Returns:
      Returns the BondType.
    • setColor

      public void setColor(Atom a)
      Set the color of this Bond's Java3D shapes based on the passed Atom.
      Parameters:
      a - Atom
    • setRigidScale

      public void setRigidScale(double rigidScale)
      Setter for the field rigidScale.
      Parameters:
      rigidScale - a double.
    • setView

      public void setView(RendererCache.ViewModel newViewModel, List<org.jogamp.java3d.BranchGroup> newShapes)
      setView

      Polymorphic setView method.

      Specified by:
      setView in interface ROLS
      Overrides:
      setView in class BondedTerm
      Parameters:
      newViewModel - a RendererCache.ViewModel object.
      newShapes - a List object.
    • setWire

      public void setWire(org.jogamp.java3d.LineArray l, int i)
      setWire
      Parameters:
      l - a LineArray object.
      i - The index of the LineArray to use.
    • update

      public void update()
      update

      Update recomputes bonds length, Wireframe vertices, and Cylinder Transforms

      Specified by:
      update in interface BondedEnergy
      Specified by:
      update in interface ROLS
      Overrides:
      update in class MSNode