Tissue Forge C 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfCPotential.h File Reference
#include "tf_port_c.h"
Include dependency graph for tfCPotential.h:
This graph shows which files directly or indirectly include this file:

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.
 

Function Documentation

◆ tfPotential_add()

HRESULT tfPotential_add ( struct tfPotentialHandle * handlei,
struct tfPotentialHandle * handlej,
struct tfPotentialHandle * handleSum )

Add two potentials.

Parameters
handleifirst potential
handlejsecond potential
handleSumresulting potential
Returns
S_OK on success

◆ tfPotential_create_cosine_dihedral()

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)

\]

Parameters
handleHandle to populate
kenergy of the dihedral.
nmultiplicity of the dihedral.
deltaminimum energy dihedral.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.01.
Returns
HRESULT

◆ tfPotential_create_coulomb()

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}

\]

Parameters
handleHandle to populate
qThe charge scaling of the potential.
minThe smallest radius for which the potential will be constructed. Default is 0.01.
maxThe largest radius for which the potential will be constructed. Default is 2.0.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min).
periodicOrderOrder of lattice periodicity along all periodic dimensions. Defaults to 0.
Returns
HRESULT

◆ tfPotential_create_coulombR()

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)

\]

Here $ V $ is the volume of the domain and $ \mathbf{m} $ is a reciprocal vector of the domain.

Parameters
handleHandle to populate
qCharge scaling of the potential.
kappaScreening distance.
minSmallest radius for which the potential will be constructed.
maxLargest radius for which the potential will be constructed.
modesNumber of Fourier modes along each periodic dimension. Default is 1.
Returns
HRESULT

◆ tfPotential_create_custom()

HRESULT tfPotential_create_custom ( struct tfPotentialHandle * handle,
tfFloatP_t min,
tfFloatP_t max,
tfFloatP_t(*)(tfFloatP_t) f,
tfFloatP_t(*)(tfFloatP_t) fp,
tfFloatP_t(*)(tfFloatP_t) f6p,
tfFloatP_t * tol,
unsigned int * flags )

Creates a custom potential.

Parameters
handleHandle to populate
minThe smallest radius for which the potential will be constructed.
maxThe largest radius for which the potential will be constructed.
ffunction returning the value of the potential
fpfunction returning the value of first derivative of the potential
f6pfunction returning the value of sixth derivative of the potential
tolTolerance, defaults to 0.001.
flagspotential flags
Returns
HRESULT

◆ tfPotential_create_dpd()

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}

\]

The conservative force is:

\[

     \mathbf{F}^C_{ij} = \alpha \left(1 - \frac{r_{ij}}{r_c}\right) \mathbf{e}_{ij}

\]

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}

\]

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}

\]

Parameters
handleHandle to populate
alphainteraction strength of the conservative force. Defaults to 1.0.
gammainteraction strength of dissapative force. Defaults to 1.0.
sigmastrength of random force. Defaults to 1.0.
cutoffcutoff distance. Defaults to 1.0.
shiftedFlag for whether using a shifted potential. Defaults to false.
Returns
HRESULT

◆ tfPotential_create_eval_ByParticle()

HRESULT tfPotential_create_eval_ByParticle ( struct tfPotentialHandle * handle,
struct tfPotentialEval_ByParticleHandle * fcn )

Create a potential that uses an evaluation function by particle.

Parameters
handleHandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotential_create_eval_ByParticles()

HRESULT tfPotential_create_eval_ByParticles ( struct tfPotentialHandle * handle,
struct tfPotentialEval_ByParticlesHandle * fcn )

Create a potential that uses an evaluation function by two particles.

Parameters
handleHandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotential_create_eval_ByParticles3()

HRESULT tfPotential_create_eval_ByParticles3 ( struct tfPotentialHandle * handle,
struct tfPotentialEval_ByParticles3Handle * fcn )

Create a potential that uses an evaluation function by three particles.

