pyretis.forcefield.potentials package¶
A collection of potential functions.
This package defines some potential functions. These potential functions can be used to create force fields.
Package structure¶
Modules¶
- potentials.py (
pyretis.forcefield.potentials.potentials
) - This module defines some simple potential functions.
Sub-packages¶
- pairpotentials (
pyretis.forcefield.potentials.pairpotentials
) - This package defines different pair interactions, for instance the Lennard-Jones 6-12 simple cut potential.
Important classes defined in this package¶
- DoubleWell (
DoubleWell
) - A double well potential
- RectangularWell (
RectangularWell
) - A rectangular well potential – useful as a bias potential.
- PairLennardJonesCut (
PairLennardJonesCut
) - The Lennard-Jones potential in pure python.
- PairLennardJonesCutnp (
PairLennardJonesCutnp
) - The Lennard-Jones potential, making use of numpy.
- DoubleWellWCA (
DoubleWellWCA
) - A n-dimensional Double Well potential.
Subpackages¶
- pyretis.forcefield.potentials.pairpotentials package
- Package structure
- List of submodules
- pyretis.forcefield.potentials.pairpotentials.lennardjones module
- Important classes defined here
PairLennardJonesCut
PairLennardJonesCut.params
PairLennardJonesCut._lj
PairLennardJonesCut._offset
PairLennardJonesCut._rcut2
PairLennardJonesCut.__init__()
PairLennardJonesCut.__str__()
PairLennardJonesCut.force()
PairLennardJonesCut.potential()
PairLennardJonesCut.potential_and_force()
PairLennardJonesCut.set_parameters()
PairLennardJonesCutnp
- pyretis.forcefield.potentials.pairpotentials.pairpotential module
- pyretis.forcefield.potentials.pairpotentials.wca module
List of submodules¶
pyretis.forcefield.potentials.potentials module¶
A collection of simple position dependent potentials.
This module defines some potential functions which are useful as simple models.
Important classes defined here¶
- DoubleWell (
DoubleWell
) - This class defines a one-dimensional double well potential.
- RectangularWell (
RectangularWell
) - This class defines a one-dimensional rectangular well potential.
-
class
pyretis.forcefield.potentials.potentials.
DoubleWell
(a=1.0, b=1.0, c=0.0, desc='1D double well potential')[source]¶ Bases:
PotentialFunction
A 1D double well potential.
This class defines a one-dimensional double well potential. The potential energy () is given by
where is the position and , and are parameters for the potential. These parameters are stored as attributes of the class. Typically, both and are positive quantities, however, we do not explicitly check that here.
-
params
¶ Contains the parameters. The keys are:
- a: The
a
parameter for the potential. - b: The
b
parameter for the potential. - c: The
c
parameter for the potential.
These keys corresponds to the parameters in the potential, .
Type: dict - a: The
-
__init__
(a=1.0, b=1.0, c=0.0, desc='1D double well potential')[source]¶ Initialise the one dimensional double well potential.
Parameters: - a (float, optional) – Parameter for the potential.
- b (float, optional) – Parameter for the potential.
- c (float, optional) – Parameter for the potential.
- desc (string, optional) – Description of the force field.
-
force
(system)[source]¶ Evaluate forces for the 1D double well potential.
Parameters: system (object like System
) – The system we evaluate the potential for. Here, we make use of the positions only.Returns: - out[0] (numpy.array) – The calculated force.
- out[1] (numpy.array) – The virial, currently not implemented for this potential!
-
potential
(system)[source]¶ Evaluate the potential for the one-dimensional double well.
Parameters: system (object like System
) – The system we evaluate the potential for. Here, we make use of the positions only.Returns: out (float) – The potential energy.
-
potential_and_force
(system)[source]¶ Evaluate the potential and the force.
Parameters: system (object like System
) – The system we evaluate the potential for. Here, we make use of the positions only.Returns: - out[0] (float) – The potential energy as a float.
- out[1] (numpy.array) – The force as a numpy.array of the same shape as the positions in particles.pos.
- out[2] (numpy.array) – The virial, currently not implemented for this potential!
-
-
class
pyretis.forcefield.potentials.potentials.
RectangularWell
(left=0.0, right=1.0, largenumber=inf, desc='1D Rectangular well potential')[source]¶ Bases:
PotentialFunction
A 1D rectangular well potential.
This class defines a one-dimensional rectangular well potential. The potential energy is zero within the potential well and infinite outside. The well is defined with a left and right boundary.
-
params
¶ The parameters for the potential. The keys are:
- left: Left boundary of the potential.
- right: Right boundary of the potential.
- largenumber: Value of potential outside the boundaries.
It is possible to define left > right, however, a warning will be issued then.
Type: dict
-
__init__
(left=0.0, right=1.0, largenumber=inf, desc='1D Rectangular well potential')[source]¶ Initialise the one-dimensional rectangular well.
Parameters: - left (float, optional) – The left boundary of the potential.
- right (float, optional) – The right boundary of the potential.
- largenumber (float, optional) – The value of the potential outside (left, right).
- desc (string, optional) – Description of the force field.
-