Merge pull request #1973 from evoyiatzis/ext-fix-adapt

Small extension of bonds supported by fix adapt
This commit is contained in:
Axel Kohlmeyer
2020-04-01 14:02:02 -04:00
committed by GitHub
9 changed files with 59 additions and 5 deletions

View File

@ -288,11 +288,19 @@ Currently *bond* does not support bond_style hybrid nor bond_style
hybrid/overlay as bond styles. The only bonds that currently are
working with fix_adapt are
+---------------------------------+-------+------------+
| :doc:`gromos <bond_gromos>` | k, r0 | type bonds |
+---------------------------------+-------+------------+
| :doc:`harmonic <bond_harmonic>` | k,r0 | type bonds |
+---------------------------------+-------+------------+
+------------------------------------+-------+------------+
| :doc:`class2 <bond_class2>` | r0 | type bonds |
+------------------------------------+-------+------------+
| :doc:`fene <bond_fene>` | k, r0 | type bonds |
+------------------------------------+-------+------------+
| :doc:`gromos <bond_gromos>` | k, r0 | type bonds |
+------------------------------------+-------+------------+
| :doc:`harmonic <bond_harmonic>` | k,r0 | type bonds |
+------------------------------------+-------+------------+
| :doc:`morse <bond_morse>` | r0 | type bonds |
+------------------------------------+-------+------------+
| :doc:`nonlinear <bond_nonlinear>` | r0 | type bonds |
+------------------------------------+-------+------------+
----------

View File

@ -15,6 +15,7 @@
Contributing author: Eric Simon (Cray)
------------------------------------------------------------------------- */
#include <cstring>
#include "bond_class2.h"
#include <mpi.h>
#include <cmath>
@ -220,3 +221,12 @@ double BondClass2::single(int type, double rsq, int /*i*/, int /*j*/, double &ff
else fforce = 0.0;
return (k2[type]*dr2 + k3[type]*dr3 + k4[type]*dr4);
}
/* ---------------------------------------------------------------------- */
void *BondClass2::extract( char *str, int &dim )
{
dim = 1;
if (strcmp(str,"r0")==0) return (void*) r0;
return NULL;
}

View File

@ -35,6 +35,7 @@ class BondClass2 : public Bond {
virtual void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
virtual void *extract(char *, int &);
protected:
double *r0,*k2,*k3,*k4;

View File

@ -14,6 +14,7 @@
#include "bond_fene.h"
#include <mpi.h>
#include <cmath>
#include <cstring>
#include "atom.h"
#include "neighbor.h"
#include "comm.h"
@ -272,3 +273,13 @@ double BondFENE::single(int type, double rsq, int /*i*/, int /*j*/,
return eng;
}
/* ---------------------------------------------------------------------- */
void *BondFENE::extract( char *str, int &dim )
{
dim = 1;
if (strcmp(str,"kappa")==0) return (void*) k;
if (strcmp(str,"r0")==0) return (void*) r0;
return NULL;
}

View File

@ -36,6 +36,7 @@ class BondFENE : public Bond {
void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
virtual void *extract(char *, int &);
protected:
double TWO_1_3;

View File

@ -18,6 +18,7 @@
#include "bond_morse.h"
#include <mpi.h>
#include <cmath>
#include <cstring>
#include "atom.h"
#include "neighbor.h"
#include "comm.h"
@ -205,3 +206,12 @@ double BondMorse::single(int type, double rsq, int /*i*/, int /*j*/,
if (r > 0.0) fforce = -2.0*d0[type]*alpha[type]*(1-ralpha)*ralpha/r;
return d0[type]*(1-ralpha)*(1-ralpha);
}
/* ---------------------------------------------------------------------- */
void *BondMorse::extract(char *str, int &dim )
{
dim = 1;
if (strcmp(str,"r0")==0) return (void*) r0;
return NULL;
}

View File

@ -35,6 +35,7 @@ class BondMorse : public Bond {
void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
virtual void *extract(char *, int &);
protected:
double *d0,*alpha,*r0;

View File

@ -14,6 +14,7 @@
#include "bond_nonlinear.h"
#include <mpi.h>
#include <cmath>
#include <cstring>
#include "atom.h"
#include "neighbor.h"
#include "comm.h"
@ -202,3 +203,13 @@ double BondNonlinear::single(int type, double rsq, int /*i*/, int /*j*/,
fforce = -epsilon[type]/r * 2.0*dr*lamdasq/denomsq;
return epsilon[type] * drsq / denom;
}
/* ---------------------------------------------------------------------- */
void *BondNonlinear::extract( char *str, int &dim )
{
dim = 1;
if (strcmp(str,"epsilon")==0) return (void*) epsilon;
if (strcmp(str,"r0")==0) return (void*) r0;
return NULL;
}

View File

@ -35,6 +35,7 @@ class BondNonlinear : public Bond {
void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
virtual void *extract(char *, int &);
protected:
double *epsilon,*r0,*lamda;