From aeeacf04428ea657a0ca1bb3e68f8e24cef8713a Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:42:01 +0200 Subject: [PATCH 01/27] Update extract of bond_class2.cpp --- src/CLASS2/bond_class2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index 8c5d8159bf4..da1e8199e07 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -242,6 +242,9 @@ void BondClass2::born_matrix(int type, double rsq, int /*i*/, int /*j*/, double void *BondClass2::extract(const char *str, int &dim) { dim = 1; + if (strcmp(str, "k2") == 0) return (void *) k2; + if (strcmp(str, "k3") == 0) return (void *) k3; + if (strcmp(str, "k4") == 0) return (void *) k4; if (strcmp(str,"r0")==0) return (void*) r0; return nullptr; } From 852c46ba0ea12ba9e75296902ac045079d282213 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:47:30 +0200 Subject: [PATCH 02/27] add extract() function to angle_class2_p6.h --- src/MOFFF/angle_class2_p6.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MOFFF/angle_class2_p6.h b/src/MOFFF/angle_class2_p6.h index 13c164e9bec..da55eb2e8e4 100644 --- a/src/MOFFF/angle_class2_p6.h +++ b/src/MOFFF/angle_class2_p6.h @@ -35,6 +35,7 @@ class AngleClass2P6 : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: double *theta0, *k2, *k3, *k4, *k5, *k6; From 1db92ad34b2db960fd02e97c63a0572590cf665f Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:48:19 +0200 Subject: [PATCH 03/27] add extract() function to angle_class2_p6.cpp --- src/MOFFF/angle_class2_p6.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/MOFFF/angle_class2_p6.cpp b/src/MOFFF/angle_class2_p6.cpp index 39dec0d9d6f..f2667fb17b0 100644 --- a/src/MOFFF/angle_class2_p6.cpp +++ b/src/MOFFF/angle_class2_p6.cpp @@ -487,3 +487,19 @@ double AngleClass2P6::single(int type, int i1, int i2, int i3) return energy; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleClass2P6::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k2") == 0) return (void *) k2; + if (strcmp(str, "k3") == 0) return (void *) k3; + if (strcmp(str, "k4") == 0) return (void *) k4; + if (strcmp(str, "k5") == 0) return (void *) k5; + if (strcmp(str, "k6") == 0) return (void *) k6; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From 81ac3bbaf62f95d4f9692e143d71a6d8f46ce6a6 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:49:13 +0200 Subject: [PATCH 04/27] add extract() function to angle_cosine_buck6d.h --- src/MOFFF/angle_cosine_buck6d.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MOFFF/angle_cosine_buck6d.h b/src/MOFFF/angle_cosine_buck6d.h index 4821d4c1c94..b68f5c90462 100644 --- a/src/MOFFF/angle_cosine_buck6d.h +++ b/src/MOFFF/angle_cosine_buck6d.h @@ -36,6 +36,7 @@ class AngleCosineBuck6d : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: double *k, *th0; From 87737c1a47c1c916d53a67603830d5fe07af7868 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:49:45 +0200 Subject: [PATCH 05/27] add extract() function to angle_cosine_buck6d.cpp --- src/MOFFF/angle_cosine_buck6d.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/MOFFF/angle_cosine_buck6d.cpp b/src/MOFFF/angle_cosine_buck6d.cpp index 0ab9cbbf1f4..e1f5f54bf6c 100644 --- a/src/MOFFF/angle_cosine_buck6d.cpp +++ b/src/MOFFF/angle_cosine_buck6d.cpp @@ -383,3 +383,16 @@ double AngleCosineBuck6d::single(int type, int i1, int i2, int i3) return k[type]*(1.0+cos(tk)); } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleCosineBuck6d::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "multiplicity") == 0) return (void *) multiplicity; + if (strcmp(str, "th0") == 0) return (void *) th0; + return nullptr; +} From b5386d714e83fe40b27815592d1c0c6a5a2248f6 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:51:14 +0200 Subject: [PATCH 06/27] Update extract() function to bond_morse.cpp --- src/MOLECULE/bond_morse.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index b7020b04412..b0e19c359cf 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -227,6 +227,8 @@ void BondMorse::born_matrix(int type, double rsq, int /*i*/, int /*j*/, double & void *BondMorse::extract(const char *str, int &dim) { dim = 1; + if (strcmp(str, "d0") == 0) return (void *) d0; + if (strcmp(str, "alpha") == 0) return (void *) alpha; if (strcmp(str, "r0") == 0) return (void *) r0; return nullptr; } From 4766ddbede8106a1f0930c2f941fa2504eea1124 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:52:21 +0200 Subject: [PATCH 07/27] Update bond_nonlinear.cpp --- src/EXTRA-MOLECULE/bond_nonlinear.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-MOLECULE/bond_nonlinear.cpp b/src/EXTRA-MOLECULE/bond_nonlinear.cpp index a2955b7d2e2..32de7276d20 100644 --- a/src/EXTRA-MOLECULE/bond_nonlinear.cpp +++ b/src/EXTRA-MOLECULE/bond_nonlinear.cpp @@ -228,6 +228,7 @@ void BondNonlinear::born_matrix(int type, double rsq, int /*i*/, int /*j*/, doub void *BondNonlinear::extract(const char *str, int &dim) { dim = 1; + if (strcmp(str,"lamda")==0) return (void*) lamda; if (strcmp(str,"epsilon")==0) return (void*) epsilon; if (strcmp(str,"r0")==0) return (void*) r0; return nullptr; From 44625312ea309672bb475763094a6314e193af22 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:53:02 +0200 Subject: [PATCH 08/27] add extract() function to angle_gaussian.h --- src/EXTRA-MOLECULE/angle_gaussian.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-MOLECULE/angle_gaussian.h b/src/EXTRA-MOLECULE/angle_gaussian.h index 305565b032d..1652a1948d5 100644 --- a/src/EXTRA-MOLECULE/angle_gaussian.h +++ b/src/EXTRA-MOLECULE/angle_gaussian.h @@ -35,6 +35,7 @@ class AngleGaussian : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: int *nterms; From 732ef6bd44e8e234a3f7e7031882ce968fc0f4c5 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:53:45 +0200 Subject: [PATCH 09/27] add extract() function to angle_gaussian.cpp --- src/EXTRA-MOLECULE/angle_gaussian.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/EXTRA-MOLECULE/angle_gaussian.cpp b/src/EXTRA-MOLECULE/angle_gaussian.cpp index 7290cb70cca..a5d469559f6 100644 --- a/src/EXTRA-MOLECULE/angle_gaussian.cpp +++ b/src/EXTRA-MOLECULE/angle_gaussian.cpp @@ -352,3 +352,14 @@ double AngleGaussian::single(int type, int i1, int i2, int i3) if (sum_g_i < SMALL) sum_g_i = SMALL; return -(force->boltz * angle_temperature[type]) * log(sum_g_i); } + +/* ---------------------------------------------------------------------- */ + +void *AngleGaussian::extract(const char *str, int &dim) +{ + dim = 2; + if (strcmp(str,"alpha") == 0) return (void *) alpha; + if (strcmp(str,"width") == 0) return (void *) width; + if (strcmp(str,"theta0") == 0) return (void *) theta0; + return nullptr; +} From 7da8434d5bd83b8c848b36a94e36d0878354f8e9 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:54:24 +0200 Subject: [PATCH 10/27] add extract() function to bond_gaussian.h --- src/EXTRA-MOLECULE/bond_gaussian.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-MOLECULE/bond_gaussian.h b/src/EXTRA-MOLECULE/bond_gaussian.h index e466df47d41..d420d819495 100644 --- a/src/EXTRA-MOLECULE/bond_gaussian.h +++ b/src/EXTRA-MOLECULE/bond_gaussian.h @@ -36,6 +36,7 @@ class BondGaussian : public Bond { void write_data(FILE *) override; double single(int, double, int, int, double &) override; void born_matrix(int, double, int, int, double &, double &) override; + void *extract(const char *, int &) override; protected: int *nterms; From b619cce773862b2923b6204dc0e8127f05b221d1 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:54:56 +0200 Subject: [PATCH 11/27] add extract() function to bond_gaussian.cpp --- src/EXTRA-MOLECULE/bond_gaussian.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/EXTRA-MOLECULE/bond_gaussian.cpp b/src/EXTRA-MOLECULE/bond_gaussian.cpp index 9a8546e2786..2ed9e06799b 100644 --- a/src/EXTRA-MOLECULE/bond_gaussian.cpp +++ b/src/EXTRA-MOLECULE/bond_gaussian.cpp @@ -337,3 +337,14 @@ void BondGaussian::born_matrix(int type, double rsq, int /*i*/, int /*j*/, doubl du2 = - (force->boltz * bond_temperature[type]) * numerator / denominator; } + +/* ---------------------------------------------------------------------- */ + +void *BondGaussian::extract(const char *str, int &dim) +{ + dim = 2; + if (strcmp(str,"alpha") == 0) return (void *) alpha; + if (strcmp(str,"width") == 0) return (void *) width; + if (strcmp(str,"r0") == 0) return (void *) r0; + return nullptr; +} From c8241dcab6bb07a1c92f5e8fad1397aaddcf538d Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:58:32 +0200 Subject: [PATCH 12/27] unit test for extract() in angle-class2_p6.yaml --- unittest/force-styles/tests/angle-class2_p6.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-class2_p6.yaml b/unittest/force-styles/tests/angle-class2_p6.yaml index 065b3cb3483..47c82e29258 100644 --- a/unittest/force-styles/tests/angle-class2_p6.yaml +++ b/unittest/force-styles/tests/angle-class2_p6.yaml @@ -23,7 +23,13 @@ angle_coeff: ! | 3 ba 10.0 10.0 1.5 1.5 4 ba 0.0 20.0 1.5 1.5 equilibrium: 4 1.9216075064457565 1.9373154697137058 2.0943951023931953 1.8936822384138474 -extract: ! "" +extract: ! | + k2 1 + k3 1 + k4 1 + k5 1 + k6 1 + theta0 1 natoms: 29 init_energy: 46.44080287964778 init_stress: ! |2- From 8bc89ef8a7c8a6533e706e948cb6a2915e72d132 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 10:59:29 +0200 Subject: [PATCH 13/27] unit test for extract() in bond-class2.yaml --- unittest/force-styles/tests/bond-class2.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unittest/force-styles/tests/bond-class2.yaml b/unittest/force-styles/tests/bond-class2.yaml index 42c73346a67..8ee724e5e4b 100644 --- a/unittest/force-styles/tests/bond-class2.yaml +++ b/unittest/force-styles/tests/bond-class2.yaml @@ -18,6 +18,9 @@ bond_coeff: ! | 5 0.97 532.50 -1282.90 2004.76 equilibrium: 5 1.42 1.1 1.3 1.2 0.97 extract: ! | + k2 1 + k3 1 + k4 1 r0 1 natoms: 29 init_energy: 26.429859642132705 From 856fd9d97745d63e22f989570dfe566f154b40b0 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 11:01:57 +0200 Subject: [PATCH 14/27] unit test for extract() in bond-morse.yaml --- unittest/force-styles/tests/bond-morse.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unittest/force-styles/tests/bond-morse.yaml b/unittest/force-styles/tests/bond-morse.yaml index d17e1db97ec..f56662efd67 100644 --- a/unittest/force-styles/tests/bond-morse.yaml +++ b/unittest/force-styles/tests/bond-morse.yaml @@ -18,6 +18,8 @@ bond_coeff: ! | 5 7000.0 0.3 1.0 equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! | + d0 1 + alpha 1 r0 1 natoms: 29 init_energy: 5.607154540709207 From 391f55b377ba9d59162bed29a006b2e137910c23 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 11:02:55 +0200 Subject: [PATCH 15/27] unit test for extract() in bond-nonlinear.yaml --- unittest/force-styles/tests/bond-nonlinear.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/bond-nonlinear.yaml b/unittest/force-styles/tests/bond-nonlinear.yaml index ae52190dd9f..995d39425f7 100644 --- a/unittest/force-styles/tests/bond-nonlinear.yaml +++ b/unittest/force-styles/tests/bond-nonlinear.yaml @@ -17,7 +17,10 @@ bond_coeff: ! | 4 650.0 1.2 1.4 5 450.0 1.0 1.1 equilibrium: 5 1.5 1.1 1.3 1.2 1 -extract: ! "" +extract: ! | + lamda 1 + epsilon 1 + r0 1 natoms: 29 init_energy: 1.9451728032820943 init_stress: ! |- From 6d30557ec21d245dd51958c3730b33043b1f77b8 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 11:08:32 +0200 Subject: [PATCH 16/27] Update partially fix_adapt.rst --- doc/src/fix_adapt.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index 7eaf1081f31..e322b167a63 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -323,7 +323,7 @@ If :doc:`bond_style hybrid ` is used, *bstyle* should be a sub-style name. The bond styles that currently work with fix adapt are: +-----------------------------------------------------+---------------------------+------------+ -| :doc:`class2 ` | r0 | type bonds | +| :doc:`class2 ` | k2,k3,k4,r0 | type bonds | +-----------------------------------------------------+---------------------------+------------+ | :doc:`fene ` | k,r0 | type bonds | +-----------------------------------------------------+---------------------------+------------+ @@ -343,9 +343,9 @@ sub-style name. The bond styles that currently work with fix adapt are: +-----------------------------------------------------+---------------------------+------------+ | :doc:`mm3 ` | k,r0 | type bonds | +-----------------------------------------------------+---------------------------+------------+ -| :doc:`morse ` | r0 | type bonds | +| :doc:`morse ` | d0,alpha,r0 | type bonds | +-----------------------------------------------------+---------------------------+------------+ -| :doc:`nonlinear ` | epsilon,r0 | type bonds | +| :doc:`nonlinear ` | lamda,epsilon,r0 | type bonds | +-----------------------------------------------------+---------------------------+------------+ ---------- @@ -378,8 +378,12 @@ sub-style name. The angle styles that currently work with fix adapt are: +--------------------------------------------------------------------+-----------------+-------------+ | :doc:`cosine ` | k | type angles | +--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`cosine/delta ` | k | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ | :doc:`cosine/periodic ` | k,b,n | type angles | +--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`cosine/squared ` | k,theta0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ | :doc:`cosine/squared/restricted ` | k,theta0 | type angles | +--------------------------------------------------------------------+-----------------+-------------+ | :doc:`dipole ` | k,gamma0 | type angles | From ae652b31da7afbcd2ccc40ddd584f85b9b5b4355 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 19:48:18 +0200 Subject: [PATCH 17/27] unit test for extract() in bond-gaussian.yaml --- unittest/force-styles/tests/bond-gaussian.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/bond-gaussian.yaml b/unittest/force-styles/tests/bond-gaussian.yaml index 469c01a7e79..298e31723c8 100644 --- a/unittest/force-styles/tests/bond-gaussian.yaml +++ b/unittest/force-styles/tests/bond-gaussian.yaml @@ -17,7 +17,10 @@ bond_coeff: ! | 4 300.0 1 0.0100 0.098 2.45 5 300.0 1 0.0100 0.098 2.85 equilibrium: 5 1.45 1.37 1.61 2.45 2.85 -extract: ! "" +extract: ! | + alpha 2 + width 2 + r0 2 natoms: 29 init_energy: 4638.6541482649545 init_stress: ! |2- From e3ab697dd2a1a8e457a37faedab224c78df25b18 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 19:49:24 +0200 Subject: [PATCH 18/27] unit test for extract() in angle-gaussian.yaml --- unittest/force-styles/tests/angle-gaussian.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-gaussian.yaml b/unittest/force-styles/tests/angle-gaussian.yaml index 0022862384c..8fbc353df35 100644 --- a/unittest/force-styles/tests/angle-gaussian.yaml +++ b/unittest/force-styles/tests/angle-gaussian.yaml @@ -16,7 +16,10 @@ angle_coeff: ! | 3 300.0 2 0.2189 8.66 88.1 0.5439 9.94 142.7 4 300.0 2 0.0214 14.29 85.3 0.3934 18.22 118.1 equilibrium: 4 1.5376350710070041 1.4887658519511628 1.5376350710070041 1.4887658519511628 -extract: ! "" +extract: ! | + alpha 2 + width 2 + theta0 2 natoms: 29 init_energy: 57.794009158943744 init_stress: ! |2- From f1a79e7df5c2c07265a331dfac0a26e95ec8ebb7 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 11 Oct 2024 19:55:28 +0200 Subject: [PATCH 19/27] Update fix_adapt.rst --- doc/src/fix_adapt.rst | 62 +++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index e322b167a63..1b5282f741e 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -331,6 +331,8 @@ sub-style name. The bond styles that currently work with fix adapt are: +-----------------------------------------------------+---------------------------+------------+ | :doc:`fene/nm ` | k,r0 | type bonds | +-----------------------------------------------------+---------------------------+------------+ +| :doc:`gaussian ` | alpha,width,r0 | type bonds | ++-----------------------------------------------------+---------------------------+------------+ | :doc:`gromos ` | k,r0 | type bonds | +-----------------------------------------------------+---------------------------+------------+ | :doc:`harmonic ` | k,r0 | type bonds | @@ -369,35 +371,37 @@ all types from 1 to :math:`N`. A leading asterisk means all types from If :doc:`angle_style hybrid ` is used, *astyle* should be a sub-style name. The angle styles that currently work with fix adapt are: -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`harmonic ` | k,theta0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`charmm ` | k,theta0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`class2 ` | k2,k3,k4,theta0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`cosine ` | k | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`cosine/delta ` | k | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`cosine/periodic ` | k,b,n | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`cosine/squared ` | k,theta0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`cosine/squared/restricted ` | k,theta0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`dipole ` | k,gamma0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`fourier ` | k,c0,c1,c2 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`fourier/simple ` | k,c,n | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`mm3 ` | k,theta0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`quartic ` | k2,k3,k4,theta0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ -| :doc:`spica ` | k,theta0 | type angles | -+--------------------------------------------------------------------+-----------------+-------------+ ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`harmonic ` | k,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`charmm ` | k,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`class2 ` | k2,k3,k4,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`cosine ` | k | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`cosine/delta ` | k | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`cosine/periodic ` | k,b,n | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`cosine/squared ` | k,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`cosine/squared/restricted ` | k,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`dipole ` | k,gamma0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`fourier ` | k,c0,c1,c2 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`fourier/simple ` | k,c,n | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`gaussian ` | alpha,width,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`mm3 ` | k,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`quartic ` | k2,k3,k4,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ +| :doc:`spica ` | k,theta0 | type angles | ++--------------------------------------------------------------------+--------------------+-------------+ Note that internally, theta0 is stored in radians, so the variable this fix uses to reset theta0 needs to generate values in radians. From 02d74417c1d11ebc9d0dd53fda0eff539c160aa7 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 12 Oct 2024 15:16:34 +0200 Subject: [PATCH 20/27] add extract() function to angle_cross.h --- src/YAFF/angle_cross.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/YAFF/angle_cross.h b/src/YAFF/angle_cross.h index fea7c0fbc49..ddf73fab0be 100644 --- a/src/YAFF/angle_cross.h +++ b/src/YAFF/angle_cross.h @@ -35,6 +35,7 @@ class AngleCross : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: double *kss, *kbs0, *kbs1, *r00, *r01, *theta0; From 7cc5f1923d9b8cf489bb3b4fd1a9e85728e8372c Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 12 Oct 2024 15:17:07 +0200 Subject: [PATCH 21/27] add extract() function to angle_cross.cpp --- src/YAFF/angle_cross.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/YAFF/angle_cross.cpp b/src/YAFF/angle_cross.cpp index d3e127e935a..067fe986e9d 100644 --- a/src/YAFF/angle_cross.cpp +++ b/src/YAFF/angle_cross.cpp @@ -342,3 +342,19 @@ double AngleCross::single(int type, int i1, int i2, int i3) double energy = kss[type]*dr1*dr2+kbs0[type]*dr1*dtheta + kbs1[type]*dr2*dtheta; return energy; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleCross::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "r00") == 0) return (void *) r00; + if (strcmp(str, "r01") == 0) return (void *) r01; + if (strcmp(str, "kss") == 0) return (void *) kss; + if (strcmp(str, "kbs0") == 0) return (void *) kbs0; + if (strcmp(str, "kbs1") == 0) return (void *) kbs1; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From 1ac351c84ee3182e3a41b7700fbfd1a2ede528ae Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 12 Oct 2024 15:19:08 +0200 Subject: [PATCH 22/27] unit test for extract() in angle-cross.yaml --- unittest/force-styles/tests/angle-cross.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-cross.yaml b/unittest/force-styles/tests/angle-cross.yaml index 61ae6c4748d..c03e4ab050e 100644 --- a/unittest/force-styles/tests/angle-cross.yaml +++ b/unittest/force-styles/tests/angle-cross.yaml @@ -16,7 +16,13 @@ angle_coeff: ! | 3 100.0 150.0 120.0 1.45 1.35 98.2 4 250.0 90.0 110.0 1.05 1.20 99.9 equilibrium: 4 1.8675022996339325 1.911135530933791 1.7139133254584316 1.7435839227423353 -extract: ! "" +extract: ! | + r00 1 + r01 1 + kss 1 + kbs0 1 + kbs1 1 + theta0 1 natoms: 29 init_energy: -138.93227715361755 init_stress: ! |- From 292ca89cb0dfdbc5ff9d2ce68d1abad311786ee8 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 14 Oct 2024 09:41:23 +0200 Subject: [PATCH 23/27] add extract() function to angle_amoeba.h --- src/AMOEBA/angle_amoeba.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AMOEBA/angle_amoeba.h b/src/AMOEBA/angle_amoeba.h index 24cf12c50ea..0110a1f1a45 100644 --- a/src/AMOEBA/angle_amoeba.h +++ b/src/AMOEBA/angle_amoeba.h @@ -36,6 +36,7 @@ class AngleAmoeba : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: int *pflag, *ubflag; From 0c61cb02cce838de805308c4ffaedea3bdd42dce Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 14 Oct 2024 09:42:04 +0200 Subject: [PATCH 24/27] add extract() function to angle_amoeba.cpp --- src/AMOEBA/angle_amoeba.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/AMOEBA/angle_amoeba.cpp b/src/AMOEBA/angle_amoeba.cpp index 54fc3e9f9ac..3b937568ff2 100644 --- a/src/AMOEBA/angle_amoeba.cpp +++ b/src/AMOEBA/angle_amoeba.cpp @@ -868,3 +868,19 @@ double AngleAmoeba::single(int type, int i1, int i2, int i3) return energy; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleAmoeba::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k2") == 0) return (void *) k2; + if (strcmp(str, "k3") == 0) return (void *) k3; + if (strcmp(str, "k4") == 0) return (void *) k4; + if (strcmp(str, "k5") == 0) return (void *) k5; + if (strcmp(str, "k6") == 0) return (void *) k6; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From 74af88bafd8f152f98de44c5885be19d31172ffb Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 14 Oct 2024 09:43:07 +0200 Subject: [PATCH 25/27] unit test for extract() in angle-amoeba.yaml --- unittest/force-styles/tests/angle-amoeba.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-amoeba.yaml b/unittest/force-styles/tests/angle-amoeba.yaml index 6265ce09fdb..e94a3c3b62d 100644 --- a/unittest/force-styles/tests/angle-amoeba.yaml +++ b/unittest/force-styles/tests/angle-amoeba.yaml @@ -20,7 +20,13 @@ angle_coeff: ! | * ub 0.0 0.0 4 ub -7.6 1.5537 equilibrium: 4 1.9320794819577227 1.9687313962496038 2.1676989309769574 1.8936822384138474 -extract: ! "" +extract: ! | + k2 1 + k3 1 + k4 1 + k5 1 + k6 1 + theta0 1 natoms: 29 init_energy: 22.644137017730763 init_stress: ! |2- From 1a6544a04c88fa5231f63deb60ca055fdbacaad8 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 14 Oct 2024 11:29:47 +0200 Subject: [PATCH 26/27] add extract() function to angle_mesocnt.h --- src/MESONT/angle_mesocnt.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MESONT/angle_mesocnt.h b/src/MESONT/angle_mesocnt.h index 50e06c68ce1..289ed97a0be 100644 --- a/src/MESONT/angle_mesocnt.h +++ b/src/MESONT/angle_mesocnt.h @@ -41,6 +41,7 @@ class AngleMesoCNT : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: int *buckling; From 6478cd98e98c7747523cf017a552dfa18ee3d1fe Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Mon, 14 Oct 2024 11:30:20 +0200 Subject: [PATCH 27/27] add extract() function to angle_mesocnt.cpp --- src/MESONT/angle_mesocnt.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/MESONT/angle_mesocnt.cpp b/src/MESONT/angle_mesocnt.cpp index c6dae4b0fb0..1394edc4c1e 100644 --- a/src/MESONT/angle_mesocnt.cpp +++ b/src/MESONT/angle_mesocnt.cpp @@ -396,3 +396,14 @@ double AngleMesoCNT::single(int type, int i1, int i2, int i3) else return kb[type] * dtheta + thetab[type] * (kh[type] * thetab[type] - kb[type]); } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleMesoCNT::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +}