add extract() function to angle style cosine/squared
This commit is contained in:
@ -365,11 +365,13 @@ all types from 1 to :math:`N`. A leading asterisk means all types from
|
||||
If :doc:`angle_style hybrid <angle_hybrid>` is used, *astyle* should be a
|
||||
sub-style name. The angle styles that currently work with fix adapt are:
|
||||
|
||||
+------------------------------------+----------+-------------+
|
||||
| :doc:`harmonic <angle_harmonic>` | k,theta0 | type angles |
|
||||
+------------------------------------+----------+-------------+
|
||||
| :doc:`cosine <angle_cosine>` | k | type angles |
|
||||
+------------------------------------+----------+-------------+
|
||||
+-----------------------------------------------+----------+-------------+
|
||||
| :doc:`harmonic <angle_harmonic>` | k,theta0 | type angles |
|
||||
+-----------------------------------------------+----------+-------------+
|
||||
| :doc:`cosine <angle_cosine>` | k | type angles |
|
||||
+-----------------------------------------------+----------+-------------+
|
||||
| :doc:`cosine/squared <angle_cosine_squared>` | k,theta0 | type angles |
|
||||
+-----------------------------------------------+----------+-------------+
|
||||
|
||||
Note that internally, theta0 is stored in radians, so the variable
|
||||
this fix uses to reset theta0 needs to generate values in radians.
|
||||
|
||||
@ -291,3 +291,15 @@ void AngleCosineSquared::born_matrix(int type, int i1, int i2, int i3, double &d
|
||||
du2 = 2 * k[type];
|
||||
du = du2 * dcostheta;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return ptr to internal members upon request
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
void *AngleCosineSquared::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 1;
|
||||
if (strcmp(str, "k") == 0) return (void *) k;
|
||||
if (strcmp(str, "theta0") == 0) return (void *) theta0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ class AngleCosineSquared : public Angle {
|
||||
void write_data(FILE *) override;
|
||||
double single(int, int, int, int) override;
|
||||
void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override;
|
||||
void *extract(const char *, int &) override;
|
||||
|
||||
protected:
|
||||
double *k, *theta0;
|
||||
|
||||
@ -16,7 +16,9 @@ angle_coeff: ! |
|
||||
3 50.0 120.0
|
||||
4 100.0 108.5
|
||||
equilibrium: 4 1.9216075064457567 1.9373154697137058 2.0943951023931953 1.8936822384138476
|
||||
extract: ! ""
|
||||
extract: |
|
||||
k 1
|
||||
theta0 1
|
||||
natoms: 29
|
||||
init_energy: 36.01162448576962
|
||||
init_stress: ! |2-
|
||||
|
||||
Reference in New Issue
Block a user