Parameters
handleHandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotential_create_eval_ByParticles4()

HRESULT tfPotential_create_eval_ByParticles4 ( struct tfPotentialHandle * handle,
struct tfPotentialEval_ByParticles4Handle * fcn )

Create a potential that uses an evaluation function by four particles.

Parameters
handleHandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotential_create_ewald()

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}

\]

Parameters
handleHandle to populate
minThe smallest radius for which the potential will be constructed.
maxThe largest radius for which the potential will be constructed.
qThe charge scaling of the potential.
kappaThe screening distance of the Ewald potential.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min).
periodicOrderOrder of lattice periodicity along all periodic dimensions. Defaults to 0.
Returns
HRESULT

◆ tfPotential_create_glj()

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]

\]

Parameters
handleHandle to populate
eeffective energy of the potential.
morder of potential. Defaults to 3
norder of potential. Defaults to 2*m.
kmimumum of the potential. Defaults to 1.
r0mimumum of the potential. Defaults to 1.
minThe smallest radius for which the potential will be constructed. Defaults to 0.05 * r0.
maxThe largest radius for which the potential will be constructed. Defaults to 5 * r0.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.01.
shiftedFlag for whether using a shifted potential. Defaults to true.
Returns
HRESULT

◆ tfPotential_create_harmonic()

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

\]

Parameters
handleHandle to populate
kThe energy of the bond.
r0The bond rest length.
minThe smallest radius for which the potential will be constructed. Defaults to $ r_0 - r_0 / 2 $.
maxThe largest radius for which the potential will be constructed. Defaults to $ r_0 + r_0 /2 $.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to $ 0.01 \abs(max-min) $.
Returns
HRESULT

◆ tfPotential_create_harmonic_angle()

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

\]

Parameters
handleHandle to populate
kThe energy of the angle.
theta0The minimum energy angle.
minThe smallest angle for which the potential will be constructed. Defaults to zero.
maxThe largest angle for which the potential will be constructed. Defaults to PI.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.005 * (max - min).
Returns
HRESULT

◆ tfPotential_create_harmonic_dihedral()

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

\]

Parameters
handleHandle to populate
kenergy of the dihedral.
deltaminimum energy dihedral.
minThe smallest angle for which the potential will be constructed. Defaults to zero.
maxThe largest angle for which the potential will be constructed. Defaults to PI.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.005 * (max - min).
Returns
HRESULT

◆ tfPotential_create_lennard_jones_12_6()

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) 

\]

Parameters
handleHandle to populate
minThe smallest radius for which the potential will be constructed.
maxThe largest radius for which the potential will be constructed.
AThe first parameter of the Lennard-Jones potential.
BThe second parameter of the Lennard-Jones potential.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min).
Returns
HRESULT

◆ tfPotential_create_lennard_jones_12_6_coulomb()

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)

\]

Parameters
handleHandle to populate
minThe smallest radius for which the potential will be constructed.
maxThe largest radius for which the potential will be constructed.
AThe first parameter of the Lennard-Jones potential.
BThe second parameter of the Lennard-Jones potential.
qThe charge scaling of the potential.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min).
Returns
HRESULT

◆ tfPotential_create_linear()

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

\]

Parameters
handleHandle to populate
kinteraction strength; represents the potential energy peak value.
minThe smallest radius for which the potential will be constructed. Defaults to 0.0.
maxThe largest radius for which the potential will be constructed. Defaults to 10.0.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.001.
Returns
HRESULT

◆ tfPotential_create_morse()

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)

\]

Parameters
handleHandle to populate
dwell depth. Defaults to 1.0.
apotential width. Defaults to 6.0.
r0equilibrium distance. Defaults to 0.0.
minThe smallest radius for which the potential will be constructed. Defaults to 0.0001.
maxThe largest radius for which the potential will be constructed. Defaults to 3.0.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.001.
Returns
HRESULT

◆ tfPotential_create_overlapping_sphere()

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) ,
\]

