Skip to content
Snippets Groups Projects
Commit 8e9d4f5b authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

modify bond style hybrid, so it can handle bond style quartic as a sub-style

parent f68d77c7
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,7 @@ BondHybrid::BondHybrid(LAMMPS *lmp) : Bond(lmp) ...@@ -33,6 +33,7 @@ BondHybrid::BondHybrid(LAMMPS *lmp) : Bond(lmp)
{ {
writedata = 0; writedata = 0;
nstyles = 0; nstyles = 0;
has_quartic = -1;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
...@@ -171,6 +172,7 @@ void BondHybrid::settings(int narg, char **arg) ...@@ -171,6 +172,7 @@ void BondHybrid::settings(int narg, char **arg)
delete [] styles; delete [] styles;
for (int i = 0; i < nstyles; i++) delete [] keywords[i]; for (int i = 0; i < nstyles; i++) delete [] keywords[i];
delete [] keywords; delete [] keywords;
has_quartic = -1;
} }
if (allocated) { if (allocated) {
...@@ -214,14 +216,26 @@ void BondHybrid::settings(int narg, char **arg) ...@@ -214,14 +216,26 @@ void BondHybrid::settings(int narg, char **arg)
i = 0; i = 0;
while (i < narg) { while (i < narg) {
for (m = 0; m < nstyles; m++) for (m = 0; m < nstyles; m++)
if (strcmp(arg[i],keywords[m]) == 0) if (strcmp(arg[i],keywords[m]) == 0)
error->all(FLERR,"Bond style hybrid cannot use same bond style twice"); error->all(FLERR,"Bond style hybrid cannot use same bond style twice");
if (strcmp(arg[i],"hybrid") == 0) if (strcmp(arg[i],"hybrid") == 0)
error->all(FLERR,"Bond style hybrid cannot have hybrid as an argument"); error->all(FLERR,"Bond style hybrid cannot have hybrid as an argument");
if (strcmp(arg[i],"none") == 0)
error->all(FLERR,"Bond style hybrid cannot have none as an argument");
if (strcmp(arg[i],"none") == 0) if (strcmp(arg[i],"none") == 0)
error->all(FLERR,"Bond style hybrid cannot have none as an argument"); error->all(FLERR,"Bond style hybrid cannot have none as an argument");
// register index of quartic bond type,
// so that bond type 0 can be mapped to it
if (strncmp(arg[i],"quartic",7) == 0)
has_quartic = m;
styles[nstyles] = force->new_bond(arg[i],1,dummy); styles[nstyles] = force->new_bond(arg[i],1,dummy);
force->store_style(keywords[nstyles],arg[i],0); force->store_style(keywords[nstyles],arg[i],0);
...@@ -283,6 +297,12 @@ void BondHybrid::init_style() ...@@ -283,6 +297,12 @@ void BondHybrid::init_style()
{ {
for (int m = 0; m < nstyles; m++) for (int m = 0; m < nstyles; m++)
if (styles[m]) styles[m]->init_style(); if (styles[m]) styles[m]->init_style();
// bond style quartic will set broken bonds to bond type 0, so we need
// to create an entry for it in the bond type to sub-style map
if (has_quartic >= 0)
map[0] = has_quartic;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
......
...@@ -47,7 +47,7 @@ class BondHybrid : public Bond { ...@@ -47,7 +47,7 @@ class BondHybrid : public Bond {
private: private:
int *map; // which style each bond type points to int *map; // which style each bond type points to
int has_quartic; // which style, if any is a quartic bond style
int *nbondlist; // # of bonds in sub-style bondlists int *nbondlist; // # of bonds in sub-style bondlists
int *maxbond; // max # of bonds sub-style lists can store int *maxbond; // max # of bonds sub-style lists can store
int ***bondlist; // bondlist for each sub-style int ***bondlist; // bondlist for each sub-style
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment