support angle style hybrid with fix adapt
This commit is contained in:
@ -360,9 +360,8 @@ all types from 1 to :math:`N`. A leading asterisk means all types from
|
||||
:math:`N` (inclusive). A middle asterisk means all types from m to n
|
||||
(inclusive).
|
||||
|
||||
Currently *angle* does not support angle_style hybrid nor angle_style
|
||||
hybrid/overlay as angle styles. The angle styles that currently work
|
||||
with fix adapt are
|
||||
If :doc:`angle_style hybrid <angle_hybrid>` is used, *astyle* should be a
|
||||
sub-style name. The angle styles that currently work with fix adapt are:
|
||||
|
||||
+------------------------------------+----------+-------------+
|
||||
| :doc:`harmonic <angle_harmonic>` | k,theta0 | type angles |
|
||||
|
||||
@ -320,6 +320,14 @@ void AngleHybrid::init_style()
|
||||
if (styles[m]) styles[m]->init_style();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int AngleHybrid::check_itype(int itype, char *substyle)
|
||||
{
|
||||
if (strcmp(keywords[map[itype]], substyle) == 0) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return an equilbrium angle length
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -42,8 +42,10 @@ class AngleHybrid : public Angle {
|
||||
double single(int, int, int, int) override;
|
||||
double memory_usage() override;
|
||||
|
||||
int check_itype(int, char *);
|
||||
|
||||
protected:
|
||||
int *map; // which style each angle type points to
|
||||
int *map; // which style each angle type points to
|
||||
int *nanglelist; // # of angles in sub-style anglelists
|
||||
int *maxangle; // max # of angles sub-style lists can store
|
||||
int ***anglelist; // anglelist for each sub-style
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include "fix_adapt.h"
|
||||
|
||||
#include "angle.h"
|
||||
#include "angle_hybrid.h"
|
||||
#include "atom.h"
|
||||
#include "bond.h"
|
||||
#include "bond_hybrid.h"
|
||||
@ -455,8 +456,16 @@ void FixAdapt::init()
|
||||
|
||||
if (ad->adim == 1) ad->vector = (double *) ptr;
|
||||
|
||||
if (utils::strmatch(force->angle_style,"^hybrid"))
|
||||
error->all(FLERR,"Fix adapt does not support angle_style hybrid");
|
||||
if (utils::strmatch(force->angle_style,"^hybrid")) {
|
||||
auto angle = dynamic_cast<AngleHybrid *>(force->angle);
|
||||
if (angle) {
|
||||
for (i = ad->ilo; i <= ad->ihi; i++) {
|
||||
if (!angle->check_itype(i,astyle))
|
||||
error->all(FLERR,"Fix adapt type angle range is not valid "
|
||||
"for pair hybrid sub-style {}", astyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete[] astyle;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user