diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index 2922a87b37..9dd8b0cd2f 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -457,11 +457,13 @@ all types from 1 to :math:`N`. A leading asterisk means all types from If :doc:`dihedral_style hybrid ` is used, *dstyle* should be a sub-style name. The dihedral styles that currently work with fix adapt are: -+---------------------------------------------------------+----------------+----------------+ -| :doc:`opls ` | k1,k2,k3,k4 | type dihedrals | -+---------------------------------------------------------+----------------+----------------+ -| :doc:`quadratic ` | k,phi0 | type dihedrals | -+---------------------------------------------------------+----------------+----------------+ ++------------------------------------------------------------------------+----------------+----------------+ +| :doc:`cosine/squared/restricted ` | k,phi0 | type dihedrals | ++------------------------------------------------------------------------+----------------+----------------+ +| :doc:`opls ` | k1,k2,k3,k4 | type dihedrals | ++------------------------------------------------------------------------+----------------+----------------+ +| :doc:`quadratic ` | k,phi0 | type dihedrals | ++------------------------------------------------------------------------+----------------+----------------+ Note that internally, phi0 is stored in radians, so the variable this fix use to reset phi0 needs to generate values in radians. diff --git a/src/EXTRA-MOLECULE/dihedral_cosine_squared_restricted.cpp b/src/EXTRA-MOLECULE/dihedral_cosine_squared_restricted.cpp index d8e34189d9..2edc87bb00 100644 --- a/src/EXTRA-MOLECULE/dihedral_cosine_squared_restricted.cpp +++ b/src/EXTRA-MOLECULE/dihedral_cosine_squared_restricted.cpp @@ -393,3 +393,15 @@ void DihedralCosineSquaredRestricted::born_matrix(int nd, int i1, int i2, int i3 du2 = 2 * k[type] * numerator / denominator; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request + ------------------------------------------------------------------------ */ + + void *DihedralCosineSquaredRestricted::extract(const char *str, int &dim) + { + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "phi0") == 0) return (void *) phi0; + return nullptr; + } diff --git a/src/EXTRA-MOLECULE/dihedral_cosine_squared_restricted.h b/src/EXTRA-MOLECULE/dihedral_cosine_squared_restricted.h index b9e2e1d9d8..f44d893cd0 100644 --- a/src/EXTRA-MOLECULE/dihedral_cosine_squared_restricted.h +++ b/src/EXTRA-MOLECULE/dihedral_cosine_squared_restricted.h @@ -34,6 +34,7 @@ class DihedralCosineSquaredRestricted : public Dihedral { void read_restart(FILE *) override; void write_data(FILE *) override; void born_matrix(int, int, int, int, int, double &, double &) override; + void *extract(const char *, int &) override; protected: double *k, *phi0; diff --git a/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml b/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml index 0e43bc1741..12098105c5 100644 --- a/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml +++ b/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml @@ -16,7 +16,9 @@ dihedral_coeff: ! | 3 15.0 -10.0 4 12.0 0.0 5 11.0 45.0 -extract: ! "" +extract: ! | + k 1 + phi0 1 natoms: 29 init_energy: 10643.96352037142 init_stress: ! |2-