extract() implementation for dihedral class2

This commit is contained in:
Evangelos Voyiatzis
2025-04-07 11:35:20 +02:00
committed by GitHub
parent e93709d34e
commit 2b38b6d1c0
4 changed files with 40 additions and 16 deletions

View File

@ -457,21 +457,23 @@ all types from 1 to :math:`N`. A leading asterisk means all types from
If :doc:`dihedral_style hybrid <dihedral_hybrid>` is used, *dstyle* should be a If :doc:`dihedral_style hybrid <dihedral_hybrid>` is used, *dstyle* should be a
sub-style name. The dihedral styles that currently work with fix adapt are: sub-style name. The dihedral styles that currently work with fix adapt are:
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+-------------------------+----------------+
| :doc:`charmm <dihedral_charmm>` | k,n,d | type dihedrals | | :doc:`charmm <dihedral_charmm>` | k,n,d | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+-------------------------+----------------+
| :doc:`charmmfsw <dihedral_charmm>` | k,n,d | type dihedrals | | :doc:`charmmfsw <dihedral_charmm>` | k,n,d | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+-------------------------+----------------+
| :doc:`cosine/squared/restricted <dihedral_cosine_squared_restricted>` | k,phi0 | type dihedrals | | :doc:`class2 <dihedral_class2>` | k1,k2,k3,phi1,phi2,phi3 | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+-------------------------+----------------+
| :doc:`helix <dihedral_helix>` | a,b,c | type dihedrals | | :doc:`cosine/squared/restricted <dihedral_cosine_squared_restricted>` | k,phi0 | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+-------------------------+----------------+
| :doc:`multi/harmonic <dihedral_multi_harmonic>` | a1,a2,a3,a4,a5 | type dihedrals | | :doc:`helix <dihedral_helix>` | a,b,c | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+-------------------------+----------------+
| :doc:`opls <dihedral_opls>` | k1,k2,k3,k4 | type dihedrals | | :doc:`multi/harmonic <dihedral_multi_harmonic>` | a1,a2,a3,a4,a5 | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+-------------------------+----------------+
| :doc:`quadratic <dihedral_quadratic>` | k,phi0 | type dihedrals | | :doc:`opls <dihedral_opls>` | k1,k2,k3,k4 | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+-------------------------+----------------+
| :doc:`quadratic <dihedral_quadratic>` | k,phi0 | type dihedrals |
+------------------------------------------------------------------------+-------------------------+----------------+
Note that internally, phi0 is stored in radians, so the variable Note that internally, phi0 is stored in radians, so the variable
this fix use to reset phi0 needs to generate values in radians. this fix use to reset phi0 needs to generate values in radians.

View File

@ -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); 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;
}

View File

@ -33,6 +33,7 @@ class DihedralClass2 : public Dihedral {
void write_restart(FILE *) override; void write_restart(FILE *) override;
void read_restart(FILE *) override; void read_restart(FILE *) override;
void write_data(FILE *) override; void write_data(FILE *) override;
void *extract(const char *, int &) override;
protected: protected:
double *k1, *k2, *k3; double *k1, *k2, *k3;

View File

@ -17,7 +17,13 @@ dihedral_coeff: ! |
* at 75 42 31 75 42 31 120 50 * at 75 42 31 75 42 31 120 50
* aat 75 120 160 * aat 75 120 160
* bb13 75 1.4 1.4 * bb13 75 1.4 1.4
extract: ! "" extract: ! |
k1 1
k2 1
k3 1
phi1 1
phi2 1
phi3 1
natoms: 29 natoms: 29
init_energy: 3355.0074717375933 init_energy: 3355.0074717375933
init_stress: ! |2- init_stress: ! |2-