HarmonicBondPotential

class HarmonicBondPotential(particleType1, particleType2, k, r_0=None)

Constructor of the potential.

Parameters:
  • particleType1 (ParticleType or ParticleIdentifier) – Identifier of the first particle type.

  • particleType2 (ParticleType or ParticleIdentifier) – Identifier of the second particle type.

  • k (PhysicalQuantity of type energy / length^2) – Potential parameter (strength of the bond).

  • r_0 (PhysicalQuantity of type length) – Potential parameter (equilibrium distance).

classmethod getAllParameterNames()

Return the names of all used parameters as a list.

getAllParameters()

Return all parameters of this potential and their current values as a <parameterName / parameterValue> dictionary.

static getDefaults()

Get the default parameters of this potential and return them in form of a dictionary of <parameter name, default value> key-value pairs.

getParameter(parameterName)

Get the current value of the parameter parameterName.

setParameter(parameterName, value)

Set the parameter parameterName to the given value.

Parameters:
  • parameterName (str) – The name of the parameter that will be modified.

  • value – The new value that will be assigned to the parameter parameterName.

Usage Examples

Set up a bonded potential with a HarmonicBondPotential for an ethane molecule.

# Set up a new TremoloXPotentialSet
potential_set = TremoloXPotentialSet(name='Ethane_bonded')

# Add particle types for Carbon and Hydrogen.
potential_set.addParticleType(
    ParticleType.fromElement(Carbon, charge=-0.3*elementary_charge)
)
potential_set.addParticleType(
    ParticleType.fromElement(Hydrogen, charge=0.1*elementary_charge)
)
# Set up a new bond potential for C-C bonds and add it to the potential set.
bond_potential = HarmonicBondPotential(
    particleType1='C',
    particleType2='C',
    k=13.44287*eV/Ang**2,
    r_0=1.526*Ang,
)
potential_set.addPotential(bond_potential)

# Set up a new bond potential for C-H bonds and add it to the potential set.
bond_potential = HarmonicBondPotential(
    particleType1='C',
    particleType2='H',
    k=14.74379*eV/Ang**2,
    r_0=1.090*Ang,
)
potential_set.addPotential(bond_potential)
# Create a new TremoloXCalculator with this potential.
calculator = TremoloXCalculator(parameters=potential_set)

Here, only the HarmonicBondPotential block of the script is shown. The full script can be found found in the file ethane_bonded_potential.py.

Notes

  • This potential class is a bonded potential. This means it requires a bond topology to be specified on the configuration which the potential should be used for. Bonds can be set using the findBonds() method on configurations (MoleculeConfiguration, BulkConfiguration, DeviceConfiguration, or SurfaceConfiguration), which automatically adds bonds for atoms which are closer than their combined covalent radii (multiplied by a fuzz_factor of 1.1 by default). Alternatively bonds can be set manually by passing a list of the atom index pairs that form the bonds to the setBonds() method on the configuration. If no bonds are specified on the configuration bonded potentials have no effect.

  • This bond potential is calculated as

    \[V(r) = k \left(r - r_0 \right)^2\]

    where \(r\) is the distance between the atoms connected by this bond and \(r_0\) is the equilibrium distance.