Merge pull request #2644 from akohlmey/collected-small-changes

Small bug fix for fixes to fix deposit and fix pour
This commit is contained in:
Axel Kohlmeyer
2021-03-08 16:26:39 -05:00
committed by GitHub
6 changed files with 25 additions and 13 deletions

View File

@ -301,9 +301,8 @@ one line to give the program's name and an idea of what it does.
Copyright (C) yyyy name of author Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License version 2 as
the Free Software Foundation; either version 2 of the License, or (at published by the Free Software Foundation.
your option) any later version.
This program is distributed in the hope that it will be useful, but This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of

View File

@ -375,7 +375,8 @@ void FixPour::init()
void FixPour::setup_pre_exchange() void FixPour::setup_pre_exchange()
{ {
next_reneighbor = update->ntimestep + 1; if (ninserted < ninsert) next_reneighbor = update->ntimestep + 1;
else next_reneighbor = 0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -296,7 +296,8 @@ void FixDeposit::init()
void FixDeposit::setup_pre_exchange() void FixDeposit::setup_pre_exchange()
{ {
next_reneighbor = update->ntimestep+1; if (ninserted < ninsert) next_reneighbor = update->ntimestep+1;
else next_reneighbor = 0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -49,14 +49,19 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) {
python->init(); python->init();
// add current directory to PYTHONPATH // add current directory to PYTHONPATH
PyObject * py_path = PySys_GetObject((char *)"path");
PyGILState_STATE gstate = PyGILState_Ensure();
PyObject *py_path = PySys_GetObject((char *)"path");
PyList_Append(py_path, PY_STRING_FROM_STRING(".")); PyList_Append(py_path, PY_STRING_FROM_STRING("."));
// if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well // if LAMMPS_POTENTIALS environment variable is set,
const char * potentials_path = getenv("LAMMPS_POTENTIALS"); // add it to PYTHONPATH as well
const char *potentials_path = getenv("LAMMPS_POTENTIALS");
if (potentials_path != nullptr) { if (potentials_path != nullptr) {
PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path));
} }
PyGILState_Release(gstate);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -64,9 +64,15 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
#else #else
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD); try {
lammps->input->file(); LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
delete lammps; lammps->input->file();
delete lammps;
} catch(fmt::format_error &fe) {
fprintf(stderr,"fmt::format_error: %s\n", fe.what());
MPI_Abort(MPI_COMM_WORLD, 1);
exit(1);
}
#endif #endif
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize(); MPI_Finalize();

View File

@ -691,7 +691,7 @@ std::string utils::utf8_subst(const std::string &line)
out += ' ', i += 2; out += ' ', i += 2;
} }
// UTF-8 4-byte character // UTF-8 4-byte character
} else if ((in[i] & 0xe8U) == 0xf0U) { } else if ((in[i] & 0xf8U) == 0xf0U) {
if ((i+3) < len) { if ((i+3) < len) {
; ;
} }