\[
     \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} ,
\]

\[
     0 \text{ otherwise} .
\]

Osborne refers to $ \mu_{ij} $ as a "spring constant", this controls the size of the force, and is the potential energy peak value. $ \hat{\mathbf{r}}_{ij} $ is the unit vector from particle $ i $ center to particle $ j $ center, $ k_C $ is a parameter that defines decay of the attractive force. Larger values of $ k_C $ result in a shaper peaked attraction, and thus a shorter ranged force. $ s_{ij}(t) $ is the is the sum of the radii of the two particles.

Parameters
handleHandle to populate
muinteraction strength, represents the potential energy peak value. Defaults to 1.0.
kcdecay strength of long range attraction. Larger values make a shorter ranged function. Defaults to 1.0.
khOptionally add a harmonic long-range attraction, same as :meth:glj function. Defaults to 0.0.
r0Optional harmonic rest length, only used if kh is non-zero. Defaults to 0.0.
minThe smallest radius for which the potential will be constructed. Defaults to 0.001.
maxThe largest radius for which the potential will be constructed. Defaults to 10.0.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.001.
Returns
HRESULT

◆ tfPotential_create_power()

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}

\]

Parameters
handleHandle to populate
kinteraction strength, represents the potential energy peak value. Defaults to 1
r0potential rest length, zero of the potential, defaults to 0.
alphaExponent, defaults to 1.
minminimal value potential is computed for, defaults to r0 / 2.
maxcutoff distance, defaults to 3 * r0.
tolTolerance, defaults to 0.01.
Returns
HRESULT

◆ tfPotential_create_well()

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}}

\]

Parameters
handleHandle to populate
kpotential prefactor constant, should be decreased for larger n.
nexponent of the potential, larger n makes a sharper potential.
r0The extents of the potential, length units. Represents the maximum extents that a two objects connected with this potential should come apart.
minThe smallest radius for which the potential will be constructed. Defaults to zero.
maxThe largest radius for which the potential will be constructed. Defaults to r0.
tolThe tolerance to which the interpolation should match the exact potential. Defaults to 0.01 * abs(min-max).
Returns
HRESULT

◆ tfPotential_destroy()

HRESULT tfPotential_destroy ( struct tfPotentialHandle * handle)

Destroy an instance.

Parameters
handlepopulated handle
Returns
S_OK on success

◆ tfPotential_evalPart()

HRESULT tfPotential_evalPart ( struct tfPotentialHandle * handle,
struct tfParticleHandleHandle * partHandle,
tfFloatP_t * pos,
tfFloatP_t * potE )

Evaluate the potential for a given particle and position.

Parameters
handlepopulated handle
partHandleparticle
posposition
potEevaluated potential energy
Returns
S_OK on success

◆ tfPotential_evalParts2()

HRESULT tfPotential_evalParts2 ( struct tfPotentialHandle * handle,
struct tfParticleHandleHandle * phi,
struct tfParticleHandleHandle * phj,
tfFloatP_t * potE )

Evalute the potential for two particles.

Parameters
handlepopulated handle
phifirst particle
phjsecond particle
potEevaluated potential energy
Returns
S_OK on success

◆ tfPotential_evalParts3()

HRESULT tfPotential_evalParts3 ( struct tfPotentialHandle * handle,
struct tfParticleHandleHandle * phi,
struct tfParticleHandleHandle * phj,
struct tfParticleHandleHandle * phk,
tfFloatP_t * potE )

Evalute the potential for three particles.

Parameters
handlepopulated handle
phifirst particle
phjsecond particle
phkthird particle
potEevaluated potential energy
Returns
S_OK on success

◆ tfPotential_evalParts4()

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.

Parameters
handlepopulated handle
phifirst particle
phjsecond particle
phkthird particle
phlfourth particle
potEevaluated potential energy
Returns
S_OK on success

◆ tfPotential_evalPos()

