This commit is contained in:
Axel Kohlmeyer
2021-09-15 16:46:33 -04:00
parent 3caa066c28
commit 36b3ee32a4
5 changed files with 21 additions and 64 deletions

View File

@ -2460,30 +2460,17 @@ double FixNPTCauchy::memory_usage()
void FixNPTCauchy::CauchyStat_init() void FixNPTCauchy::CauchyStat_init()
{ {
if (comm->me == 0) { if (comm->me == 0) {
if (screen) { std::string mesg = fmt::format("Using fix npt/cauchy with alpha={:f.8}\n",alpha);
fprintf(screen,"Using fix npt/cauchy with alpha=%f\n",alpha); if (restartPK==1) {
if (restartPK==1) { mesg += " (this is a continuation run)\n";
fprintf(screen," (this is a continuation run)\n"); } else {
} else { mesg += " (this is NOT a continuation run)\n";
fprintf(screen," (this is NOT a continuation run)\n");
}
}
if (logfile) {
fprintf(logfile,"Using fix npt/cauchy with alpha=%f\n",alpha);
if (restartPK==1) {
fprintf(logfile," this is a continuation run\n");
} else {
fprintf(logfile," this is NOT a continuation run\n");
}
} }
utils::logmesg(lmp, mesg);
} }
if (!id_store) { if (!id_store)
int n = strlen(id) + 14; id_store = utils::strdup(std::string(id) + "_FIX_NH_STORE");
id_store = new char[n];
strcpy(id_store,id);
strcat(id_store,"_FIX_NH_STORE");
}
restart_stored = modify->find_fix(id_store); restart_stored = modify->find_fix(id_store);
if (restartPK==1 && restart_stored < 0) if (restartPK==1 && restart_stored < 0)
@ -2491,19 +2478,10 @@ void FixNPTCauchy::CauchyStat_init()
" must follow a previously equilibrated npt/cauchy run"); " must follow a previously equilibrated npt/cauchy run");
if (alpha<=0.0) if (alpha<=0.0)
error->all(FLERR,"Illegal fix npt/cauchy command: " error->all(FLERR,"Illegal fix npt/cauchy command: Alpha cannot be zero or negative.");
" Alpha cannot be zero or negative.");
if (restart_stored < 0) { if (restart_stored < 0) {
char **newarg = new char *[6]; modify->add_fix(std::string(id_store) + "all STORE global 1 6");
newarg[0] = id_store;
newarg[1] = (char *) "all";
newarg[2] = (char *) "STORE";
newarg[3] = (char *) "global";
newarg[4] = (char *) "1";
newarg[5] = (char *) "6";
modify->add_fix(6,newarg);
delete[] newarg;
restart_stored = modify->find_fix(id_store); restart_stored = modify->find_fix(id_store);
} }
init_store = (FixStore *)modify->fix[restart_stored]; init_store = (FixStore *)modify->fix[restart_stored];

View File

@ -282,13 +282,9 @@ void FixAdaptFEP::init()
anypair = 1; anypair = 1;
Pair *pair = nullptr; Pair *pair = nullptr;
if (lmp->suffix_enable) { if (lmp->suffix_enable)
char psuffix[128]; pair = force->pair_match(std::string(pstyle)+"/"+lmp->suffix,1);
strcpy(psuffix,ad->pstyle);
strcat(psuffix,"/");
strcat(psuffix,lmp->suffix);
pair = force->pair_match(psuffix,1);
}
if (pair == nullptr) pair = force->pair_match(ad->pstyle,1); if (pair == nullptr) pair = force->pair_match(ad->pstyle,1);
if (pair == nullptr) if (pair == nullptr)
error->all(FLERR, "Fix adapt/fep pair style does not exist"); error->all(FLERR, "Fix adapt/fep pair style does not exist");

View File

@ -176,11 +176,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
if (universe->existflag == 1) { if (universe->existflag == 1) {
// Each replica writes an independent log file // Each replica writes an independent log file
// with suffix equal to the replica id // with suffix equal to the replica id
char str_num[32], logFile[1024]; p->cmd("setLogFile",fmt::format("{}.{}",arg[i],universe->iworld).c_str());
sprintf(str_num,".%d",universe->iworld);
strncpy(logFile,arg[i],1024-32);
strcat(logFile,str_num);
p->cmd("setLogFile",logFile);
next=0; next=0;
} else { } else {
// partition option not used // partition option not used

View File

@ -331,15 +331,9 @@ void FixAdapt::init()
nsub = utils::inumeric(FLERR,cptr+1,false,lmp); nsub = utils::inumeric(FLERR,cptr+1,false,lmp);
} }
if (lmp->suffix_enable) { if (lmp->suffix_enable)
int len = 2 + strlen(pstyle) + strlen(lmp->suffix); ad->pair = force->pair_match(fmt::format("{}/{}",pstyle,lmp->suffix),1,nsub);
char *psuffix = new char[len];
strcpy(psuffix,pstyle);
strcat(psuffix,"/");
strcat(psuffix,lmp->suffix);
ad->pair = force->pair_match(psuffix,1,nsub);
delete[] psuffix;
}
if (ad->pair == nullptr) ad->pair = force->pair_match(pstyle,1,nsub); if (ad->pair == nullptr) ad->pair = force->pair_match(pstyle,1,nsub);
if (ad->pair == nullptr) if (ad->pair == nullptr)
error->all(FLERR,"Fix adapt pair style does not exist"); error->all(FLERR,"Fix adapt pair style does not exist");
@ -374,15 +368,9 @@ void FixAdapt::init()
anybond = 1; anybond = 1;
char *bstyle = utils::strdup(ad->bstyle); char *bstyle = utils::strdup(ad->bstyle);
if (lmp->suffix_enable) { if (lmp->suffix_enable)
int len = 2 + strlen(bstyle) + strlen(lmp->suffix); ad->bond = force->bond_match(fmt::format("{}/{}",bstyle,lmp->suffix));
char *bsuffix = new char[len];
strcpy(bsuffix,bstyle);
strcat(bsuffix,"/");
strcat(bsuffix,lmp->suffix);
ad->bond = force->bond_match(bsuffix);
delete [] bsuffix;
}
if (ad->bond == nullptr) ad->bond = force->bond_match(bstyle); if (ad->bond == nullptr) ad->bond = force->bond_match(bstyle);
if (ad->bond == nullptr ) if (ad->bond == nullptr )
error->all(FLERR,"Fix adapt bond style does not exist"); error->all(FLERR,"Fix adapt bond style does not exist");

View File

@ -614,8 +614,7 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag)
} }
if (value == nullptr) if (value == nullptr)
error->one(FLERR,"Substitution for illegal " error->one(FLERR,"Substitution for illegal variable {}",var);
"variable {}",var);
// check if storage in str2 needs to be expanded // check if storage in str2 needs to be expanded
// re-initialize ptr and ptr2 to the point beyond the variable. // re-initialize ptr and ptr2 to the point beyond the variable.