|
Tissue Forge C 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
|
#include "tf_port_c.h"

Go to the source code of this file.
Data Structures | |
| struct | tfPotentialFlagsHandle |
| struct | tfPotentialKindHandle |
| struct | tfPotentialEval_ByParticleHandle |
| Handle to a PotentialEval_ByParticle instance. More... | |
| struct | tfPotentialEval_ByParticlesHandle |
| Handle to a PotentialEval_ByParticles instance. More... | |
| struct | tfPotentialEval_ByParticles3Handle |
| Handle to a PotentialEval_ByParticles3 instance. More... | |
| struct | tfPotentialEval_ByParticles4Handle |
| Handle to a PotentialEval_ByParticles4 instance. More... | |
| struct | tfPotentialClearHandle |
| Handle to a PotentialClear instance. More... | |
| struct | tfPotentialHandle |
| Handle to a Potential instance. More... | |
Typedefs | |
| typedef void(* | tfPotentialEval_ByParticleHandleFcn) (struct tfPotentialHandle *p, struct tfParticleHandleHandle *part_i, tfFloatP_t *dx, tfFloatP_t r2, tfFloatP_t *e, tfFloatP_t *f) |
| typedef void(* | tfPotentialEval_ByParticlesHandleFcn) (struct tfPotentialHandle *p, struct tfParticleHandleHandle *part_i, struct tfParticleHandleHandle *part_j, tfFloatP_t *dx, tfFloatP_t r2, tfFloatP_t *e, tfFloatP_t *f) |
| typedef void(* | tfPotentialEval_ByParticles3HandleFcn) (struct tfPotentialHandle *p, struct tfParticleHandleHandle *part_i, struct tfParticleHandleHandle *part_j, struct tfParticleHandleHandle *part_k, tfFloatP_t ctheta, tfFloatP_t *e, tfFloatP_t *fi, tfFloatP_t *fk) |
| typedef void(* | tfPotentialEval_ByParticles4HandleFcn) (struct tfPotentialHandle *p, struct tfParticleHandleHandle *part_i, struct tfParticleHandleHandle *part_j, struct tfParticleHandleHandle *part_k, struct tfParticleHandleHandle *part_l, tfFloatP_t cphi, tfFloatP_t *e, tfFloatP_t *fi, tfFloatP_t *fl) |
| typedef void(* | tfPotentialClearHandleFcn) (struct tfPotentialHandle *p) |
Functions | |
| HRESULT | tfPotentialFlags_init (struct tfPotentialFlagsHandle *handle) |
| Initialize an instance. | |
| HRESULT | tfPotentialKind_init (struct tfPotentialKindHandle *handle) |
| Initialize an instance. | |
| HRESULT | tfPotentialEval_ByParticle_init (struct tfPotentialEval_ByParticleHandle *handle, tfPotentialEval_ByParticleHandleFcn *fcn) |
| Initialize an instance. | |
| HRESULT | tfPotentialEval_ByParticle_destroy (struct tfPotentialEval_ByParticleHandle *handle) |
| Destroy an instance. | |
| HRESULT | tfPotentialEval_ByParticles_init (struct tfPotentialEval_ByParticlesHandle *handle, tfPotentialEval_ByParticlesHandleFcn *fcn) |
| Initialize an instance. | |
| HRESULT | tfPotentialEval_ByParticles_destroy (struct tfPotentialEval_ByParticlesHandle *handle) |
| Destroy an instance. | |
| HRESULT | tfPotentialEval_ByParticles3_init (struct tfPotentialEval_ByParticles3Handle *handle, tfPotentialEval_ByParticles3HandleFcn *fcn) |
| Initialize an instance. | |
| HRESULT | tfPotentialEval_ByParticles3_destroy (struct tfPotentialEval_ByParticles3Handle *handle) |
| Destroy an instance. | |
| HRESULT | tfPotentialEval_ByParticles4_init (struct tfPotentialEval_ByParticles4Handle *handle, tfPotentialEval_ByParticles4HandleFcn *fcn) |
| Initialize an instance. | |
| HRESULT | tfPotentialEval_ByParticles4_destroy (struct tfPotentialEval_ByParticles4Handle *handle) |
| Destroy an instance. | |
| HRESULT | tfPotentialClear_init (struct tfPotentialClearHandle *handle, tfPotentialClearHandleFcn *fcn) |
| Initialize an instance. | |
| HRESULT | tfPotentialClear_destroy (struct tfPotentialClearHandle *handle) |
| Destroy an instance. | |
| HRESULT | tfPotential_destroy (struct tfPotentialHandle *handle) |
| Destroy an instance. | |
| HRESULT | tfPotential_getName (struct tfPotentialHandle *handle, char **name, unsigned int *numChars) |
| Get the name of the potential. | |
| HRESULT | tfPotential_setName (struct tfPotentialHandle *handle, const char *name) |
| Set the name of the potential. | |
| HRESULT | tfPotential_getFlags (struct tfPotentialHandle *handle, unsigned int *flags) |
| Get the flags of the potential. | |
| HRESULT | tfPotential_setFlags (struct tfPotentialHandle *handle, unsigned int flags) |
| Set the flags of the potential. | |
| HRESULT | tfPotential_getKind (struct tfPotentialHandle *handle, unsigned int *kind) |
| Get the kind of the potential. | |
| HRESULT | tfPotential_evalR (struct tfPotentialHandle *handle, tfFloatP_t r, tfFloatP_t *potE) |
| Evaluate the potential. | |
| HRESULT | tfPotential_evalR0 (struct tfPotentialHandle *handle, tfFloatP_t r, tfFloatP_t r0, tfFloatP_t *potE) |
| Evaluate the potential for a given scaling distance. | |
| HRESULT | tfPotential_evalPos (struct tfPotentialHandle *handle, tfFloatP_t *pos, tfFloatP_t *potE) |
| Evaluate the potential for a given position. | |
| HRESULT | tfPotential_evalPart (struct tfPotentialHandle *handle, struct tfParticleHandleHandle *partHandle, tfFloatP_t *pos, tfFloatP_t *potE) |
| Evaluate the potential for a given particle and position. | |
| HRESULT | tfPotential_evalParts2 (struct tfPotentialHandle *handle, struct tfParticleHandleHandle *phi, struct tfParticleHandleHandle *phj, tfFloatP_t *potE) |
| Evalute the potential for two particles. | |
| HRESULT | tfPotential_evalParts3 (struct tfPotentialHandle *handle, struct tfParticleHandleHandle *phi, struct tfParticleHandleHandle *phj, struct tfParticleHandleHandle *phk, tfFloatP_t *potE) |
| Evalute the potential for three particles. | |
| HRESULT | tfPotential_evalParts4 (struct tfPotentialHandle *handle, struct tfParticleHandleHandle *phi, struct tfParticleHandleHandle *phj, struct tfParticleHandleHandle *phk, struct tfParticleHandleHandle *phl, tfFloatP_t *potE) |
| Evalute the potential for four particles. | |
| HRESULT | tfPotential_fevalR (struct tfPotentialHandle *handle, tfFloatP_t r, tfFloatP_t *force) |
| Evaluate the force. | |
| HRESULT | tfPotential_fevalR0 (struct tfPotentialHandle *handle, tfFloatP_t r, tfFloatP_t r0, tfFloatP_t *force) |
| Evaluate the force for a given scaling distance. | |
| HRESULT | tfPotential_fevalPos (struct tfPotentialHandle *handle, tfFloatP_t *pos, tfFloatP_t **force) |
| Evaluate the force for a given position. | |
| HRESULT | tfPotential_fevalPart (struct tfPotentialHandle *handle, struct tfParticleHandleHandle *partHandle, tfFloatP_t *pos, tfFloatP_t **force) |
| Evaluate the force for a given particle and position. | |
| HRESULT | tfPotential_fevalParts2 (struct tfPotentialHandle *handle, struct tfParticleHandleHandle *phi, struct tfParticleHandleHandle *phj, tfFloatP_t **force) |
| Evalute the force for two particles. | |
| HRESULT | tfPotential_fevalParts3 (struct tfPotentialHandle *handle, struct tfParticleHandleHandle *phi, struct tfParticleHandleHandle *phj, struct tfParticleHandleHandle *phk, tfFloatP_t **forcei, tfFloatP_t **forcek) |
| Evalute the forces for three particles. | |
| HRESULT | tfPotential_fevalParts4 (struct tfPotentialHandle *handle, struct tfParticleHandleHandle *phi, struct tfParticleHandleHandle *phj, struct tfParticleHandleHandle *phk, struct tfParticleHandleHandle *phl, tfFloatP_t **forcei, tfFloatP_t **forcel) |
| Evalute the forces for four particles. | |
| HRESULT | tfPotential_getConstituents (struct tfPotentialHandle *handle, struct tfPotentialHandle ***chandles, unsigned int *numPots) |
| Get the constituent potentials. | |
| HRESULT | tfPotential_toString (struct tfPotentialHandle *handle, char **str, unsigned int *numChars) |
| Get a JSON string representation. | |
| HRESULT | tfPotential_fromString (struct tfPotentialHandle *handle, const char *str) |
| Create from a JSON string representation. | |
| HRESULT | tfPotential_setClearFcn (struct tfPotentialHandle *handle, struct tfPotentialClearHandle *fcn) |
| Set the clear function. | |
| HRESULT | tfPotential_removeClearFcn (struct tfPotentialHandle *handle) |
| Remove the clear function. | |
| HRESULT | tfPotential_hasClearFcn (struct tfPotentialHandle *handle, bool *hasClear) |
| Test whether a potential has a clear function. | |
| HRESULT | tfPotential_getMin (struct tfPotentialHandle *handle, tfFloatP_t *minR) |
| Get the minimum distance for which a potential is evaluated. | |
| HRESULT | tfPotential_getMax (struct tfPotentialHandle *handle, tfFloatP_t *maxR) |
| Get the maximum distance for which a potential is evaluated. | |
| HRESULT | tfPotential_getBound (struct tfPotentialHandle *handle, bool *bound) |
| Get whether the potential is bound. | |
| HRESULT | tfPotential_setBound (struct tfPotentialHandle *handle, bool bound) |
| Set whether the potential is bound. | |
| HRESULT | tfPotential_getR0 (struct tfPotentialHandle *handle, tfFloatP_t *r0) |
| Get the equilibrium distance of the potential. | |
| HRESULT | tfPotential_setR0 (struct tfPotentialHandle *handle, tfFloatP_t r0) |
| Set the equilibrium distance of the potential. | |
| HRESULT | tfPotential_getRSquare (struct tfPotentialHandle *handle, tfFloatP_t *r2) |
| Get the equilibrium distance of the potential. | |
| HRESULT | tfPotential_getShifted (struct tfPotentialHandle *handle, bool *shifted) |
| Get whether the potential is shifted. | |
| HRESULT | tfPotential_getPeriodic (struct tfPotentialHandle *handle, bool *periodic) |
| Get whether the potential is periodic. | |
| HRESULT | tfPotential_create_lennard_jones_12_6 (struct tfPotentialHandle *handle, tfFloatP_t min, tfFloatP_t max, tfFloatP_t A, tfFloatP_t B, tfFloatP_t *tol) |
| Creates a 12-6 Lennard-Jones potential. | |
| HRESULT | tfPotential_create_lennard_jones_12_6_coulomb (struct tfPotentialHandle *handle, tfFloatP_t min, tfFloatP_t max, tfFloatP_t A, tfFloatP_t B, tfFloatP_t q, tfFloatP_t *tol) |
| Creates a potential of the sum of a 12-6 Lennard-Jones potential and a shifted Coulomb potential. | |
| HRESULT | tfPotential_create_ewald (struct tfPotentialHandle *handle, tfFloatP_t min, tfFloatP_t max, tfFloatP_t q, tfFloatP_t kappa, tfFloatP_t *tol, unsigned int *periodicOrder) |
| Creates a real-space Ewald potential. | |
| HRESULT | tfPotential_create_coulomb (struct tfPotentialHandle *handle, tfFloatP_t q, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol, unsigned int *periodicOrder) |
| Creates a Coulomb potential. | |
| HRESULT | tfPotential_create_coulombR (struct tfPotentialHandle *handle, tfFloatP_t q, tfFloatP_t kappa, tfFloatP_t min, tfFloatP_t max, unsigned int *modes) |
| Creates a Coulomb reciprocal potential. | |
| HRESULT | tfPotential_create_harmonic (struct tfPotentialHandle *handle, tfFloatP_t k, tfFloatP_t r0, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol) |
| Creates a harmonic bond potential. | |
| HRESULT | tfPotential_create_linear (struct tfPotentialHandle *handle, tfFloatP_t k, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol) |
| Creates a linear potential. | |
| HRESULT | tfPotential_create_harmonic_angle (struct tfPotentialHandle *handle, tfFloatP_t k, tfFloatP_t theta0, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol) |
| Creates a harmonic angle potential. | |
| HRESULT | tfPotential_create_harmonic_dihedral (struct tfPotentialHandle *handle, tfFloatP_t k, tfFloatP_t delta, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol) |
| Creates a harmonic dihedral potential. | |
| HRESULT | tfPotential_create_cosine_dihedral (struct tfPotentialHandle *handle, tfFloatP_t k, int n, tfFloatP_t delta, tfFloatP_t *tol) |
| Creates a cosine dihedral potential. | |
| HRESULT | tfPotential_create_well (struct tfPotentialHandle *handle, tfFloatP_t k, tfFloatP_t n, tfFloatP_t r0, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol) |
| Creates a well potential. | |
| HRESULT | tfPotential_create_glj (struct tfPotentialHandle *handle, tfFloatP_t e, tfFloatP_t *m, tfFloatP_t *n, tfFloatP_t *k, tfFloatP_t *r0, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol, bool *shifted) |
| Creates a generalized Lennard-Jones potential. | |
| HRESULT | tfPotential_create_morse (struct tfPotentialHandle *handle, tfFloatP_t *d, tfFloatP_t *a, tfFloatP_t *r0, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol) |
| Creates a Morse potential. | |
| HRESULT | tfPotential_create_overlapping_sphere (struct tfPotentialHandle *handle, tfFloatP_t *mu, tfFloatP_t *kc, tfFloatP_t *kh, tfFloatP_t *r0, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol) |
Creates an overlapping-sphere potential from :cite:Osborne:2017hk. | |
| HRESULT | tfPotential_create_power (struct tfPotentialHandle *handle, tfFloatP_t *k, tfFloatP_t *r0, tfFloatP_t *alpha, tfFloatP_t *min, tfFloatP_t *max, tfFloatP_t *tol) |
| Creates a power potential. | |
| HRESULT | tfPotential_create_dpd (struct tfPotentialHandle *handle, tfFloatP_t *alpha, tfFloatP_t *gamma, tfFloatP_t *sigma, tfFloatP_t *cutoff, bool *shifted) |
| Creates a Dissipative Particle Dynamics potential. | |
| HRESULT | tfPotential_create_custom (struct tfPotentialHandle *handle, tfFloatP_t min, tfFloatP_t max, tfFloatP_t(*f)(tfFloatP_t), tfFloatP_t(*fp)(tfFloatP_t), tfFloatP_t(*f6p)(tfFloatP_t), tfFloatP_t *tol, unsigned int *flags) |
| Creates a custom potential. | |
| HRESULT | tfPotential_create_eval_ByParticle (struct tfPotentialHandle *handle, struct tfPotentialEval_ByParticleHandle *fcn) |
| Create a potential that uses an evaluation function by particle. | |
| HRESULT | tfPotential_create_eval_ByParticles (struct tfPotentialHandle *handle, struct tfPotentialEval_ByParticlesHandle *fcn) |
| Create a potential that uses an evaluation function by two particles. | |
| HRESULT | tfPotential_create_eval_ByParticles3 (struct tfPotentialHandle *handle, struct tfPotentialEval_ByParticles3Handle *fcn) |
| Create a potential that uses an evaluation function by three particles. | |
| HRESULT | tfPotential_create_eval_ByParticles4 (struct tfPotentialHandle *handle, struct tfPotentialEval_ByParticles4Handle *fcn) |
| Create a potential that uses an evaluation function by four particles. | |
| HRESULT | tfPotential_add (struct tfPotentialHandle *handlei, struct tfPotentialHandle *handlej, struct tfPotentialHandle *handleSum) |
| Add two potentials. | |
| HRESULT tfPotential_add | ( | struct tfPotentialHandle * | handlei, |
| struct tfPotentialHandle * | handlej, | ||
| struct tfPotentialHandle * | handleSum ) |
Add two potentials.
| handlei | first potential |
| handlej | second potential |
| handleSum | resulting potential |
| HRESULT tfPotential_create_cosine_dihedral | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | k, | ||
| int | n, | ||
| tfFloatP_t | delta, | ||
| tfFloatP_t * | tol ) |
Creates a cosine dihedral potential.
The cosine dihedral potential has the form:
![\[ k \left( 1 + \cos( n \theta-\delta ) \right)
\]](../../form_36.png)
| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_coulomb | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | q, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol, | ||
| unsigned int * | periodicOrder ) |
Creates a Coulomb potential.
The Coulomb potential has the form:
![\[ \frac{q}{r}
\]](../../form_25.png)
| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_coulombR | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | q, | ||
| tfFloatP_t | kappa, | ||
| tfFloatP_t | min, | ||
| tfFloatP_t | max, | ||
| unsigned int * | modes ) |
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 

| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_custom | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | min, | ||
| tfFloatP_t | max, | ||
| tfFloatP_t(* | f )(tfFloatP_t), | ||
| tfFloatP_t(* | fp )(tfFloatP_t), | ||
| tfFloatP_t(* | f6p )(tfFloatP_t), | ||
| tfFloatP_t * | tol, | ||
| unsigned int * | flags ) |
Creates a custom potential.
| handle | Handle to populate |
| 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. |
| flags | potential flags |
| HRESULT tfPotential_create_dpd | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | alpha, | ||
| tfFloatP_t * | gamma, | ||
| tfFloatP_t * | sigma, | ||
| tfFloatP_t * | cutoff, | ||
| bool * | shifted ) |
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)
| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_eval_ByParticle | ( | struct tfPotentialHandle * | handle, |
| struct tfPotentialEval_ByParticleHandle * | fcn ) |
Create a potential that uses an evaluation function by particle.
| handle | Handle to populate |
| fcn | evaluation function |
| HRESULT tfPotential_create_eval_ByParticles | ( | struct tfPotentialHandle * | handle, |
| struct tfPotentialEval_ByParticlesHandle * | fcn ) |
Create a potential that uses an evaluation function by two particles.
| handle | Handle to populate |
| fcn | evaluation function |
| HRESULT tfPotential_create_eval_ByParticles3 | ( | struct tfPotentialHandle * | handle, |
| struct tfPotentialEval_ByParticles3Handle * | fcn ) |
Create a potential that uses an evaluation function by three particles.
| handle | Handle to populate |
| fcn | evaluation function |
| HRESULT tfPotential_create_eval_ByParticles4 | ( | struct tfPotentialHandle * | handle, |
| struct tfPotentialEval_ByParticles4Handle * | fcn ) |
Create a potential that uses an evaluation function by four particles.
| handle | Handle to populate |
| fcn | evaluation function |
| HRESULT tfPotential_create_ewald | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | min, | ||
| tfFloatP_t | max, | ||
| tfFloatP_t | q, | ||
| tfFloatP_t | kappa, | ||
| tfFloatP_t * | tol, | ||
| unsigned int * | periodicOrder ) |
Creates a real-space Ewald potential.
The Ewald potential has the form:
![\[ q \frac{\mathrm{erfc}\, ( \kappa r)}{r}
\]](../../form_24.png)
| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_glj | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | e, | ||
| tfFloatP_t * | m, | ||
| tfFloatP_t * | n, | ||
| tfFloatP_t * | k, | ||
| tfFloatP_t * | r0, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol, | ||
| bool * | shifted ) |
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)
| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_harmonic | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | k, | ||
| tfFloatP_t | r0, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol ) |
Creates a harmonic bond potential.
The harmonic potential has the form:
![\[ k \left( r-r_0 \right)^2
\]](../../form_29.png)
| handle | Handle to populate |
| 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 ![]() |
| HRESULT tfPotential_create_harmonic_angle | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | k, | ||
| tfFloatP_t | theta0, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol ) |
Creates a harmonic angle potential.
The harmonic angle potential has the form:
![\[ k \left(\theta-\theta_{0} \right)^2
\]](../../form_34.png)
| handle | Handle to populate |
| 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). |
| HRESULT tfPotential_create_harmonic_dihedral | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | k, | ||
| tfFloatP_t | delta, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol ) |
Creates a harmonic dihedral potential.
The harmonic dihedral potential has the form:
![\[ k \left( \theta - \delta \right) ^2
\]](../../form_35.png)
| handle | Handle to populate |
| 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). |
| HRESULT tfPotential_create_lennard_jones_12_6 | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | min, | ||
| tfFloatP_t | max, | ||
| tfFloatP_t | A, | ||
| tfFloatP_t | B, | ||
| tfFloatP_t * | tol ) |
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)
| handle | Handle to populate |
| 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). |
| HRESULT tfPotential_create_lennard_jones_12_6_coulomb | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | min, | ||
| tfFloatP_t | max, | ||
| tfFloatP_t | A, | ||
| tfFloatP_t | B, | ||
| tfFloatP_t | q, | ||
| tfFloatP_t * | tol ) |
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)
| handle | Handle to populate |
| 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). |
| HRESULT tfPotential_create_linear | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | k, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol ) |
Creates a linear potential.
The linear potential has the form:
![\[ k r
\]](../../form_33.png)
| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_morse | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | d, | ||
| tfFloatP_t * | a, | ||
| tfFloatP_t * | r0, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol ) |
Creates a Morse potential.
The Morse potential has the form:
![\[ d \left(1 - e^{ -a \left(r - r_0 \right) } \right)
\]](../../form_39.png)
| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_overlapping_sphere | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | mu, | ||
| tfFloatP_t * | kc, | ||
| tfFloatP_t * | kh, | ||
| tfFloatP_t * | r0, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol ) |
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 






| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_power | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | k, | ||
| tfFloatP_t * | r0, | ||
| tfFloatP_t * | alpha, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol ) |
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 (r-r_0)^{\alpha}
\]](../../form_49.png)
| handle | Handle to populate |
| 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. |
| HRESULT tfPotential_create_well | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | k, | ||
| tfFloatP_t | n, | ||
| tfFloatP_t | r0, | ||
| tfFloatP_t * | min, | ||
| tfFloatP_t * | max, | ||
| tfFloatP_t * | tol ) |
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)
| handle | Handle to populate |
| 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). |
| HRESULT tfPotential_destroy | ( | struct tfPotentialHandle * | handle | ) |
Destroy an instance.
| handle | populated handle |
| HRESULT tfPotential_evalPart | ( | struct tfPotentialHandle * | handle, |
| struct tfParticleHandleHandle * | partHandle, | ||
| tfFloatP_t * | pos, | ||
| tfFloatP_t * | potE ) |
Evaluate the potential for a given particle and position.
| handle | populated handle |
| partHandle | particle |
| pos | position |
| potE | evaluated potential energy |
| HRESULT tfPotential_evalParts2 | ( | struct tfPotentialHandle * | handle, |
| struct tfParticleHandleHandle * | phi, | ||
| struct tfParticleHandleHandle * | phj, | ||
| tfFloatP_t * | potE ) |
Evalute the potential for two particles.
| handle | populated handle |
| phi | first particle |
| phj | second particle |
| potE | evaluated potential energy |
| HRESULT tfPotential_evalParts3 | ( | struct tfPotentialHandle * | handle, |
| struct tfParticleHandleHandle * | phi, | ||
| struct tfParticleHandleHandle * | phj, | ||
| struct tfParticleHandleHandle * | phk, | ||
| tfFloatP_t * | potE ) |
Evalute the potential for three particles.
| handle | populated handle |
| phi | first particle |
| phj | second particle |
| phk | third particle |
| potE | evaluated potential energy |
| HRESULT tfPotential_evalParts4 | ( | struct tfPotentialHandle * | handle, |
| struct tfParticleHandleHandle * | phi, | ||
| struct tfParticleHandleHandle * | phj, | ||
| struct tfParticleHandleHandle * | phk, | ||
| struct tfParticleHandleHandle * | phl, | ||
| tfFloatP_t * | potE ) |
Evalute the potential for four particles.
| handle | populated handle |
| phi | first particle |
| phj | second particle |
| phk | third particle |
| phl | fourth particle |
| potE | evaluated potential energy |
| HRESULT tfPotential_evalPos | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | pos, | ||
| tfFloatP_t * | potE ) |
Evaluate the potential for a given position.
| handle | populated handle |
| pos | position |
| potE | evaluated potential energy |
| HRESULT tfPotential_evalR | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | r, | ||
| tfFloatP_t * | potE ) |
Evaluate the potential.
| handle | populated handle |
| r | distance |
| potE | evaluated potential energy |
| HRESULT tfPotential_evalR0 | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | r, | ||
| tfFloatP_t | r0, | ||
| tfFloatP_t * | potE ) |
Evaluate the potential for a given scaling distance.
| handle | populated handle |
| r | distance |
| r0 | scaling distance |
| potE | evaluated potential energy |
| HRESULT tfPotential_fevalPart | ( | struct tfPotentialHandle * | handle, |
| struct tfParticleHandleHandle * | partHandle, | ||
| tfFloatP_t * | pos, | ||
| tfFloatP_t ** | force ) |
Evaluate the force for a given particle and position.
| handle | populated handle |
| partHandle | particle |
| pos | position |
| force | evaluated force |
| HRESULT tfPotential_fevalParts2 | ( | struct tfPotentialHandle * | handle, |
| struct tfParticleHandleHandle * | phi, | ||
| struct tfParticleHandleHandle * | phj, | ||
| tfFloatP_t ** | force ) |
Evalute the force for two particles.
| handle | populated handle |
| phi | first particle |
| phj | second particle |
| force | evaluated force |
| HRESULT tfPotential_fevalParts3 | ( | struct tfPotentialHandle * | handle, |
| struct tfParticleHandleHandle * | phi, | ||
| struct tfParticleHandleHandle * | phj, | ||
| struct tfParticleHandleHandle * | phk, | ||
| tfFloatP_t ** | forcei, | ||
| tfFloatP_t ** | forcek ) |
Evalute the forces for three particles.
| handle | populated handle |
| phi | first particle |
| phj | second particle |
| phk | third particle |
| forcei | evaluated force on phi |
| forcek | evaluated force on phk |
| HRESULT tfPotential_fevalParts4 | ( | struct tfPotentialHandle * | handle, |
| struct tfParticleHandleHandle * | phi, | ||
| struct tfParticleHandleHandle * | phj, | ||
| struct tfParticleHandleHandle * | phk, | ||
| struct tfParticleHandleHandle * | phl, | ||
| tfFloatP_t ** | forcei, | ||
| tfFloatP_t ** | forcel ) |
Evalute the forces for four particles.
| handle | populated handle |
| phi | first particle |
| phj | second particle |
| phk | third particle |
| phl | fourth particle |
| forcei | evaluated force on phi |
| forcel | evaluated force on phl |
| HRESULT tfPotential_fevalPos | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | pos, | ||
| tfFloatP_t ** | force ) |
Evaluate the force for a given position.
| handle | populated handle |
| pos | position |
| force | evaluated force |
| HRESULT tfPotential_fevalR | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | r, | ||
| tfFloatP_t * | force ) |
Evaluate the force.
| handle | populated handle |
| r | distance |
| force | evaluated force |
| HRESULT tfPotential_fevalR0 | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | r, | ||
| tfFloatP_t | r0, | ||
| tfFloatP_t * | force ) |
Evaluate the force for a given scaling distance.
| handle | populated handle |
| r | distance |
| r0 | scaling distance |
| force | evaluated force |
| HRESULT tfPotential_fromString | ( | struct tfPotentialHandle * | handle, |
| const char * | str ) |
Create from a JSON string representation.
| HRESULT tfPotential_getBound | ( | struct tfPotentialHandle * | handle, |
| bool * | bound ) |
Get whether the potential is bound.
| handle | populated handle |
| bound | flag signifying whether the potential is bound |
| HRESULT tfPotential_getConstituents | ( | struct tfPotentialHandle * | handle, |
| struct tfPotentialHandle *** | chandles, | ||
| unsigned int * | numPots ) |
Get the constituent potentials.
| handle | populated handle |
| chandles | constituent potentials |
| numPots | number of constituent potentials |
| HRESULT tfPotential_getFlags | ( | struct tfPotentialHandle * | handle, |
| unsigned int * | flags ) |
Get the flags of the potential.
| handle | populated handle |
| flags | potential flags |
| HRESULT tfPotential_getKind | ( | struct tfPotentialHandle * | handle, |
| unsigned int * | kind ) |
Get the kind of the potential.
| handle | populated handle |
| kind | potential kind enum |
| HRESULT tfPotential_getMax | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | maxR ) |
Get the maximum distance for which a potential is evaluated.
| handle | populated handle |
| maxR | maximum distance |
| HRESULT tfPotential_getMin | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | minR ) |
Get the minimum distance for which a potential is evaluated.
| handle | populated handle |
| minR | minimum distance |
| HRESULT tfPotential_getName | ( | struct tfPotentialHandle * | handle, |
| char ** | name, | ||
| unsigned int * | numChars ) |
Get the name of the potential.
| handle | populated handle |
| name | name |
| numChars | number of characters |
| HRESULT tfPotential_getPeriodic | ( | struct tfPotentialHandle * | handle, |
| bool * | periodic ) |
Get whether the potential is periodic.
| handle | populated handle |
| periodic | flag signifying whether the potential is periodic |
| HRESULT tfPotential_getR0 | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | r0 ) |
Get the equilibrium distance of the potential.
| handle | populated handle |
| r0 | equilibrium distance |
| HRESULT tfPotential_getRSquare | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t * | r2 ) |
Get the equilibrium distance of the potential.
| handle | populated handle |
| r2 | squared equilibrium distance |
| HRESULT tfPotential_getShifted | ( | struct tfPotentialHandle * | handle, |
| bool * | shifted ) |
Get whether the potential is shifted.
| handle | populated handle |
| shifted | flag signifying whether the potential is shifted |
| HRESULT tfPotential_hasClearFcn | ( | struct tfPotentialHandle * | handle, |
| bool * | hasClear ) |
Test whether a potential has a clear function.
| handle | populate handle |
| hasClear | flag signifying whether a potential has a clear function |
| HRESULT tfPotential_removeClearFcn | ( | struct tfPotentialHandle * | handle | ) |
Remove the clear function.
| handle | populate handle |
| HRESULT tfPotential_setBound | ( | struct tfPotentialHandle * | handle, |
| bool | bound ) |
Set whether the potential is bound.
| handle | populated handle |
| bound | flag signifying whether the potential is bound |
| HRESULT tfPotential_setClearFcn | ( | struct tfPotentialHandle * | handle, |
| struct tfPotentialClearHandle * | fcn ) |
Set the clear function.
| handle | populated handle |
| fcn | clear function |
| HRESULT tfPotential_setFlags | ( | struct tfPotentialHandle * | handle, |
| unsigned int | flags ) |
Set the flags of the potential.
| handle | populated handle |
| flags | potential flags |
| HRESULT tfPotential_setName | ( | struct tfPotentialHandle * | handle, |
| const char * | name ) |
Set the name of the potential.
| handle | populated handle |
| name | name |
| HRESULT tfPotential_setR0 | ( | struct tfPotentialHandle * | handle, |
| tfFloatP_t | r0 ) |
Set the equilibrium distance of the potential.
| handle | populated handle |
| r0 | equilibrium distance |
| HRESULT tfPotential_toString | ( | struct tfPotentialHandle * | handle, |
| char ** | str, | ||
| unsigned int * | numChars ) |
Get a JSON string representation.
| handle | populated handle |
| str | string representation |
| numChars | number of characters of string representation |
| HRESULT tfPotentialClear_destroy | ( | struct tfPotentialClearHandle * | handle | ) |
Destroy an instance.
| handle | populated handle |
| HRESULT tfPotentialClear_init | ( | struct tfPotentialClearHandle * | handle, |
| tfPotentialClearHandleFcn * | fcn ) |
Initialize an instance.
| handle | handle to populate |
| fcn | evaluation function |
| HRESULT tfPotentialEval_ByParticle_destroy | ( | struct tfPotentialEval_ByParticleHandle * | handle | ) |
Destroy an instance.
| handle | populated handle |
| HRESULT tfPotentialEval_ByParticle_init | ( | struct tfPotentialEval_ByParticleHandle * | handle, |
| tfPotentialEval_ByParticleHandleFcn * | fcn ) |
Initialize an instance.
| handle | handle to populate |
| fcn | evaluation function |
| HRESULT tfPotentialEval_ByParticles3_destroy | ( | struct tfPotentialEval_ByParticles3Handle * | handle | ) |
Destroy an instance.
| handle | populated handle |
| HRESULT tfPotentialEval_ByParticles3_init | ( | struct tfPotentialEval_ByParticles3Handle * | handle, |
| tfPotentialEval_ByParticles3HandleFcn * | fcn ) |
Initialize an instance.
| handle | handle to populate |
| fcn | evaluation function |
| HRESULT tfPotentialEval_ByParticles4_destroy | ( | struct tfPotentialEval_ByParticles4Handle * | handle | ) |
Destroy an instance.
| handle | populated handle |
| HRESULT tfPotentialEval_ByParticles4_init | ( | struct tfPotentialEval_ByParticles4Handle * | handle, |
| tfPotentialEval_ByParticles4HandleFcn * | fcn ) |
Initialize an instance.
| handle | handle to populate |
| fcn | evaluation function |
| HRESULT tfPotentialEval_ByParticles_destroy | ( | struct tfPotentialEval_ByParticlesHandle * | handle | ) |
Destroy an instance.
| handle | populated handle |
| HRESULT tfPotentialEval_ByParticles_init | ( | struct tfPotentialEval_ByParticlesHandle * | handle, |
| tfPotentialEval_ByParticlesHandleFcn * | fcn ) |
Initialize an instance.
| handle | handle to populate |
| fcn | evaluation function |
| HRESULT tfPotentialFlags_init | ( | struct tfPotentialFlagsHandle * | handle | ) |
Initialize an instance.
| handle | handle to populate |
| HRESULT tfPotentialKind_init | ( | struct tfPotentialKindHandle * | handle | ) |
Initialize an instance.
| handle | handle to populate |