implement some examples for using the utils::strmatch() function and use it for inexact Force::pair_match()

This commit is contained in:
Axel Kohlmeyer
2019-01-02 16:44:31 -05:00
parent 7fcc76f071
commit bb36e6e3c8
6 changed files with 25 additions and 39 deletions

View File

@ -30,6 +30,7 @@
#include "neighbor.h"
#include "citeme.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
using namespace FixConst;
@ -221,12 +222,11 @@ void FixGPU::init()
// hybrid cannot be used with force/neigh option
if (_gpu_mode == GPU_NEIGH || _gpu_mode == GPU_HYB_NEIGH)
if (force->pair_match("hybrid",1) != NULL ||
force->pair_match("hybrid/overlay",1) != NULL)
if (force->pair_match("^hybrid",0) != NULL)
error->all(FLERR,"Cannot use pair hybrid with GPU neighbor list builds");
if (_particle_split < 0)
if (force->pair_match("hybrid",1) != NULL ||
force->pair_match("hybrid/overlay",1) != NULL)
if (force->pair_match("^hybrid",0) != NULL)
error->all(FLERR,"GPU split param must be positive "
"for hybrid pair styles");
@ -243,21 +243,16 @@ void FixGPU::init()
// make sure fdotr virial is not accumulated multiple times
if (force->pair_match("hybrid",1) != NULL) {
if (force->pair_match("^hybrid",0) != NULL) {
PairHybrid *hybrid = (PairHybrid *) force->pair;
for (int i = 0; i < hybrid->nstyles; i++)
if (strstr(hybrid->keywords[i],"/gpu")==NULL)
force->pair->no_virial_fdotr_compute = 1;
} else if (force->pair_match("hybrid/overlay",1) != NULL) {
PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair;
for (int i = 0; i < hybrid->nstyles; i++)
if (strstr(hybrid->keywords[i],"/gpu")==NULL)
if (utils::strmatch(hybrid->keywords[i],"/gpu$") == NULL)
force->pair->no_virial_fdotr_compute = 1;
}
// rRESPA support
if (strstr(update->integrate_style,"respa"))
if (utils::strmatch(update->integrate_style,"^respa"))
_nlevels_respa = ((Respa *) update->integrate)->nlevels;
}