modernize fix deform checks with fix nvt/sllod

This commit is contained in:
Axel Kohlmeyer
2023-01-01 12:54:57 -05:00
parent 7c66aeddf7
commit 8f541488fb
4 changed files with 36 additions and 40 deletions

View File

@ -73,23 +73,21 @@ void FixNVTSllodIntel::init()
FixNHIntel::init();
if (!temperature->tempbias)
error->all(FLERR,"Temperature for fix nvt/sllod does not have a bias");
error->all(FLERR,"Temperature for fix nvt/sllod/intel does not have a bias");
nondeformbias = 0;
if (strcmp(temperature->style,"temp/deform") != 0) nondeformbias = 1;
// check fix deform remap settings
int i;
for (i = 0; i < modify->nfix; i++)
if (strncmp(modify->fix[i]->style,"deform",6) == 0) {
if ((dynamic_cast<FixDeform *>(modify->fix[i]))->remapflag != Domain::V_REMAP)
error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform "
"remap option");
break;
}
if (i == modify->nfix)
error->all(FLERR,"Using fix nvt/sllod with no fix deform defined");
auto deform = modify->get_fix_by_style("^deform");
if (deform.size() < 1) error->all(FLERR,"Using fix nvt/sllod/intel with no fix deform defined");
for (auto ifix : deform) {
auto f = dynamic_cast<FixDeform *>(ifix);
if (f && (f->remapflag != Domain::V_REMAP))
error->all(FLERR,"Using fix nvt/sllod/intel with inconsistent fix deform remap option");
}
}
/* ----------------------------------------------------------------------

View File

@ -80,22 +80,22 @@ void FixNVTSllodKokkos<DeviceType>::init()
FixNHKokkos<DeviceType>::init();
if (!this->temperature->tempbias)
this->error->all(FLERR,"Temperature for fix nvt/sllod does not have a bias");
this->error->all(FLERR,"Temperature for fix nvt/sllod/kk does not have a bias");
nondeformbias = 0;
if (utils::strmatch(this->temperature->style,"^temp/deform")) nondeformbias = 1;
// check fix deform remap settings
int i;
for (i = 0; i < this->modify->nfix; i++)
if (utils::strmatch(this->modify->fix[i]->style,"^deform")) {
if (((FixDeform *) this->modify->fix[i])->remapflag != Domain::V_REMAP)
this->error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform remap option");
break;
}
if (i == this->modify->nfix)
this->error->all(FLERR,"Using fix nvt/sllod with no fix deform defined");
auto deform = this->modify->get_fix_by_style("^deform");
if (deform.size() < 1)
this->error->all(FLERR,"Using fix nvt/sllod/kk with no fix deform defined");
for (auto ifix : deform) {
auto f = dynamic_cast<FixDeform *>(ifix);
if (f && (f->remapflag != Domain::V_REMAP))
this->error->all(FLERR,"Using fix ntv/sllod/kk with inconsistent fix deform remap option");
}
}
/* ----------------------------------------------------------------------

View File

@ -87,15 +87,14 @@ void FixNVTSllodOMP::init()
// check fix deform remap settings
int i;
for (i = 0; i < modify->nfix; i++)
if (utils::strmatch(modify->fix[i]->style,"^deform")) {
if ((dynamic_cast<FixDeform *>(modify->fix[i]))->remapflag != Domain::V_REMAP)
error->all(FLERR,"Using fix nvt/sllod/omp with inconsistent fix deform remap option");
break;
}
if (i == modify->nfix)
error->all(FLERR,"Using fix nvt/sllod/omp with no fix deform defined");
auto deform = modify->get_fix_by_style("^deform");
if (deform.size() < 1) error->all(FLERR,"Using fix nvt/sllod/omp with no fix deform defined");
for (auto ifix : deform) {
auto f = dynamic_cast<FixDeform *>(ifix);
if (f && (f->remapflag != Domain::V_REMAP))
error->all(FLERR,"Using fix nvt/sllod/omp with inconsistent fix deform remap option");
}
}
/* ----------------------------------------------------------------------

View File

@ -75,22 +75,21 @@ void FixNVTSllod::init()
FixNH::init();
if (!temperature->tempbias)
error->all(FLERR,"Temperature for fix nvt/sllod does not have a bias");
error->all(FLERR,"Temperature for fix {} does not have a bias", style);
nondeformbias = 0;
if (strcmp(temperature->style,"temp/deform") != 0) nondeformbias = 1;
// check fix deform remap settings
int i;
for (i = 0; i < modify->nfix; i++)
if (strncmp(modify->fix[i]->style,"deform",6) == 0) {
if ((dynamic_cast<FixDeform *>(modify->fix[i]))->remapflag != Domain::V_REMAP)
error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform remap option");
break;
}
if (i == modify->nfix)
error->all(FLERR,"Using fix nvt/sllod with no fix deform defined");
auto deform = modify->get_fix_by_style("^deform");
if (deform.size() < 1) error->all(FLERR,"Using fix {} with no fix deform defined", style);
for (auto ifix : deform) {
auto f = dynamic_cast<FixDeform *>(ifix);
if (f && (f->remapflag != Domain::V_REMAP))
error->all(FLERR,"Using fix {} with inconsistent fix deform remap option", style);
}
}
/* ----------------------------------------------------------------------