use portable functions from platform and utils namespaces
This commit is contained in:
@ -303,7 +303,7 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
|
||||
me = comm->me;
|
||||
root2root = MPI_COMM_NULL;
|
||||
|
||||
conf_file = strdup(arg[3]);
|
||||
conf_file = utils::strdup(arg[3]);
|
||||
rng_seed = 1966;
|
||||
unwrap_flag = 1;
|
||||
|
||||
@ -319,22 +319,22 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
|
||||
error->all(FLERR,"Missing argument to keyword");
|
||||
|
||||
if (0 == strcmp(arg[iarg], "input")) {
|
||||
inp_name = strdup(arg[iarg+1]);
|
||||
inp_name = utils::strdup(arg[iarg+1]);
|
||||
} else if (0 == strcmp(arg[iarg], "output")) {
|
||||
out_name = strdup(arg[iarg+1]);
|
||||
out_name = utils::strdup(arg[iarg+1]);
|
||||
} else if (0 == strcmp(arg[iarg], "seed")) {
|
||||
rng_seed = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
} else if (0 == strcmp(arg[iarg], "unwrap")) {
|
||||
unwrap_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
} else if (0 == strcmp(arg[iarg], "tstat")) {
|
||||
tmp_name = strdup(arg[iarg+1]);
|
||||
tmp_name = utils::strdup(arg[iarg+1]);
|
||||
} else {
|
||||
error->all(FLERR,"Unknown fix colvars parameter");
|
||||
}
|
||||
++iarg; ++iarg;
|
||||
}
|
||||
|
||||
if (!out_name) out_name = strdup("out");
|
||||
if (!out_name) out_name = utils::strdup("out");
|
||||
|
||||
/* initialize various state variables. */
|
||||
tstat_id = -1;
|
||||
@ -359,10 +359,10 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
FixColvars::~FixColvars()
|
||||
{
|
||||
memory->sfree(conf_file);
|
||||
memory->sfree(inp_name);
|
||||
memory->sfree(out_name);
|
||||
memory->sfree(tmp_name);
|
||||
delete[] conf_file;
|
||||
delete[] inp_name;
|
||||
delete[] out_name;
|
||||
delete[] tmp_name;
|
||||
memory->sfree(comm_buf);
|
||||
|
||||
if (proxy) {
|
||||
@ -430,17 +430,15 @@ void FixColvars::one_time_init()
|
||||
// create and initialize the colvars proxy
|
||||
|
||||
if (me == 0) {
|
||||
if (screen) fputs("colvars: Creating proxy instance\n",screen);
|
||||
if (logfile) fputs("colvars: Creating proxy instance\n",logfile);
|
||||
utils::logmesg(lmp,"colvars: Creating proxy instance\n");
|
||||
|
||||
#ifdef LAMMPS_BIGBIG
|
||||
if (screen) fputs("colvars: cannot handle atom ids > 2147483647\n",screen);
|
||||
if (logfile) fputs("colvars: cannot handle atom ids > 2147483647\n",logfile);
|
||||
utils::logmesg(lmp,"colvars: cannot handle atom ids > 2147483647\n");
|
||||
#endif
|
||||
|
||||
if (inp_name) {
|
||||
if (strcmp(inp_name,"NULL") == 0) {
|
||||
memory->sfree(inp_name);
|
||||
delete[] inp_name;
|
||||
inp_name = nullptr;
|
||||
}
|
||||
}
|
||||
@ -458,8 +456,7 @@ void FixColvars::one_time_init()
|
||||
}
|
||||
}
|
||||
|
||||
proxy = new colvarproxy_lammps(lmp,inp_name,out_name,
|
||||
rng_seed,t_target,root2root);
|
||||
proxy = new colvarproxy_lammps(lmp,inp_name,out_name,rng_seed,t_target,root2root);
|
||||
proxy->init(conf_file);
|
||||
|
||||
num_coords = (proxy->modify_atom_positions()->size());
|
||||
|
||||
Reference in New Issue
Block a user