extract() implementation for dihedral helix

This commit is contained in:
Evangelos Voyiatzis
2025-04-07 11:20:53 +02:00
committed by GitHub
parent 7655a4cb84
commit e93709d34e
4 changed files with 20 additions and 1 deletions

View File

@ -464,6 +464,8 @@ sub-style name. The dihedral styles that currently work with fix adapt are:
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+----------------+----------------+
| :doc:`cosine/squared/restricted <dihedral_cosine_squared_restricted>` | k,phi0 | type dihedrals | | :doc:`cosine/squared/restricted <dihedral_cosine_squared_restricted>` | k,phi0 | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+----------------+----------------+
| :doc:`helix <dihedral_helix>` | a,b,c | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+
| :doc:`multi/harmonic <dihedral_multi_harmonic>` | a1,a2,a3,a4,a5 | type dihedrals | | :doc:`multi/harmonic <dihedral_multi_harmonic>` | a1,a2,a3,a4,a5 | type dihedrals |
+------------------------------------------------------------------------+----------------+----------------+ +------------------------------------------------------------------------+----------------+----------------+
| :doc:`opls <dihedral_opls>` | k1,k2,k3,k4 | type dihedrals | | :doc:`opls <dihedral_opls>` | k1,k2,k3,k4 | type dihedrals |

View File

@ -430,3 +430,16 @@ void DihedralHelix::born_matrix(int nd, int i1, int i2, int i3, int i4,
du2 = -(9.0*bphi[type]*cos(3.0*phi) + cphi[type]*cos(phi + MY_PI4))*siinv*siinv + du2 = -(9.0*bphi[type]*cos(3.0*phi) + cphi[type]*cos(phi + MY_PI4))*siinv*siinv +
(3.0*bphi[type]*sin(3.0*phi) + cphi[type]*sin(phi + MY_PI4))*c*siinv*siinv*siinv; (3.0*bphi[type]*sin(3.0*phi) + cphi[type]*sin(phi + MY_PI4))*c*siinv*siinv*siinv;
} }
/* ----------------------------------------------------------------------
return ptr to internal members upon request
------------------------------------------------------------------------ */
void *DihedralHelix::extract(const char *str, int &dim)
{
dim = 1;
if (strcmp(str, "a") == 0) return (void *) aphi;
if (strcmp(str, "b") == 0) return (void *) bphi;
if (strcmp(str, "c") == 0) return (void *) cphi;
return nullptr;
}

View File

@ -34,6 +34,7 @@ class DihedralHelix : public Dihedral {
void read_restart(FILE *) override; void read_restart(FILE *) override;
void write_data(FILE *) override; void write_data(FILE *) override;
void born_matrix(int, int, int, int, int, double &, double &) override; void born_matrix(int, int, int, int, int, double &, double &) override;
void *extract(const char *, int &) override;
protected: protected:
double *aphi, *bphi, *cphi; double *aphi, *bphi, *cphi;

View File

@ -16,7 +16,10 @@ dihedral_coeff: ! |
3 56 10 32 3 56 10 32
4 23 80 61 4 23 80 61
5 19 90 13 5 19 90 13
extract: ! "" extract: ! |
a 1
b 1
c 1
natoms: 29 natoms: 29
init_energy: 4634.436545707672 init_energy: 4634.436545707672
init_stress: ! |- init_stress: ! |-