avoid segfaults in USER-MESO by checking for required atom style flags

This commit is contained in:
Axel Kohlmeyer
2018-02-08 19:15:09 +01:00
parent 21fe88ffa8
commit a0de2f27a5
4 changed files with 18 additions and 4 deletions

View File

@ -61,6 +61,9 @@ int FixMvvDPD::setmask()
void FixMvvDPD::init()
{
if (!atom->vest_flag)
error->all(FLERR,"Fix mvv/dpd requires atom attribute vest");
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
}

View File

@ -282,6 +282,9 @@ void PairMDPD::init_style()
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair mdpd requires ghost atoms store velocity");
if (!atom->rho_flag)
error->all(FLERR,"Pair style mdpd requires atom attribute rho");
// if newton off, forces between atoms ij will be double computed
// using different random numbers

View File

@ -62,7 +62,11 @@ PairMDPDRhoSum::~PairMDPDRhoSum() {
init specific to this pair style
------------------------------------------------------------------------- */
void PairMDPDRhoSum::init_style() {
void PairMDPDRhoSum::init_style()
{
if (!atom->rho_flag)
error->all(FLERR,"Pair style mdpd/rhosum requires atom attribute rho");
// need a full neighbor list
int irequest = neighbor->request(this,instance_me);
neighbor->requests[irequest]->half = 0;

View File

@ -315,13 +315,17 @@ void PairTDPD::coeff(int narg, char **arg)
void PairTDPD::init_style()
{
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair tdpd requires ghost atoms store velocity");
error->all(FLERR,"Pair style tdpd requires ghost atoms store velocity");
if (!atom->tdpd_flag)
error->all(FLERR,"Pair style tdpd requires atom properties cc/cc_flux");
// if newton off, forces between atoms ij will be double computed
// using different random numbers
if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR,
"Pair tdpd needs newton pair on for momentum conservation");
if (force->newton_pair == 0 && comm->me == 0)
error->warning(FLERR,"Pair tdpd needs newton pair on "
"for momentum conservation");
neighbor->request(this,instance_me);
}