|
Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
|
A Potential object is a compiled interpolation of a given function. The Universe applies potentials to particles to calculate the net force on them. More...
#include <tfPotential.h>


Public Member Functions | |
| FPTYPE | operator() (const FPTYPE &r, const FPTYPE &r0=-1.0) |
| FPTYPE | operator() (const std::vector< FPTYPE > &r) |
| FPTYPE | operator() (struct ParticleHandle *pi, const FVector3 &pt) |
| FPTYPE | operator() (struct ParticleHandle *pi, struct ParticleHandle *pj) |
| FPTYPE | operator() (struct ParticleHandle *pi, struct ParticleHandle *pj, struct ParticleHandle *pk) |
| FPTYPE | operator() (struct ParticleHandle *pi, struct ParticleHandle *pj, struct ParticleHandle *pk, struct ParticleHandle *pl) |
| FPTYPE | force (FPTYPE r, FPTYPE ri=-1.0, FPTYPE rj=-1.0) |
| std::vector< FPTYPE > | force (const std::vector< FPTYPE > &r) |
| std::vector< FPTYPE > | force (struct ParticleHandle *pi, const FVector3 &pt) |
| std::vector< FPTYPE > | force (struct ParticleHandle *pi, struct ParticleHandle *pj) |
| std::pair< std::vector< FPTYPE >, std::vector< FPTYPE > > | force (struct ParticleHandle *pi, struct ParticleHandle *pj, struct ParticleHandle *pk) |
| std::pair< std::vector< FPTYPE >, std::vector< FPTYPE > > | force (struct ParticleHandle *pi, struct ParticleHandle *pj, struct ParticleHandle *pk, struct ParticleHandle *pl) |
| std::vector< Potential * > | constituents () |
| Potential & | operator+ (const Potential &rhs) |
| virtual std::string | toString () |
| Get a JSON string representation. | |
| FPTYPE | getMin () |
| FPTYPE | getMax () |
| FPTYPE | getCutoff () |
| std::pair< FPTYPE, FPTYPE > | getDomain () |
| int | getIntervals () |
| bool | getBound () |
| void | setBound (const bool &_bound) |
| FPTYPE | getR0 () |
| void | setR0 (const FPTYPE &_r0) |
| bool | getShifted () |
| bool | getPeriodic () |
| bool | getRSquare () |
Static Public Member Functions | |
| static Potential * | fromString (const std::string &str) |
| Create from a JSON string representation. | |
| static Potential * | lennard_jones_12_6 (FPTYPE min, FPTYPE max, FPTYPE A, FPTYPE B, FPTYPE *tol=NULL) |
| Creates a 12-6 Lennard-Jones potential. | |
| static Potential * | lennard_jones_12_6_coulomb (FPTYPE min, FPTYPE max, FPTYPE A, FPTYPE B, FPTYPE q, FPTYPE *tol=NULL) |
| Creates a potential of the sum of a 12-6 Lennard-Jones potential and a shifted Coulomb potential. | |
| static Potential * | ewald (FPTYPE min, FPTYPE max, FPTYPE q, FPTYPE kappa, FPTYPE *tol=NULL, unsigned int *periodicOrder=NULL) |
| Creates a real-space Ewald potential. | |
| static Potential * | coulomb (FPTYPE q, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL, unsigned int *periodicOrder=NULL) |
| Creates a Coulomb potential. | |
| static Potential * | coulombR (FPTYPE q, FPTYPE kappa, FPTYPE min, FPTYPE max, unsigned int *modes=NULL) |
| Creates a Coulomb reciprocal potential. | |
| static Potential * | harmonic (FPTYPE k, FPTYPE r0, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL) |
| Creates a harmonic bond potential. | |
| static Potential * | linear (FPTYPE k, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL) |
| Creates a linear potential. | |
| static Potential * | harmonic_angle (FPTYPE k, FPTYPE theta0, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL) |
| Creates a harmonic angle potential. | |
| static Potential * | harmonic_dihedral (FPTYPE k, FPTYPE delta, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL) |
| Creates a harmonic dihedral potential. | |
| static Potential * | cosine_dihedral (FPTYPE k, int n, FPTYPE delta, FPTYPE *tol=NULL) |
| Creates a cosine dihedral potential. | |
| static Potential * | well (FPTYPE k, FPTYPE n, FPTYPE r0, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL) |
| Creates a well potential. | |
| static Potential * | glj (FPTYPE e, FPTYPE *m=NULL, FPTYPE *n=NULL, FPTYPE *k=NULL, FPTYPE *r0=NULL, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL, bool *shifted=NULL) |
| Creates a generalized Lennard-Jones potential. | |
| static Potential * | morse (FPTYPE *d=NULL, FPTYPE *a=NULL, FPTYPE *r0=NULL, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL, bool *shifted=NULL) |
| Creates a Morse potential. | |
| static Potential * | overlapping_sphere (FPTYPE *mu=NULL, FPTYPE *kc=NULL, FPTYPE *kh=NULL, FPTYPE *r0=NULL, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL) |
Creates an overlapping-sphere potential from :cite:Osborne:2017hk. | |
| static Potential * | power (FPTYPE *k=NULL, FPTYPE *r0=NULL, FPTYPE *alpha=NULL, FPTYPE *min=NULL, FPTYPE *max=NULL, FPTYPE *tol=NULL) |
| Creates a power potential. | |
| static Potential * | dpd (FPTYPE *alpha=NULL, FPTYPE *gamma=NULL, FPTYPE *sigma=NULL, FPTYPE *cutoff=NULL, bool *shifted=NULL) |
| Creates a Dissipative Particle Dynamics potential. | |
| static Potential * | custom (FPTYPE min, FPTYPE max, FPTYPE(*f)(FPTYPE), FPTYPE(*fp)(FPTYPE), FPTYPE(*f6p)(FPTYPE), FPTYPE *tol=NULL, uint32_t *flags=NULL) |
| Creates a custom potential. | |
Public Attributes | |
| uint32_t | kind |
| uint32_t | flags |
| FPTYPE | alpha [4] |
| FPTYPE * | c |
| FPTYPE | r0_plusone |
| FPTYPE | a |
| FPTYPE | b |
| FPTYPE | mu |
| FPTYPE | offset [3] |
| int | n |
| PotentialCreate | create_func |
| PotentialClear | clear_func |
| PotentialEval_ByParticle | eval_bypart |
| PotentialEval_ByParticles | eval_byparts |
| PotentialEval_ByParticles3 | eval_byparts3 |
| PotentialEval_ByParticles4 | eval_byparts4 |
| Potential * | pca |
| Potential * | pcb |
| const char * | name |
A Potential object is a compiled interpolation of a given function. The Universe applies potentials to particles to calculate the net force on them.
For performance reasons, Tissue Forge implements potentials as interpolations, which can be much faster than evaluating the function directly.
A potential can be treated just like any callable object.
|
static |
Creates a cosine dihedral potential.
The cosine dihedral potential has the form:
![\[
k \left( 1 + \cos( n \theta-\delta ) \right)
\]](../../form_36.png)
| k | energy of the dihedral. |
| n | multiplicity of the dihedral. |
| delta | minimum energy dihedral. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.01. |
|
static |
Creates a Coulomb potential.
The Coulomb potential has the form:
![\[
\frac{q}{r}
\]](../../form_25.png)
| q | The charge scaling of the potential. |
| min | The smallest radius for which the potential will be constructed. Default is 0.01. |
| max | The largest radius for which the potential will be constructed. Default is 2.0. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min). |
| periodicOrder | Order of lattice periodicity along all periodic dimensions. Defaults to 0. |
|
static |
Creates a Coulomb reciprocal potential.
The Coulomb reciprocal potential has the form:
![\[
\frac{\pi q}{V} \sum_{||\mathbf{m}|| \neq 0} \frac{1}{||\mathbf{m}||^2} \exp \left( \left( i \mathbf{r}_{jk} - \left( \frac{\pi}{\kappa} \right)^{2} \mathbf{m} \right) \cdot \mathbf{m} \right)
\]](../../form_26.png)
Here 