HRESULT tfPotential_evalPos ( struct tfPotentialHandle * handle,
tfFloatP_t * pos,
tfFloatP_t * potE )

Evaluate the potential for a given position.

Parameters
handlepopulated handle
posposition
potEevaluated potential energy
Returns
S_OK on success

◆ tfPotential_evalR()

HRESULT tfPotential_evalR ( struct tfPotentialHandle * handle,
tfFloatP_t r,
tfFloatP_t * potE )

Evaluate the potential.

Parameters
handlepopulated handle
rdistance
potEevaluated potential energy
Returns
S_OK on success

◆ tfPotential_evalR0()

HRESULT tfPotential_evalR0 ( struct tfPotentialHandle * handle,
tfFloatP_t r,
tfFloatP_t r0,
tfFloatP_t * potE )

Evaluate the potential for a given scaling distance.

Parameters
handlepopulated handle
rdistance
r0scaling distance
potEevaluated potential energy
Returns
S_OK on success

◆ tfPotential_fevalPart()

HRESULT tfPotential_fevalPart ( struct tfPotentialHandle * handle,
struct tfParticleHandleHandle * partHandle,
tfFloatP_t * pos,
tfFloatP_t ** force )

Evaluate the force for a given particle and position.

Parameters
handlepopulated handle
partHandleparticle
posposition
forceevaluated force
Returns
S_OK on success

◆ tfPotential_fevalParts2()

HRESULT tfPotential_fevalParts2 ( struct tfPotentialHandle * handle,
struct tfParticleHandleHandle * phi,
struct tfParticleHandleHandle * phj,
tfFloatP_t ** force )

Evalute the force for two particles.

Parameters
handlepopulated handle
phifirst particle
phjsecond particle
forceevaluated force
Returns
S_OK on success

◆ tfPotential_fevalParts3()

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.

Parameters
handlepopulated handle
phifirst particle
phjsecond particle
phkthird particle
forceievaluated force on phi
forcekevaluated force on phk
Returns
S_OK on success

◆ tfPotential_fevalParts4()

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.

Parameters
handlepopulated handle
phifirst particle
phjsecond particle
phkthird particle
phlfourth particle
forceievaluated force on phi
forcelevaluated force on phl
Returns
S_OK on success

◆ tfPotential_fevalPos()

HRESULT tfPotential_fevalPos ( struct tfPotentialHandle * handle,
tfFloatP_t * pos,
tfFloatP_t ** force )

Evaluate the force for a given position.

Parameters
handlepopulated handle
posposition
forceevaluated force
Returns
S_OK on success

◆ tfPotential_fevalR()

HRESULT tfPotential_fevalR ( struct tfPotentialHandle * handle,
tfFloatP_t r,
tfFloatP_t * force )

Evaluate the force.

Parameters
handlepopulated handle
rdistance
forceevaluated force
Returns
S_OK on success

◆ tfPotential_fevalR0()

HRESULT tfPotential_fevalR0 ( struct tfPotentialHandle * handle,
tfFloatP_t r,
tfFloatP_t r0,
tfFloatP_t * force )

Evaluate the force for a given scaling distance.

Parameters
handlepopulated handle
rdistance
r0scaling distance
forceevaluated force
Returns
S_OK on success

◆ tfPotential_fromString()

HRESULT tfPotential_fromString ( struct tfPotentialHandle * handle,
const char * str )

Create from a JSON string representation.

Returns
S_OK on success

◆ tfPotential_getBound()

HRESULT tfPotential_getBound ( struct tfPotentialHandle * handle,
bool * bound )

Get whether the potential is bound.

Parameters
handlepopulated handle
boundflag signifying whether the potential is bound
Returns
S_OK on success

◆ tfPotential_getConstituents()

HRESULT tfPotential_getConstituents ( struct tfPotentialHandle * handle,
struct tfPotentialHandle *** chandles,
unsigned int * numPots )

Get the constituent potentials.

