mdcore
0.1.5
|
Go to the source code of this file.
Data Structures | |
struct | potential |
Defines | |
#define | potential_err_ok 0 |
#define | potential_err_null -1 |
#define | potential_err_malloc -2 |
#define | potential_err_bounds -3 |
#define | potential_err_nyi -4 |
#define | potential_err_ivalsmax -5 |
#define | potential_degree 5 |
#define | potential_chunk (potential_degree+3) |
#define | potential_ivalsa 1 |
#define | potential_ivalsb 10 |
#define | potential_N 100 |
#define | potential_align 64 |
#define | potential_align 64 |
#define | potential_ivalsmax 320 |
#define | potential_escale (0.079577471545947667882) |
#define | potential_flag_none 0 |
#define | potential_flag_LJ126 1 |
#define | potential_flag_Ewald 2 |
#define | potential_flag_Coulomb 4 |
#define | potential_flag_single 6 |
Functions | |
void | potential_clear (struct potential *p) |
Free the memory associated with the given potential. | |
int | potential_init (struct potential *p, double(*f)(double), double(*fp)(double), double(*f6p)(double), FPTYPE a, FPTYPE b, FPTYPE tol) |
Construct a potential from the given function. | |
int | potential_getcoeffs (double(*f)(double), double(*fp)(double), FPTYPE *xi, int n, FPTYPE *c, FPTYPE *err) |
Compute the interpolation coefficients over a given set of nodes. | |
double | potential_getalpha (double(*f6p)(double), double a, double b) |
Compute the parameter for the optimal node distribution. | |
struct potential * | potential_create_LJ126 (double a, double b, double A, double B, double tol) |
Creates a potential representing a 12-6 Lennard-Jones potential. | |
struct potential * | potential_create_LJ126_Ewald (double a, double b, double A, double B, double q, double kappa, double tol) |
Creates a potential representing the sum of a 12-6 Lennard-Jones potential and the real-space part of an Ewald potential. | |
struct potential * | potential_create_LJ126_Coulomb (double a, double b, double A, double B, double q, double tol) |
Creates a potential representing the sum of a 12-6 Lennard-Jones potential and a shifted Coulomb potential. | |
struct potential * | potential_create_Ewald (double a, double b, double q, double kappa, double tol) |
Creates a potential representing the real-space part of an Ewald potential. | |
struct potential * | potential_create_Coulomb (double a, double b, double q, double tol) |
Creates a potential representing a shifted Coulomb potential. | |
struct potential * | potential_create_harmonic (double a, double b, double K, double r0, double tol) |
Creates a harmonic bond potential. | |
struct potential * | potential_create_harmonic_angle (double a, double b, double K, double theta0, double tol) |
Creates a harmonic angle potential. | |
struct potential * | potential_create_harmonic_dihedral (double K, int n, double delta, double tol) |
Creates a harmonic dihedral potential. | |
double | potential_LJ126 (double r, double A, double B) |
A basic 12-6 Lennard-Jones potential. | |
double | potential_LJ126_p (double r, double A, double B) |
A basic 12-6 Lennard-Jones potential (first derivative). | |
double | potential_LJ126_6p (double r, double A, double B) |
A basic 12-6 Lennard-Jones potential (sixth derivative). | |
double | potential_Ewald (double r, double kappa) |
The short-range part of an Ewald summation. | |
double | potential_Ewald_p (double r, double kappa) |
The short-range part of an Ewald summation (first derivative). | |
double | potential_Ewald_6p (double r, double kappa) |
The short-range part of an Ewald summation (sixth derivative). | |
double | potential_Coulomb (double r) |
The Coulomb potential. | |
double | potential_Coulomb_p (double r) |
The Coulomb potential (first derivative). | |
double | potential_Coulomb_6p (double r) |
TheCoulomb potential (sixth derivative). | |
Variables | |
int | potential_err |
struct potential | potential_null |
#define potential_align 64 |
#define potential_align 64 |
#define potential_chunk (potential_degree+3) |
#define potential_degree 5 |
#define potential_err_bounds -3 |
#define potential_err_ivalsmax -5 |
#define potential_err_malloc -2 |
#define potential_err_null -1 |
#define potential_err_nyi -4 |
#define potential_err_ok 0 |
#define potential_escale (0.079577471545947667882) |
#define potential_flag_Coulomb 4 |
#define potential_flag_Ewald 2 |
#define potential_flag_LJ126 1 |
#define potential_flag_none 0 |
#define potential_flag_single 6 |
#define potential_ivalsa 1 |
#define potential_ivalsb 10 |
#define potential_ivalsmax 320 |
#define potential_N 100 |
void potential_clear | ( | struct potential * | p | ) |
Free the memory associated with the given potential.
p | Pointer to the potential to clear. |
double potential_Coulomb | ( | double | r | ) | [inline] |
The Coulomb potential.
r | The interaction radius. |
r
. double potential_Coulomb_6p | ( | double | r | ) | [inline] |
TheCoulomb potential (sixth derivative).
r | The interaction radius. |
r
. double potential_Coulomb_p | ( | double | r | ) | [inline] |
The Coulomb potential (first derivative).
r | The interaction radius. |
r
. struct potential* potential_create_Coulomb | ( | double | a, |
double | b, | ||
double | q, | ||
double | tol | ||
) | [read] |
Creates a potential representing a shifted Coulomb potential.
a | The smallest radius for which the potential will be constructed. |
b | The largest radius for which the potential will be constructed. |
q | The charge scaling of the potential. |
tol | The tolerance to which the interpolation should match the exact potential. |
NULL
on error (see potential_err). struct potential* potential_create_Ewald | ( | double | a, |
double | b, | ||
double | q, | ||
double | kappa, | ||
double | tol | ||
) | [read] |
Creates a potential representing the real-space part of an Ewald potential.
a | The smallest radius for which the potential will be constructed. |
b | 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. |
NULL
on error (see potential_err). struct potential* potential_create_harmonic | ( | double | a, |
double | b, | ||
double | K, | ||
double | r0, | ||
double | tol | ||
) | [read] |
Creates a harmonic bond potential.
a | The smallest radius for which the potential will be constructed. |
b | The largest radius for which the potential will be constructed. |
K | The energy of the bond. |
r0 | The minimum energy distance. |
tol | The tolerance to which the interpolation should match the exact potential. |
NULL
on error (see potential_err). struct potential* potential_create_harmonic_angle | ( | double | a, |
double | b, | ||
double | K, | ||
double | theta0, | ||
double | tol | ||
) | [read] |
Creates a harmonic angle potential.
a | The smallest angle for which the potential will be constructed. |
b | The largest angle for which the potential will be constructed. |
K | The energy of the angle. |
theta0 | The minimum energy angle. |
tol | The tolerance to which the interpolation should match the exact potential. |
NULL
on error (see potential_err). struct potential* potential_create_harmonic_dihedral | ( | double | K, |
int | n, | ||
double | delta, | ||
double | tol | ||
) | [read] |
Creates a harmonic dihedral potential.
K | The energy of the dihedral. |
n | The multiplicity of the dihedral. |
delta | The minimum energy dihedral. |
tol | The tolerance to which the interpolation should match the exact potential. |
NULL
on error (see potential_err). struct potential* potential_create_LJ126 | ( | double | a, |
double | b, | ||
double | A, | ||
double | B, | ||
double | tol | ||
) | [read] |
Creates a potential representing a 12-6 Lennard-Jones potential.
a | The smallest radius for which the potential will be constructed. |
b | 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. |
NULL
on error (see potential_err). struct potential* potential_create_LJ126_Coulomb | ( | double | a, |
double | b, | ||
double | A, | ||
double | B, | ||
double | q, | ||
double | tol | ||
) | [read] |
Creates a potential representing the sum of a 12-6 Lennard-Jones potential and a shifted Coulomb potential.
a | The smallest radius for which the potential will be constructed. |
b | 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. |
NULL
on error (see potential_err). struct potential* potential_create_LJ126_Ewald | ( | double | a, |
double | b, | ||
double | A, | ||
double | B, | ||
double | q, | ||
double | kappa, | ||
double | tol | ||
) | [read] |
Creates a potential representing the sum of a 12-6 Lennard-Jones potential and the real-space part of an Ewald potential.
a | The smallest radius for which the potential will be constructed. |
b | 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. |
kappa | The screening distance of the Ewald potential. |
tol | The tolerance to which the interpolation should match the exact potential. |
NULL
on error (see potential_err). double potential_Ewald | ( | double | r, |
double | kappa | ||
) | [inline] |
The short-range part of an Ewald summation.
r | The interaction radius. |
kappa | The screening length of the Ewald summation. |
r
. double potential_Ewald_6p | ( | double | r, |
double | kappa | ||
) | [inline] |
The short-range part of an Ewald summation (sixth derivative).
r | The interaction radius. |
kappa | The screening length of the Ewald summation. |
r
. double potential_Ewald_p | ( | double | r, |
double | kappa | ||
) | [inline] |
The short-range part of an Ewald summation (first derivative).
r | The interaction radius. |
kappa | The screening length of the Ewald summation. |
r
. double potential_getalpha | ( | double(*)(double) | f6p, |
double | a, | ||
double | b | ||
) |
Compute the parameter for the optimal node distribution.
f6p | Pointer to a function representing the 6th derivative of the interpoland. |
a | Left limit of the interpolation. |
b | Right limit of the interpolation. |
The value is computed using Brent's algortihm to 4 decimal digits.
int potential_getcoeffs | ( | double(*)(double) | f, |
double(*)(double) | fp, | ||
FPTYPE * | xi, | ||
int | n, | ||
FPTYPE * | c, | ||
FPTYPE * | err | ||
) |
Compute the interpolation coefficients over a given set of nodes.
f | Pointer to the function to be interpolated. |
fp | Pointer to the first derivative of f . |
xi | Pointer to an array of nodes between whicht the function f will be interpolated. |
n | Number of nodes in xi . |
c | Pointer to an array in which to store the interpolation coefficients. |
err | Pointer to a floating-point value in which an approximation of the interpolation error, relative to the maximum of f in each interval, is stored. |
Compute the coefficients of the function f
with derivative fp
over the n
intervals between the xi
and store an estimate of the maximum locally relative interpolation error in err
.
The array to which c
points must be large enough to hold at least potential_degree x n
values of type #FPTYPE.
int potential_init | ( | struct potential * | p, |
double(*)(double) | f, | ||
double(*)(double) | fp, | ||
double(*)(double) | f6p, | ||
FPTYPE | a, | ||
FPTYPE | b, | ||
FPTYPE | tol | ||
) |
Construct a potential from the given function.
p | A pointer to an empty potential. |
f | A pointer to the potential function to be interpolated. |
fp | A pointer to the first derivative of f . |
f6p | A pointer to the sixth derivative of f . |
a | The smallest radius for which the potential will be constructed. |
b | The largest radius for which the potential will be constructed. |
tol | The absolute tolerance to which the interpolation should match the exact potential. |
Computes an interpolated potential function from f
in [a,b] to the locally relative tolerance
tol
.
The sixth derivative f6p
is used to compute the optimal node distribution. If f6p
is NULL
, the derivative is approximated numerically.
The zeroth interval contains a linear extension of f
for values < a.
double potential_LJ126 | ( | double | r, |
double | A, | ||
double | B | ||
) | [inline] |
A basic 12-6 Lennard-Jones potential.
r | The interaction radius. |
A | First parameter of the potential. |
B | Second parameter of the potential. |
r
. double potential_LJ126_6p | ( | double | r, |
double | A, | ||
double | B | ||
) | [inline] |
A basic 12-6 Lennard-Jones potential (sixth derivative).
r | The interaction radius. |
A | First parameter of the potential. |
B | Second parameter of the potential. |
r
. double potential_LJ126_p | ( | double | r, |
double | A, | ||
double | B | ||
) | [inline] |
A basic 12-6 Lennard-Jones potential (first derivative).
r | The interaction radius. |
A | First parameter of the potential. |
B | Second parameter of the potential. |
r
. int potential_err |
ID of the last error.
The last error
struct potential potential_null |
Fictitious null potential.