extract() implementation for dihedral opls

This commit is contained in:
Evangelos Voyiatzis
2025-04-07 09:05:42 +02:00
committed by GitHub
parent d1dd05bf4e
commit 27ac8c0ea1
4 changed files with 22 additions and 1 deletions

View File

@ -457,6 +457,8 @@ 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:`opls <dihedral_opls>` | k1,k2,k3,k4 | type dihedrals |
+---------------------------------------------------------+----------------+----------------+ +---------------------------------------------------------+----------------+----------------+
| :doc:`quadratic <dihedral_quadratic>` | k,phi0 | type dihedrals | | :doc:`quadratic <dihedral_quadratic>` | k,phi0 | type dihedrals |
+---------------------------------------------------------+----------------+----------------+ +---------------------------------------------------------+----------------+----------------+

View File

@ -431,3 +431,17 @@ void DihedralOPLS::born_matrix(int nd, int i1, int i2, int i3, int i4, double &d
16.0 * k4[type] * si * cos(4.0 * phi) - 4.0 * k4[type] * sin(4.0 * phi)) / 16.0 * k4[type] * si * cos(4.0 * phi) - 4.0 * k4[type] * sin(4.0 * phi)) /
(si * si * si); (si * si * si);
} }
/* ----------------------------------------------------------------------
return ptr to internal members upon request
------------------------------------------------------------------------ */
void *DihedralOPLS::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, "k4") == 0) return (void *) k4;
return nullptr;
}

View File

@ -34,6 +34,7 @@ class DihedralOPLS : 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 *k1, *k2, *k3, *k4; double *k1, *k2, *k3, *k4;

View File

@ -16,7 +16,11 @@ dihedral_coeff: ! |
3 56 10 32 84 3 56 10 32 84
4 23 80 61 83 4 23 80 61 83
5 19 90 13 15 5 19 90 13 15
extract: ! "" extract: ! |
k1 1
k2 1
k3 1
k4 1
natoms: 29 natoms: 29
init_energy: 2260.6834525285753 init_energy: 2260.6834525285753
init_stress: ! |- init_stress: ! |-