| q | Charge scaling of the potential. |
| kappa | Screening distance. |
| min | Smallest radius for which the potential will be constructed. |
| max | Largest radius for which the potential will be constructed. |
| modes | Number of Fourier modes along each periodic dimension. Default is 1. |
|
static |
Creates a custom potential.
| min | The smallest radius for which the potential will be constructed. |
| max | The largest radius for which the potential will be constructed. |
| f | function returning the value of the potential |
| fp | function returning the value of first derivative of the potential |
| f6p | function returning the value of sixth derivative of the potential |
| tol | Tolerance, defaults to 0.001. |
|
static |
Creates a Dissipative Particle Dynamics potential.
The Dissipative Particle Dynamics force has the form:
![\[
\mathbf{F}_{ij} = \mathbf{F}^C_{ij} + \mathbf{F}^D_{ij} + \mathbf{F}^R_{ij}
\]](../../form_50.png)
The conservative force is:
![\[
\mathbf{F}^C_{ij} = \alpha \left(1 - \frac{r_{ij}}{r_c}\right) \mathbf{e}_{ij}
\]](../../form_51.png)
The dissapative force is:
![\[
\mathbf{F}^D_{ij} = -\gamma \left(1 - \frac{r_{ij}}{r_c}\right)^{2}(\mathbf{e}_{ij} \cdot \mathbf{v}_{ij}) \mathbf{e}_{ij}
\]](../../form_52.png)
The random force is:
![\[
\mathbf{F}^R_{ij} = \sigma \left(1 - \frac{r_{ij}}{r_c}\right) \xi_{ij}\Delta t^{-1/2}\mathbf{e}_{ij}
\]](../../form_53.png)
| alpha | interaction strength of the conservative force. Defaults to 1.0. |
| gamma | interaction strength of dissapative force. Defaults to 1.0. |
| sigma | strength of random force. Defaults to 1.0. |
| cutoff | cutoff distance. Defaults to 1.0. |
| shifted | Flag for whether using a shifted potential. Defaults to false. |
|
static |
Creates a real-space Ewald potential.
The Ewald potential has the form:
![\[
q \frac{\mathrm{erfc}\, ( \kappa r)}{r}
\]](../../form_24.png)
| min | The smallest radius for which the potential will be constructed. |
| max | The largest radius for which the potential will be constructed. |
| q | The charge scaling of the potential. |
| kappa | The screening distance of the Ewald potential. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min). |
| periodicOrder | Order of lattice periodicity along all periodic dimensions. Defaults to 0. |
|
static |
Create from a JSON string representation.
| str |
|
static |
Creates a generalized Lennard-Jones potential.
The generalized Lennard-Jones potential has the form:
![\[
\frac{\epsilon}{n-m} \left[ m \left( \frac{r_0}{r} \right)^n - n \left( \frac{r_0}{r} \right)^m \right]
\]](../../form_38.png)
| e | effective energy of the potential. |
| m | order of potential. Defaults to 3 |
| n | order of potential. Defaults to 2*m. |
| k | mimumum of the potential. Defaults to 1. |
| r0 | mimumum of the potential. Defaults to 1. |
| min | The smallest radius for which the potential will be constructed. Defaults to 0.05 * r0. |
| max | The largest radius for which the potential will be constructed. Defaults to 5 * r0. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.01. |
| shifted | Flag for whether using a shifted potential. Defaults to true. |
|
static |
Creates a harmonic bond potential.
The harmonic potential has the form:
![\[
k \left( r-r_0 \right)^2
\]](../../form_29.png)
| k | The energy of the bond. |
| r0 | The bond rest length. |
| min | The smallest radius for which the potential will be constructed. Defaults to ![]() |
| max | The largest radius for which the potential will be constructed. Defaults to ![]() |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to ![]() |
|
static |
Creates a harmonic angle potential.
The harmonic angle potential has the form:
![\[
k \left(\theta-\theta_{0} \right)^2
\]](../../form_34.png)
| k | The energy of the angle. |
| theta0 | The minimum energy angle. |
| min | The smallest angle for which the potential will be constructed. Defaults to zero. |
| max | The largest angle for which the potential will be constructed. Defaults to PI. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.005 * (max - min). |
|
static |
Creates a harmonic dihedral potential.
The harmonic dihedral potential has the form:
![\[
k \left( \theta - \delta \right) ^2
\]](../../form_35.png)
| k | energy of the dihedral. |
| delta | minimum energy dihedral. |
| min | The smallest angle for which the potential will be constructed. Defaults to zero. |
| max | The largest angle for which the potential will be constructed. Defaults to PI. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.005 * (max - min). |
|
static |
Creates a 12-6 Lennard-Jones potential.
The Lennard Jones potential has the form:
![\[
\left( \frac{A}{r^{12}} - \frac{B}{r^6} \right)
\]](../../form_22.png)
| min | The smallest radius for which the potential will be constructed. |
| max | The largest radius for which the potential will be constructed. |
| A | The first parameter of the Lennard-Jones potential. |
| B | The second parameter of the Lennard-Jones potential. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min). |
|
static |
Creates a potential of the sum of a 12-6 Lennard-Jones potential and a shifted Coulomb potential.
The 12-6 Lennard Jones - Coulomb potential has the form:
![\[
\left( \frac{A}{r^{12}} - \frac{B}{r^6} \right) + q \left( \frac{1}{r} - \frac{1}{max} \right)
\]](../../form_23.png)
| min | The smallest radius for which the potential will be constructed. |
| max | The largest radius for which the potential will be constructed. |
| A | The first parameter of the Lennard-Jones potential. |
| B | The second parameter of the Lennard-Jones potential. |
| q | The charge scaling of the potential. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min). |
|
static |
Creates a linear potential.
The linear potential has the form:
![\[
k r
\]](../../form_33.png)
| k | interaction strength; represents the potential energy peak value. |
| min | The smallest radius for which the potential will be constructed. Defaults to 0.0. |
| max | The largest radius for which the potential will be constructed. Defaults to 10.0. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.001. |
|
static |
Creates a Morse potential.
The Morse potential has the form:
![\[
d \left(1 - e^{ -a \left(r - r_0 \right) } \right)^2
\]](../../form_39.png)
| d | well depth. Defaults to 1.0. |
| a | potential width. Defaults to 6.0. |
| r0 | equilibrium distance. Defaults to 0.0. |
| min | The smallest radius for which the potential will be constructed. Defaults to 0.0001. |
| max | The largest radius for which the potential will be constructed. Defaults to 3.0. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.001. |
| shifted | Flag for whether using a shifted potential. Defaults to true. |
|
static |
Creates an overlapping-sphere potential from :cite:Osborne:2017hk.
The overlapping-sphere potential has the form:
![\[
\mu_{ij} s_{ij}(t) \hat{\mathbf{r}}_{ij} \log \left( 1 + \frac{||\mathbf{r}_{ij}|| - s_{ij}(t)}{s_{ij}(t)} \right)
\text{ if } ||\mathbf{r}_{ij}|| < s_{ij}(t) ,
\]](../../form_40.png)
![\[
\mu_{ij}\left(||\mathbf{r}_{ij}|| - s_{ij}(t)\right) \hat{\mathbf{r}}_{ij} \exp \left( -k_c \frac{||\mathbf{r}_{ij}|| - s_{ij}(t)}{s_{ij}(t)} \right)
\text{ if } s_{ij}(t) \leq ||\mathbf{r}_{ij}|| \leq r_{max} ,
\]](../../form_41.png)
![\[
0 \text{ otherwise} .
\]](../../form_42.png)
Osborne refers to 






