# CosineTorsionPotential¶

class CosineTorsionPotential(particleType1, particleType2, particleType3, particleType4, k, n, delta)

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. particleType3 (ParticleType or ParticleIdentifier) – Identifier of the third particle type. particleType4 (ParticleType or ParticleIdentifier) – Identifier of the fourth particle type. k (Sequence of PhysicalQuantity of type energy or PhysicalQuantity array of type energy.) – Potential parameter. The length of this list must not exceed 5. n (Sequence of int) – Potential parameter. Must be of the same length as k. delta (Sequence of PhysicalQuantity of type angle or PhysicalQuantity array of type angle.) – Potential parameter. Must be of the same length as k.
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.

setDelta(delta)

Set the parameter delta.

Parameters: delta (Sequence of PhysicalQuantity of type angle or PhysicalQuantity array of type angle.) – Potential parameter. Must be of the same length as k.
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.
setk(k)

Set the parameter k.

Parameters: k (Sequence of PhysicalQuantity of type energy or PhysicalQuantity array of type energy.) – Potential parameter. The length of this list must not exceed 5.
setn(n)

Set the parameter n.

Parameters: n (Sequence of int) – Potential parameter. Must be of the same length as k.

## Usage Examples¶

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

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

# Add particle types for Carbon and Hydrogen.
ParticleType.fromElement(Carbon, charge=-0.3*elementary_charge)
)
ParticleType.fromElement(Hydrogen, charge=0.1*elementary_charge)
)
# Set up a new torsion potential for H-C-C-H groups and add it to the potential set.
# This potential has a multiplicity of 1.
torsion_potential = CosineTorsionPotential(
particleType1='H',
particleType2='C',
particleType3='C',
particleType4='H',
k=[0.0067455*eV],
n=[3],
delta=[0.0]
)
# Create a new TremoloXCalculator with this potential.
calculator = TremoloXCalculator(parameters=potential_set)


Here, only the CosineTorsionPotential 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.

• Each torsion potential is calculated for a quadruple (a,b,c,d) of atoms, which are connected by three bonds (a,b) , (b,c), and (c,d). The potential acts on the torsion angle $$\phi$$ around the central bond:

$\phi(\mathbf{r}_{a,b}, \mathbf{r}_{b,c}, \mathbf{r}_{c,d}) = \arccos\left( \frac{ (\mathbf{r}_{a,b} \times \mathbf{r}_{b,c}) \cdot (\mathbf{r}_{b,c} \times \mathbf{r}_{c,d}) }{ \lvert \mathbf{r}_{a,b} \times \mathbf{r}_{b,c} \rvert \lvert \mathbf{r}_{b,c} \times \mathbf{r}_{c,d} \rvert }\right)$

where $$\mathbf{r}_{i,j}, \, \{i, j\} \subset \{a,b,c,d\}$$ is the distance vector from atom i to atom j.

The torsion potential is calculated as

$V(\phi) = \sum_{i=1}^{\mathrm{mult}} k_i \left(1 + \cos (n_i \phi - \delta_i) \right)$

where $$\mathrm{mult} < 6$$ is the multiplicity of the torsion potential for the given quadruple of atom types. Each of the parameters k, n, and $$\delta$$ is given as a list of length $$\mathrm{mult}$$.