fix enforce2d has to be defined after fixes with enforce2d_flag set

this check currently only applies to rigid fixes and is needed
so that their respective enforce2d function is called _after_
the post force functions. this is required in combination with
commit a9ff593763 to allow rigid
fixes use the langevin option correctly for 2d systems
This commit is contained in:
Axel Kohlmeyer
2017-07-12 11:26:16 -04:00
parent a9ff593763
commit 69d97fa60c

View File

@ -66,12 +66,21 @@ void FixEnforce2D::init()
if (modify->fix[i]->enforce2d_flag) nfixlist++;
if (nfixlist) {
int myindex = -1;
delete [] flist;
flist = new Fix*[nfixlist];
nfixlist = 0;
for (int i = 0; i < modify->nfix; i++) {
if (modify->fix[i]->enforce2d_flag)
flist[nfixlist++] = modify->fix[i];
if (modify->fix[i]->enforce2d_flag) {
if (myindex < 0)
flist[nfixlist++] = modify->fix[i];
else {
char msg[256];
sprintf(msg,"Fix enforce2d must be defined after fix %s",modify->fix[i]->style);
error->all(FLERR,msg);
}
}
if (modify->fix[i] == this) myindex = i;
}
}
}