diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index ed611b2c7c..8fb103f5c6 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -457,21 +457,23 @@ 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:`charmm ` | k,n,d | type dihedrals | -+------------------------------------------------------------------------+----------------+----------------+ -| :doc:`charmmfsw ` | k,n,d | type dihedrals | -+------------------------------------------------------------------------+----------------+----------------+ -| :doc:`cosine/squared/restricted ` | k,phi0 | type dihedrals | -+------------------------------------------------------------------------+----------------+----------------+ -| :doc:`helix ` | a,b,c | type dihedrals | -+------------------------------------------------------------------------+----------------+----------------+ -| :doc:`multi/harmonic ` | a1,a2,a3,a4,a5 | type dihedrals | -+------------------------------------------------------------------------+----------------+----------------+ -| :doc:`opls ` | k1,k2,k3,k4 | type dihedrals | -+------------------------------------------------------------------------+----------------+----------------+ -| :doc:`quadratic ` | k,phi0 | type dihedrals | -+------------------------------------------------------------------------+----------------+----------------+ ++------------------------------------------------------------------------+-------------------------+----------------+ +| :doc:`charmm ` | k,n,d | type dihedrals | ++------------------------------------------------------------------------+-------------------------+----------------+ +| :doc:`charmmfsw ` | k,n,d | type dihedrals | ++------------------------------------------------------------------------+-------------------------+----------------+ +| :doc:`class2 ` | k1,k2,k3,phi1,phi2,phi3 | type dihedrals | ++------------------------------------------------------------------------+-------------------------+----------------+ +| :doc:`cosine/squared/restricted ` | k,phi0 | type dihedrals | ++------------------------------------------------------------------------+-------------------------+----------------+ +| :doc:`helix ` | a,b,c | type dihedrals | ++------------------------------------------------------------------------+-------------------------+----------------+ +| :doc:`multi/harmonic ` | a1,a2,a3,a4,a5 | 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/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 9c4c1ad871..3ca8c52717 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -946,3 +946,18 @@ void DihedralClass2::write_data(FILE *fp) at_theta0_1[i]*180.0/MY_PI,at_theta0_2[i]*180.0/MY_PI); } +/* ---------------------------------------------------------------------- + return ptr to internal members upon request + ------------------------------------------------------------------------ */ + + void *DihedralClass2::extract(const char *str, int &dim) + { + dim = 1; + if (strcmp(str, "k1") == 0) return (void *) k1; + if (strcmp(str, "k2") == 0) return (void *) k2; + if (strcmp(str, "k3") == 0) return (void *) k3; + if (strcmp(str, "phi1") == 0) return (void *) phi1; + if (strcmp(str, "phi2") == 0) return (void *) phi2; + if (strcmp(str, "phi3") == 0) return (void *) phi3; + return nullptr; + } diff --git a/src/CLASS2/dihedral_class2.h b/src/CLASS2/dihedral_class2.h index ad42c5c3a1..d87dfb8a7b 100644 --- a/src/CLASS2/dihedral_class2.h +++ b/src/CLASS2/dihedral_class2.h @@ -33,6 +33,7 @@ class DihedralClass2 : public Dihedral { void write_restart(FILE *) override; void read_restart(FILE *) override; void write_data(FILE *) override; + void *extract(const char *, int &) override; protected: double *k1, *k2, *k3; diff --git a/unittest/force-styles/tests/dihedral-class2.yaml b/unittest/force-styles/tests/dihedral-class2.yaml index b041d4ebcb..572bc4e5d8 100644 --- a/unittest/force-styles/tests/dihedral-class2.yaml +++ b/unittest/force-styles/tests/dihedral-class2.yaml @@ -17,7 +17,13 @@ dihedral_coeff: ! | * at 75 42 31 75 42 31 120 50 * aat 75 120 160 * bb13 75 1.4 1.4 -extract: ! "" +extract: ! | + k1 1 + k2 1 + k3 1 + phi1 1 + phi2 1 + phi3 1 natoms: 29 init_energy: 3355.0074717375933 init_stress: ! |2-