Parameters
handlepopulated handle
chandlesconstituent potentials
numPotsnumber of constituent potentials
Returns
S_OK on success

◆ tfPotential_getFlags()

HRESULT tfPotential_getFlags ( struct tfPotentialHandle * handle,
unsigned int * flags )

Get the flags of the potential.

Parameters
handlepopulated handle
flagspotential flags
Returns
S_OK on success

◆ tfPotential_getKind()

HRESULT tfPotential_getKind ( struct tfPotentialHandle * handle,
unsigned int * kind )

Get the kind of the potential.

Parameters
handlepopulated handle
kindpotential kind enum
Returns
S_OK on success

◆ tfPotential_getMax()

HRESULT tfPotential_getMax ( struct tfPotentialHandle * handle,
tfFloatP_t * maxR )

Get the maximum distance for which a potential is evaluated.

Parameters
handlepopulated handle
maxRmaximum distance
Returns
S_OK on success

◆ tfPotential_getMin()

HRESULT tfPotential_getMin ( struct tfPotentialHandle * handle,
tfFloatP_t * minR )

Get the minimum distance for which a potential is evaluated.

Parameters
handlepopulated handle
minRminimum distance
Returns
S_OK on success

◆ tfPotential_getName()

HRESULT tfPotential_getName ( struct tfPotentialHandle * handle,
char ** name,
unsigned int * numChars )

Get the name of the potential.

Parameters
handlepopulated handle
namename
numCharsnumber of characters
Returns
S_OK on success

◆ tfPotential_getPeriodic()

HRESULT tfPotential_getPeriodic ( struct tfPotentialHandle * handle,
bool * periodic )

Get whether the potential is periodic.

Parameters
handlepopulated handle
periodicflag signifying whether the potential is periodic
Returns
S_OK on success

◆ tfPotential_getR0()

HRESULT tfPotential_getR0 ( struct tfPotentialHandle * handle,
tfFloatP_t * r0 )

Get the equilibrium distance of the potential.

Parameters
handlepopulated handle
r0equilibrium distance
Returns
S_OK on success

◆ tfPotential_getRSquare()

HRESULT tfPotential_getRSquare ( struct tfPotentialHandle * handle,
tfFloatP_t * r2 )

Get the equilibrium distance of the potential.

Parameters
handlepopulated handle
r2squared equilibrium distance
Returns
S_OK on success

◆ tfPotential_getShifted()

HRESULT tfPotential_getShifted ( struct tfPotentialHandle * handle,
bool * shifted )

Get whether the potential is shifted.

Parameters
handlepopulated handle
shiftedflag signifying whether the potential is shifted
Returns
S_OK on success

◆ tfPotential_hasClearFcn()

HRESULT tfPotential_hasClearFcn ( struct tfPotentialHandle * handle,
bool * hasClear )

Test whether a potential has a clear function.

Parameters
handlepopulate handle
hasClearflag signifying whether a potential has a clear function
Returns
S_OK on success

◆ tfPotential_removeClearFcn()

HRESULT tfPotential_removeClearFcn ( struct tfPotentialHandle * handle)

Remove the clear function.

Parameters
handlepopulate handle
Returns
S_OK on success

◆ tfPotential_setBound()

HRESULT tfPotential_setBound ( struct tfPotentialHandle * handle,
bool bound )

Set whether the potential is bound.

Parameters
handlepopulated handle
boundflag signifying whether the potential is bound
Returns
S_OK on success

◆ tfPotential_setClearFcn()

HRESULT tfPotential_setClearFcn ( struct tfPotentialHandle * handle,
struct tfPotentialClearHandle * fcn )

Set the clear function.

Parameters
handlepopulated handle
fcnclear function
Returns
S_OK on success

◆ tfPotential_setFlags()

HRESULT tfPotential_setFlags ( struct tfPotentialHandle * handle,
unsigned int flags )

Set the flags of the potential.

Parameters
handlepopulated handle
flagspotential flags
Returns
S_OK on success