| mu | interaction strength, represents the potential energy peak value. Defaults to 1.0. |
| kc | decay strength of long range attraction. Larger values make a shorter ranged function. Defaults to 1.0. |
| kh | Optionally add a harmonic long-range attraction, same as :meth:glj function. Defaults to 0.0. |
| r0 | Optional harmonic rest length, only used if kh is non-zero. Defaults to 0.0. |
| min | The smallest radius for which the potential will be constructed. Defaults to 0.001. |
| max | The largest radius for which the potential will be constructed. Defaults to 10.0. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.001. |
|
static |
Creates a power potential.
The power potential the general form of many of the potential functions, such as :meth:linear, etc. power has the form:
![\[
k \lvert r-r_0 \rvert ^{\alpha}
\]](../../form_49.png)
| k | interaction strength, represents the potential energy peak value. Defaults to 1 |
| r0 | potential rest length, zero of the potential, defaults to 0. |
| alpha | Exponent, defaults to 1. |
| min | minimal value potential is computed for, defaults to r0 / 2. |
| max | cutoff distance, defaults to 3 * r0. |
| tol | Tolerance, defaults to 0.01. |
|
virtual |
|
static |
Creates a well potential.
Useful for binding a particle to a region.
The well potential has the form:
![\[
\frac{k}{\left(r_0 - r\right)^{n}}
\]](../../form_37.png)
| k | potential prefactor constant, should be decreased for larger n. |
| n | exponent of the potential, larger n makes a sharper potential. |
| r0 | The extents of the potential, length units. Represents the maximum extents that a two objects connected with this potential should come apart. |
| min | The smallest radius for which the potential will be constructed. Defaults to zero. |
| max | The largest radius for which the potential will be constructed. Defaults to r0. |
| tol | The tolerance to which the interpolation should match the exact potential. Defaults to 0.01 * abs(min-max). |
| FPTYPE TissueForge::Potential::a |
Interval edges.
| FPTYPE TissueForge::Potential::alpha[4] |
Coefficients for the interval transform.
| FPTYPE* TissueForge::Potential::c |
The coefficients.
| uint32_t TissueForge::Potential::flags |
Flags.
| FPTYPE TissueForge::Potential::mu |
potential scaling constant
| int TissueForge::Potential::n |
Nr of intervals.
| const char* TissueForge::Potential::name |
pointer to what kind of potential this is.
| FPTYPE TissueForge::Potential::offset[3] |
coordinate offset