◆ tfPotential_setName()

HRESULT tfPotential_setName ( struct tfPotentialHandle * handle,
const char * name )

Set the name of the potential.

Parameters
handlepopulated handle
namename
Returns
S_OK on success

◆ tfPotential_setR0()

HRESULT tfPotential_setR0 ( struct tfPotentialHandle * handle,
tfFloatP_t r0 )

Set the equilibrium distance of the potential.

Parameters
handlepopulated handle
r0equilibrium distance
Returns
S_OK on success

◆ tfPotential_toString()

HRESULT tfPotential_toString ( struct tfPotentialHandle * handle,
char ** str,
unsigned int * numChars )

Get a JSON string representation.

Parameters
handlepopulated handle
strstring representation
numCharsnumber of characters of string representation

◆ tfPotentialClear_destroy()

HRESULT tfPotentialClear_destroy ( struct tfPotentialClearHandle * handle)

Destroy an instance.

Parameters
handlepopulated handle
Returns
S_OK on success

◆ tfPotentialClear_init()

HRESULT tfPotentialClear_init ( struct tfPotentialClearHandle * handle,
tfPotentialClearHandleFcn * fcn )

Initialize an instance.

Parameters
handlehandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotentialEval_ByParticle_destroy()

HRESULT tfPotentialEval_ByParticle_destroy ( struct tfPotentialEval_ByParticleHandle * handle)

Destroy an instance.

Parameters
handlepopulated handle
Returns
S_OK on success

◆ tfPotentialEval_ByParticle_init()

HRESULT tfPotentialEval_ByParticle_init ( struct tfPotentialEval_ByParticleHandle * handle,
tfPotentialEval_ByParticleHandleFcn * fcn )

Initialize an instance.

Parameters
handlehandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotentialEval_ByParticles3_destroy()

HRESULT tfPotentialEval_ByParticles3_destroy ( struct tfPotentialEval_ByParticles3Handle * handle)

Destroy an instance.

Parameters
handlepopulated handle
Returns
S_OK on success

◆ tfPotentialEval_ByParticles3_init()

HRESULT tfPotentialEval_ByParticles3_init ( struct tfPotentialEval_ByParticles3Handle * handle,
tfPotentialEval_ByParticles3HandleFcn * fcn )

Initialize an instance.

Parameters
handlehandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotentialEval_ByParticles4_destroy()

HRESULT tfPotentialEval_ByParticles4_destroy ( struct tfPotentialEval_ByParticles4Handle * handle)

Destroy an instance.

Parameters
handlepopulated handle
Returns
S_OK on success

◆ tfPotentialEval_ByParticles4_init()

HRESULT tfPotentialEval_ByParticles4_init ( struct tfPotentialEval_ByParticles4Handle * handle,
tfPotentialEval_ByParticles4HandleFcn * fcn )

Initialize an instance.

Parameters
handlehandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotentialEval_ByParticles_destroy()

HRESULT tfPotentialEval_ByParticles_destroy ( struct tfPotentialEval_ByParticlesHandle * handle)

Destroy an instance.

Parameters
handlepopulated handle
Returns
S_OK on success

◆ tfPotentialEval_ByParticles_init()

HRESULT tfPotentialEval_ByParticles_init ( struct tfPotentialEval_ByParticlesHandle * handle,
tfPotentialEval_ByParticlesHandleFcn * fcn )

Initialize an instance.

Parameters
handlehandle to populate
fcnevaluation function
Returns
S_OK on success

◆ tfPotentialFlags_init()

HRESULT tfPotentialFlags_init ( struct tfPotentialFlagsHandle * handle)

Initialize an instance.

Parameters
handlehandle to populate
Returns
S_OK on success

◆ tfPotentialKind_init()

HRESULT tfPotentialKind_init ( struct tfPotentialKindHandle * handle)

Initialize an instance.

Parameters
handlehandle to populate
Returns
S_OK on success