forked from lijiext/lammps
Merge branch 'modify-add-returns-index' of github.com:akohlmey/lammps into modify-add-returns-index
# Conflicts: # src/GRANULAR/pair_gran_hooke_history.cpp
This commit is contained in:
commit
1d98388129
|
@ -3,7 +3,7 @@ if(NOT FOUND_IMMINTRIN)
|
||||||
message(FATAL_ERROR "immintrin.h header not found, Intel package won't work without it")
|
message(FATAL_ERROR "immintrin.h header not found, Intel package won't work without it")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_USER_INTEL)
|
target_compile_definitions(lammps PRIVATE -DLMP_INTEL)
|
||||||
|
|
||||||
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by INTEL (cpu or knl)")
|
set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by INTEL (cpu or knl)")
|
||||||
set(INTEL_ARCH_VALUES cpu knl)
|
set(INTEL_ARCH_VALUES cpu knl)
|
||||||
|
|
|
@ -114,5 +114,5 @@ else()
|
||||||
target_link_libraries(lmp PRIVATE ${mdi_LIBRARY})
|
target_link_libraries(lmp PRIVATE ${mdi_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_USER_MDI)
|
target_compile_definitions(lammps PRIVATE -DLMP_MDI)
|
||||||
target_compile_definitions(lmp PRIVATE -DLMP_USER_MDI)
|
target_compile_definitions(lmp PRIVATE -DLMP_MDI)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
${OPENMP_SOURCES_DIR}/fix_nh_omp.cpp
|
${OPENMP_SOURCES_DIR}/fix_nh_omp.cpp
|
||||||
${OPENMP_SOURCES_DIR}/fix_nh_sphere_omp.cpp
|
${OPENMP_SOURCES_DIR}/fix_nh_sphere_omp.cpp
|
||||||
${OPENMP_SOURCES_DIR}/domain_omp.cpp)
|
${OPENMP_SOURCES_DIR}/domain_omp.cpp)
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_USER_OMP)
|
target_compile_definitions(lammps PRIVATE -DLMP_OPENMP)
|
||||||
set_property(GLOBAL PROPERTY "OMP_SOURCES" "${OPENMP_SOURCES}")
|
set_property(GLOBAL PROPERTY "OMP_SOURCES" "${OPENMP_SOURCES}")
|
||||||
|
|
||||||
# detects styles which have OPENMP version
|
# detects styles which have OPENMP version
|
||||||
|
|
|
@ -67,7 +67,8 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
|
||||||
// this is so final order of Modify:fix will conform to input script
|
// this is so final order of Modify:fix will conform to input script
|
||||||
|
|
||||||
fix_history = nullptr;
|
fix_history = nullptr;
|
||||||
fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY all DUMMY");
|
fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY"
|
||||||
|
+ std::to_string(instance_me) + " all DUMMY");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
@ -78,8 +79,8 @@ PairGranHookeHistory::~PairGranHookeHistory()
|
||||||
|
|
||||||
delete [] svector;
|
delete [] svector;
|
||||||
|
|
||||||
if (!fix_history) modify->delete_fix("NEIGH_HISTORY_HH_DUMMY");
|
if (!fix_history) modify->delete_fix("NEIGH_HISTORY_HH_DUMMY"+std::to_string(instance_me));
|
||||||
else modify->delete_fix("NEIGH_HISTORY_HH");
|
else modify->delete_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me));
|
||||||
|
|
||||||
if (allocated) {
|
if (allocated) {
|
||||||
memory->destroy(setflag);
|
memory->destroy(setflag);
|
||||||
|
@ -434,8 +435,9 @@ void PairGranHookeHistory::init_style()
|
||||||
// this is so its order in the fix list is preserved
|
// this is so its order in the fix list is preserved
|
||||||
|
|
||||||
if (history && (fix_history == nullptr)) {
|
if (history && (fix_history == nullptr)) {
|
||||||
auto cmd = fmt::format("NEIGH_HISTORY_HH all NEIGH_HISTORY {}", size_history);
|
auto cmd = fmt::format("NEIGH_HISTORY_HH{} all NEIGH_HISTORY {}", instance_me, size_history);
|
||||||
fix_history = (FixNeighHistory *) modify->replace_fix("NEIGH_HISTORY_HH_DUMMY", cmd, 1);
|
fix_history = (FixNeighHistory *) modify->replace_fix("NEIGH_HISTORY_HH_DUMMY"
|
||||||
|
+ std::to_string(instance_me),cmd,1);
|
||||||
fix_history->pair = this;
|
fix_history->pair = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +495,7 @@ void PairGranHookeHistory::init_style()
|
||||||
// set fix which stores history info
|
// set fix which stores history info
|
||||||
|
|
||||||
if (history) {
|
if (history) {
|
||||||
int ifix = modify->find_fix("NEIGH_HISTORY_HH");
|
int ifix = modify->find_fix("NEIGH_HISTORY_HH"+std::to_string(instance_me));
|
||||||
if (ifix < 0) error->all(FLERR,"Could not find pair fix neigh history ID");
|
if (ifix < 0) error->all(FLERR,"Could not find pair fix neigh history ID");
|
||||||
fix_history = (FixNeighHistory *) modify->fix[ifix];
|
fix_history = (FixNeighHistory *) modify->fix[ifix];
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ if (test $mode = 1) then
|
||||||
|
|
||||||
if (test -e ../Makefile.package) then
|
if (test -e ../Makefile.package) then
|
||||||
sed -i -e 's/[^ \t]*INTEL[^ \t]* //' ../Makefile.package
|
sed -i -e 's/[^ \t]*INTEL[^ \t]* //' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_INTEL |' ../Makefile.package
|
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_INTEL |' ../Makefile.package
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif (test $mode = 0) then
|
elif (test $mode = 0) then
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#ifndef LMP_INTEL_PREPROCESS_H
|
#ifndef LMP_INTEL_PREPROCESS_H
|
||||||
#define LMP_INTEL_PREPROCESS_H
|
#define LMP_INTEL_PREPROCESS_H
|
||||||
|
|
||||||
// LAMMPS_MEMALIGN is set to 64 by default for -DLMP_USER_INTEL
|
// LAMMPS_MEMALIGN is set to 64 by default for -DLMP_INTEL
|
||||||
// so we only need to error out in case of a different alignment
|
// so we only need to error out in case of a different alignment
|
||||||
#if LAMMPS_MEMALIGN && (LAMMPS_MEMALIGN != 64)
|
#if LAMMPS_MEMALIGN && (LAMMPS_MEMALIGN != 64)
|
||||||
#error Please set -DLAMMPS_MEMALIGN=64 in CCFLAGS of your LAMMPS makefile for INTEL package
|
#error Please set -DLAMMPS_MEMALIGN=64 in CCFLAGS of your LAMMPS makefile for INTEL package
|
||||||
|
|
|
@ -40,7 +40,7 @@ if (test $1 = 1) then
|
||||||
sed -i -e 's/[^ \t]*mdi[^ \t]* //g' ../Makefile.package
|
sed -i -e 's/[^ \t]*mdi[^ \t]* //g' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_INC =[ \t]*|&-I../../lib/mdi/includelink |' ../Makefile.package
|
sed -i -e 's|^PKG_INC =[ \t]*|&-I../../lib/mdi/includelink |' ../Makefile.package
|
||||||
sed -i -e 's/[^ \t]*MDI[^ \t]* //' ../Makefile.package
|
sed -i -e 's/[^ \t]*MDI[^ \t]* //' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_MDI |' ../Makefile.package
|
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_MDI |' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_PATH =[ \t]*|&-L../../lib/mdi/liblink |' ../Makefile.package
|
sed -i -e 's|^PKG_PATH =[ \t]*|&-L../../lib/mdi/liblink |' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_LIB =[ \t]*|&-lmdi |' ../Makefile.package
|
sed -i -e 's|^PKG_LIB =[ \t]*|&-lmdi |' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(mdi_SYSINC) |' ../Makefile.package
|
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(mdi_SYSINC) |' ../Makefile.package
|
||||||
|
|
|
@ -54,7 +54,7 @@ if (test $mode = 1) then
|
||||||
|
|
||||||
if (test -e ../Makefile.package) then
|
if (test -e ../Makefile.package) then
|
||||||
sed -i -e 's/[^ \t]*OMP[^ \t]* //' ../Makefile.package
|
sed -i -e 's/[^ \t]*OMP[^ \t]* //' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_OMP |' ../Makefile.package
|
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_OPENMP |' ../Makefile.package
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# need to delete a bunch of dependency files because they
|
# need to delete a bunch of dependency files because they
|
||||||
|
@ -65,7 +65,7 @@ if (test $mode = 1) then
|
||||||
rm -f ../Obj_*/$f
|
rm -f ../Obj_*/$f
|
||||||
done
|
done
|
||||||
|
|
||||||
# force rebuild of files with LMP_USER_OMP switch
|
# force rebuild of files with LMP_OPENMP switch
|
||||||
|
|
||||||
touch ../accelerator_omp.h
|
touch ../accelerator_omp.h
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ elif (test $mode = 0) then
|
||||||
rm -f ../Obj_*/$f
|
rm -f ../Obj_*/$f
|
||||||
done
|
done
|
||||||
|
|
||||||
# force rebuild of files with LMP_USER_OMP switch
|
# force rebuild of files with LMP_OPENMP switch
|
||||||
|
|
||||||
touch ../accelerator_omp.h
|
touch ../accelerator_omp.h
|
||||||
|
|
||||||
|
|
|
@ -309,113 +309,16 @@ void FixReaxFFSpecies::init()
|
||||||
|
|
||||||
if (!setupflag) {
|
if (!setupflag) {
|
||||||
// create a compute to store properties
|
// create a compute to store properties
|
||||||
create_compute();
|
modify->add_compute("SPECATOM all SPEC/ATOM q x y z vx vy vz abo01 abo02 abo03 abo04 "
|
||||||
|
"abo05 abo06 abo07 abo08 abo09 abo10 abo11 abo12 abo13 abo14 "
|
||||||
|
"abo15 abo16 abo17 abo18 abo19 abo20 abo21 abo22 abo23 abo24");
|
||||||
|
|
||||||
// create a fix to point to fix_ave_atom for averaging stored properties
|
// create a fix to point to fix_ave_atom for averaging stored properties
|
||||||
create_fix();
|
auto fixcmd = fmt::format("SPECBOND all ave/atom {} {} {}",tmparg[0],tmparg[1],tmparg[2]);
|
||||||
|
for (int i = 1; i < 32; ++i) fixcmd += " c_SPECATOM[" + std::to_string(i) + "]";
|
||||||
|
f_SPECBOND = (FixAveAtom *) modify->add_fix(fixcmd);
|
||||||
setupflag = 1;
|
setupflag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void FixReaxFFSpecies::create_compute()
|
|
||||||
{
|
|
||||||
int narg;
|
|
||||||
char **args;
|
|
||||||
|
|
||||||
narg = 34;
|
|
||||||
args = new char*[narg];
|
|
||||||
args[0] = (char *) "SPECATOM";
|
|
||||||
args[1] = (char *) "all";
|
|
||||||
args[2] = (char *) "SPEC/ATOM";
|
|
||||||
args[3] = (char *) "q";
|
|
||||||
args[4] = (char *) "x";
|
|
||||||
args[5] = (char *) "y";
|
|
||||||
args[6] = (char *) "z";
|
|
||||||
args[7] = (char *) "vx";
|
|
||||||
args[8] = (char *) "vy";
|
|
||||||
args[9] = (char *) "vz";
|
|
||||||
args[10] = (char *) "abo01";
|
|
||||||
args[11] = (char *) "abo02";
|
|
||||||
args[12] = (char *) "abo03";
|
|
||||||
args[13] = (char *) "abo04";
|
|
||||||
args[14] = (char *) "abo05";
|
|
||||||
args[15] = (char *) "abo06";
|
|
||||||
args[16] = (char *) "abo07";
|
|
||||||
args[17] = (char *) "abo08";
|
|
||||||
args[18] = (char *) "abo09";
|
|
||||||
args[19] = (char *) "abo10";
|
|
||||||
args[20] = (char *) "abo11";
|
|
||||||
args[21] = (char *) "abo12";
|
|
||||||
args[22] = (char *) "abo13";
|
|
||||||
args[23] = (char *) "abo14";
|
|
||||||
args[24] = (char *) "abo15";
|
|
||||||
args[25] = (char *) "abo16";
|
|
||||||
args[26] = (char *) "abo17";
|
|
||||||
args[27] = (char *) "abo18";
|
|
||||||
args[28] = (char *) "abo19";
|
|
||||||
args[29] = (char *) "abo20";
|
|
||||||
args[30] = (char *) "abo21";
|
|
||||||
args[31] = (char *) "abo22";
|
|
||||||
args[32] = (char *) "abo23";
|
|
||||||
args[33] = (char *) "abo24";
|
|
||||||
modify->add_compute(narg,args);
|
|
||||||
delete [] args;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void FixReaxFFSpecies::create_fix()
|
|
||||||
{
|
|
||||||
int narg;
|
|
||||||
char **args;
|
|
||||||
|
|
||||||
narg = 37;
|
|
||||||
args = new char*[narg];
|
|
||||||
args[0] = (char *) "SPECBOND";
|
|
||||||
args[1] = (char *) "all";
|
|
||||||
args[2] = (char *) "ave/atom";
|
|
||||||
args[3] = tmparg[0];
|
|
||||||
args[4] = tmparg[1];
|
|
||||||
args[5] = tmparg[2];
|
|
||||||
args[6] = (char *) "c_SPECATOM[1]"; // q, array_atoms[i][0]
|
|
||||||
args[7] = (char *) "c_SPECATOM[2]"; // x, 1
|
|
||||||
args[8] = (char *) "c_SPECATOM[3]"; // y, 2
|
|
||||||
args[9] = (char *) "c_SPECATOM[4]"; // z, 3
|
|
||||||
args[10] = (char *) "c_SPECATOM[5]"; // vx, 4
|
|
||||||
args[11] = (char *) "c_SPECATOM[6]"; // vy, 5
|
|
||||||
args[12] = (char *) "c_SPECATOM[7]"; // vz, 6
|
|
||||||
args[13] = (char *) "c_SPECATOM[8]"; // abo01, 7
|
|
||||||
args[14] = (char *) "c_SPECATOM[9]";
|
|
||||||
args[15] = (char *) "c_SPECATOM[10]";
|
|
||||||
args[16] = (char *) "c_SPECATOM[11]";
|
|
||||||
args[17] = (char *) "c_SPECATOM[12]";
|
|
||||||
args[18] = (char *) "c_SPECATOM[13]";
|
|
||||||
args[19] = (char *) "c_SPECATOM[14]";
|
|
||||||
args[20] = (char *) "c_SPECATOM[15]";
|
|
||||||
args[21] = (char *) "c_SPECATOM[16]";
|
|
||||||
args[22] = (char *) "c_SPECATOM[17]";
|
|
||||||
args[23] = (char *) "c_SPECATOM[18]";
|
|
||||||
args[24] = (char *) "c_SPECATOM[19]"; // abo12, 18
|
|
||||||
args[25] = (char *) "c_SPECATOM[20]";
|
|
||||||
args[26] = (char *) "c_SPECATOM[21]";
|
|
||||||
args[27] = (char *) "c_SPECATOM[22]";
|
|
||||||
args[28] = (char *) "c_SPECATOM[23]";
|
|
||||||
args[29] = (char *) "c_SPECATOM[24]";
|
|
||||||
args[30] = (char *) "c_SPECATOM[25]";
|
|
||||||
args[31] = (char *) "c_SPECATOM[26]";
|
|
||||||
args[32] = (char *) "c_SPECATOM[27]";
|
|
||||||
args[33] = (char *) "c_SPECATOM[28]";
|
|
||||||
args[34] = (char *) "c_SPECATOM[29]";
|
|
||||||
args[35] = (char *) "c_SPECATOM[30]";
|
|
||||||
args[36] = (char *) "c_SPECATOM[31]";
|
|
||||||
modify->add_fix(narg,args);
|
|
||||||
f_SPECBOND = (FixAveAtom *) modify->fix[modify->nfix-1];
|
|
||||||
delete [] args;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
|
@ -61,8 +61,6 @@ class FixReaxFFSpecies : public Fix {
|
||||||
char *ele, **eletype, *filepos;
|
char *ele, **eletype, *filepos;
|
||||||
|
|
||||||
void Output_ReaxFF_Bonds(bigint, FILE *);
|
void Output_ReaxFF_Bonds(bigint, FILE *);
|
||||||
void create_compute();
|
|
||||||
void create_fix();
|
|
||||||
AtomCoord chAnchor(AtomCoord, AtomCoord);
|
AtomCoord chAnchor(AtomCoord, AtomCoord);
|
||||||
virtual void FindMolecule();
|
virtual void FindMolecule();
|
||||||
void SortMolecule(int &);
|
void SortMolecule(int &);
|
||||||
|
@ -82,7 +80,6 @@ class FixReaxFFSpecies : public Fix {
|
||||||
class NeighList *list;
|
class NeighList *list;
|
||||||
class FixAveAtom *f_SPECBOND;
|
class FixAveAtom *f_SPECBOND;
|
||||||
class PairReaxFF *reaxff;
|
class PairReaxFF *reaxff;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,10 +368,8 @@ void PairReaxFF::init_style()
|
||||||
error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an "
|
error->warning(FLERR,"Total cutoff < 2*bond cutoff. May need to use an "
|
||||||
"increased neighbor list skin.");
|
"increased neighbor list skin.");
|
||||||
|
|
||||||
if (fix_reaxff == nullptr) {
|
if (fix_reaxff == nullptr)
|
||||||
modify->add_fix(fmt::format("{} all REAXFF",fix_id));
|
fix_reaxff = (FixReaxFF *) modify->add_fix(fmt::format("{} all REAXFF",fix_id));
|
||||||
fix_reaxff = (FixReaxFF *) modify->fix[modify->nfix-1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
|
@ -141,9 +141,9 @@ namespace ReaxFF
|
||||||
|
|
||||||
// toolbox
|
// toolbox
|
||||||
|
|
||||||
extern void *scalloc(LAMMPS_NS::Error *, rc_bigint, rc_bigint, const char *);
|
extern void *scalloc(LAMMPS_NS::Error *, rc_bigint, rc_bigint, const std::string &);
|
||||||
extern void *smalloc(LAMMPS_NS::Error *, rc_bigint, const char *);
|
extern void *smalloc(LAMMPS_NS::Error *, rc_bigint, const std::string &);
|
||||||
extern void sfree(LAMMPS_NS::Error *, void *, const char *);
|
extern void sfree(LAMMPS_NS::Error *, void *, const std::string &);
|
||||||
|
|
||||||
// torsion angles
|
// torsion angles
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// clang-format off
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
PuReMD - Purdue ReaxFF Molecular Dynamics Program
|
PuReMD - Purdue ReaxFF Molecular Dynamics Program
|
||||||
|
|
||||||
|
@ -35,75 +34,81 @@
|
||||||
|
|
||||||
namespace ReaxFF {
|
namespace ReaxFF {
|
||||||
|
|
||||||
/* safe malloc */
|
/* safe malloc */
|
||||||
void *smalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name)
|
void *smalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, const std::string &name)
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
auto errmsg = fmt::format("Trying to allocate {} bytes for array {}. "
|
auto errmsg = fmt::format("Invalid size {} for array {}. Returning NULL.", n, name);
|
||||||
"returning NULL.", n, name);
|
if (error_ptr)
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
error_ptr->one(FLERR, errmsg);
|
||||||
else fputs(errmsg.c_str(),stderr);
|
else
|
||||||
|
fputs(errmsg.c_str(), stderr);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
ptr = malloc(n);
|
|
||||||
if (ptr == nullptr) {
|
|
||||||
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}",
|
|
||||||
n, name);
|
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
|
||||||
else fputs(errmsg.c_str(),stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* safe calloc */
|
ptr = malloc(n);
|
||||||
void *scalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name)
|
if (ptr == nullptr) {
|
||||||
{
|
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", n, name);
|
||||||
void *ptr;
|
if (error_ptr)
|
||||||
|
error_ptr->one(FLERR, errmsg);
|
||||||
if (n <= 0) {
|
else
|
||||||
auto errmsg = fmt::format("Trying to allocate {} elements for array {}. "
|
fputs(errmsg.c_str(), stderr);
|
||||||
"returning NULL.\n", n, name);
|
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
|
||||||
else fputs(errmsg.c_str(),stderr);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size <= 0) {
|
|
||||||
auto errmsg = fmt::format("Elements size for array {} is {}. "
|
|
||||||
"returning NULL", name, size);
|
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
|
||||||
else fputs(errmsg.c_str(),stderr);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr = calloc(n, size);
|
|
||||||
if (ptr == nullptr) {
|
|
||||||
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}",
|
|
||||||
n*size, name);
|
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
|
||||||
else fputs(errmsg.c_str(),stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* safe free */
|
return ptr;
|
||||||
void sfree(LAMMPS_NS::Error* error_ptr, void *ptr, const char *name)
|
|
||||||
{
|
|
||||||
if (ptr == nullptr) {
|
|
||||||
auto errmsg = fmt::format("Trying to free the already free()'d pointer {}",
|
|
||||||
name);
|
|
||||||
if (error_ptr) error_ptr->one(FLERR,errmsg);
|
|
||||||
else fputs(errmsg.c_str(),stderr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(ptr);
|
|
||||||
ptr = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* safe calloc */
|
||||||
|
void *scalloc(LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const std::string &name)
|
||||||
|
{
|
||||||
|
void *ptr;
|
||||||
|
|
||||||
|
if (n <= 0) {
|
||||||
|
auto errmsg = fmt::format("Invalid size {} for array {}. Returning NULL.\n", n, name);
|
||||||
|
if (error_ptr)
|
||||||
|
error_ptr->one(FLERR, errmsg);
|
||||||
|
else
|
||||||
|
fputs(errmsg.c_str(), stderr);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size <= 0) {
|
||||||
|
auto errmsg = fmt::format("Elements size for array {} is {}. Returning NULL", name, size);
|
||||||
|
if (error_ptr)
|
||||||
|
error_ptr->one(FLERR, errmsg);
|
||||||
|
else
|
||||||
|
fputs(errmsg.c_str(), stderr);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = calloc(n, size);
|
||||||
|
if (ptr == nullptr) {
|
||||||
|
auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", n * size, name);
|
||||||
|
if (error_ptr)
|
||||||
|
error_ptr->one(FLERR, errmsg);
|
||||||
|
else
|
||||||
|
fputs(errmsg.c_str(), stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* safe free */
|
||||||
|
void sfree(LAMMPS_NS::Error *error_ptr, void *ptr, const std::string &name)
|
||||||
|
{
|
||||||
|
if (ptr == nullptr) {
|
||||||
|
auto errmsg = std::string("Trying to free the already free()'d pointer: ") + name;
|
||||||
|
if (error_ptr)
|
||||||
|
error_ptr->one(FLERR, errmsg);
|
||||||
|
else
|
||||||
|
fputs(errmsg.c_str(), stderr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(ptr);
|
||||||
|
ptr = nullptr;
|
||||||
|
}
|
||||||
|
} // namespace ReaxFF
|
||||||
|
|
|
@ -101,8 +101,7 @@ void Hyper::command(int narg, char **arg)
|
||||||
|
|
||||||
// create FixEventHyper class to store event and pre-quench states
|
// create FixEventHyper class to store event and pre-quench states
|
||||||
|
|
||||||
modify->add_fix("hyper_event all EVENT/HYPER");
|
fix_event = (FixEventHyper *) modify->add_fix("hyper_event all EVENT/HYPER");
|
||||||
fix_event = (FixEventHyper *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
// create Finish for timing output
|
// create Finish for timing output
|
||||||
|
|
||||||
|
|
|
@ -145,8 +145,7 @@ void PRD::command(int narg, char **arg)
|
||||||
|
|
||||||
// create ComputeTemp class to monitor temperature
|
// create ComputeTemp class to monitor temperature
|
||||||
|
|
||||||
modify->add_compute("prd_temp all temp");
|
temperature = modify->add_compute("prd_temp all temp");
|
||||||
temperature = modify->compute[modify->ncompute-1];
|
|
||||||
|
|
||||||
// create Velocity class for velocity creation in dephasing
|
// create Velocity class for velocity creation in dephasing
|
||||||
// pass it temperature compute, loop_setting, dist_setting settings
|
// pass it temperature compute, loop_setting, dist_setting settings
|
||||||
|
@ -168,8 +167,7 @@ void PRD::command(int narg, char **arg)
|
||||||
|
|
||||||
// create FixEventPRD class to store event and pre-quench states
|
// create FixEventPRD class to store event and pre-quench states
|
||||||
|
|
||||||
modify->add_fix("prd_event all EVENT/PRD");
|
fix_event = (FixEventPRD *) modify->add_fix("prd_event all EVENT/PRD");
|
||||||
fix_event = (FixEventPRD *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
// create Finish for timing output
|
// create Finish for timing output
|
||||||
|
|
||||||
|
|
|
@ -131,28 +131,11 @@ void TAD::command(int narg, char **arg)
|
||||||
|
|
||||||
// create FixEventTAD object to store last event
|
// create FixEventTAD object to store last event
|
||||||
|
|
||||||
int narg2 = 3;
|
fix_event = (FixEventTAD *) modify->add_fix("tad_event all EVENT/TAD");
|
||||||
char **args = new char*[narg2];
|
|
||||||
args[0] = (char *) "tad_event";
|
|
||||||
args[1] = (char *) "all";
|
|
||||||
args[2] = (char *) "EVENT/TAD";
|
|
||||||
modify->add_fix(narg2,args);
|
|
||||||
fix_event = (FixEventTAD *) modify->fix[modify->nfix-1];
|
|
||||||
delete [] args;
|
|
||||||
|
|
||||||
// create FixStore object to store revert state
|
// create FixStore object to store revert state
|
||||||
|
|
||||||
narg2 = 6;
|
fix_revert = (FixStore *) modify->add_fix("tad_revert all STORE peratom 0 7");
|
||||||
args = new char*[narg2];
|
|
||||||
args[0] = (char *) "tad_revert";
|
|
||||||
args[1] = (char *) "all";
|
|
||||||
args[2] = (char *) "STORE";
|
|
||||||
args[3] = (char *) "peratom";
|
|
||||||
args[4] = (char *) "0";
|
|
||||||
args[5] = (char *) "7";
|
|
||||||
modify->add_fix(narg2,args);
|
|
||||||
fix_revert = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
delete [] args;
|
|
||||||
|
|
||||||
// create Finish for timing output
|
// create Finish for timing output
|
||||||
|
|
||||||
|
@ -195,13 +178,10 @@ void TAD::command(int narg, char **arg)
|
||||||
|
|
||||||
// set minimize style for quench
|
// set minimize style for quench
|
||||||
|
|
||||||
narg2 = 1;
|
char *args[1];
|
||||||
args = new char*[narg2];
|
|
||||||
args[0] = min_style;
|
args[0] = min_style;
|
||||||
|
|
||||||
update->create_minimize(narg2,args,1);
|
update->create_minimize(1,args,1);
|
||||||
|
|
||||||
delete [] args;
|
|
||||||
|
|
||||||
// init minimizer settings and minimizer itself
|
// init minimizer settings and minimizer itself
|
||||||
|
|
||||||
|
@ -691,25 +671,13 @@ void TAD::perform_neb(int ievent)
|
||||||
|
|
||||||
// create FixNEB object to support NEB
|
// create FixNEB object to support NEB
|
||||||
|
|
||||||
int narg2 = 4;
|
fix_neb = (Fix *) modify->add_fix("neb all neb 1.0");
|
||||||
char **args = new char*[narg2];
|
|
||||||
args[0] = (char *) "neb";
|
|
||||||
args[1] = (char *) "all";
|
|
||||||
args[2] = (char *) "neb";
|
|
||||||
args[3] = (char *) "1.0";
|
|
||||||
modify->add_fix(narg2,args);
|
|
||||||
fix_neb = (Fix *) modify->fix[modify->nfix-1];
|
|
||||||
delete [] args;
|
|
||||||
|
|
||||||
// switch minimize style to quickmin for NEB
|
// switch minimize style to quickmin for NEB
|
||||||
|
|
||||||
narg2 = 1;
|
char *args[1];
|
||||||
args = new char*[narg2];
|
|
||||||
args[0] = min_style_neb;
|
args[0] = min_style_neb;
|
||||||
|
update->create_minimize(1,args,1);
|
||||||
update->create_minimize(narg2,args,1);
|
|
||||||
|
|
||||||
delete [] args;
|
|
||||||
|
|
||||||
// create NEB object
|
// create NEB object
|
||||||
|
|
||||||
|
@ -769,17 +737,12 @@ void TAD::perform_neb(int ievent)
|
||||||
|
|
||||||
// switch minimize style back for quench
|
// switch minimize style back for quench
|
||||||
|
|
||||||
narg2 = 1;
|
|
||||||
args = new char*[narg2];
|
|
||||||
args[0] = min_style;
|
args[0] = min_style;
|
||||||
|
update->create_minimize(1,args,1);
|
||||||
update->create_minimize(narg2,args,1);
|
|
||||||
|
|
||||||
update->etol = etol;
|
update->etol = etol;
|
||||||
update->ftol = ftol;
|
update->ftol = ftol;
|
||||||
|
|
||||||
delete [] args;
|
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
|
|
||||||
modify->delete_fix("neb");
|
modify->delete_fix("neb");
|
||||||
|
@ -895,25 +858,14 @@ void TAD::delete_event_list() {
|
||||||
|
|
||||||
void TAD::add_event()
|
void TAD::add_event()
|
||||||
{
|
{
|
||||||
|
if (n_event_list == nmax_event_list)
|
||||||
|
grow_event_list(nmax_event_list+nmin_event_list);
|
||||||
|
|
||||||
// create FixEventTAD object to store possible event
|
// create FixEventTAD object to store possible event
|
||||||
|
|
||||||
int narg = 3;
|
int ievent = n_event_list++;
|
||||||
char **args = new char*[narg];
|
fix_event_list[ievent]
|
||||||
|
= (FixEventTAD *) modify->add_fix(fmt::format("tad_event_{} all EVENT/TAD", ievent));
|
||||||
char str[128];
|
|
||||||
sprintf(str,"tad_event_%d",n_event_list);
|
|
||||||
|
|
||||||
args[0] = str;
|
|
||||||
args[1] = (char *) "all";
|
|
||||||
args[2] = (char *) "EVENT/TAD";
|
|
||||||
modify->add_fix(narg,args);
|
|
||||||
|
|
||||||
if (n_event_list == nmax_event_list)
|
|
||||||
grow_event_list(nmax_event_list+nmin_event_list);
|
|
||||||
n_event_list += 1;
|
|
||||||
int ievent = n_event_list-1;
|
|
||||||
fix_event_list[ievent] = (FixEventTAD *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
// store quenched state for new event
|
// store quenched state for new event
|
||||||
|
|
||||||
|
@ -923,11 +875,6 @@ void TAD::add_event()
|
||||||
|
|
||||||
fix_event->restore_state_quench();
|
fix_event->restore_state_quench();
|
||||||
fix_event_list[ievent]->store_state_quench();
|
fix_event_list[ievent]->store_state_quench();
|
||||||
|
|
||||||
// string clean-up
|
|
||||||
|
|
||||||
delete [] args;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
// NOTE: this file is *supposed* to be included multiple times
|
// NOTE: this file is *supposed* to be included multiple times
|
||||||
|
|
||||||
#ifdef LMP_USER_OMP
|
#ifdef LMP_OPENMP
|
||||||
|
|
||||||
// true interface to OPENMP
|
// true interface to OPENMP
|
||||||
|
|
||||||
|
@ -41,4 +41,4 @@ class DomainOMP : public Domain {
|
||||||
|
|
||||||
#endif /* LMP_DOMAIN_OMP_H */
|
#endif /* LMP_DOMAIN_OMP_H */
|
||||||
|
|
||||||
#endif /* !LMP_USER_OMP */
|
#endif /* !LMP_OPENMP */
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#ifdef LMP_USER_INTEL
|
#ifdef LMP_INTEL
|
||||||
#include "neigh_request.h"
|
#include "neigh_request.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2196,7 +2196,7 @@ void Atom::setup_sort_bins()
|
||||||
bininvy = nbiny / (bboxhi[1]-bboxlo[1]);
|
bininvy = nbiny / (bboxhi[1]-bboxlo[1]);
|
||||||
bininvz = nbinz / (bboxhi[2]-bboxlo[2]);
|
bininvz = nbinz / (bboxhi[2]-bboxlo[2]);
|
||||||
|
|
||||||
#ifdef LMP_USER_INTEL
|
#ifdef LMP_INTEL
|
||||||
int intel_neigh = 0;
|
int intel_neigh = 0;
|
||||||
if (neighbor->nrequest) {
|
if (neighbor->nrequest) {
|
||||||
if (neighbor->requests[0]->intel) intel_neigh = 1;
|
if (neighbor->requests[0]->intel) intel_neigh = 1;
|
||||||
|
|
|
@ -499,8 +499,7 @@ void Balance::weight_storage(char *prefix)
|
||||||
int ifix = modify->find_fix(cmd);
|
int ifix = modify->find_fix(cmd);
|
||||||
if (ifix < 1) {
|
if (ifix < 1) {
|
||||||
cmd += " all STORE peratom 0 1";
|
cmd += " all STORE peratom 0 1";
|
||||||
modify->add_fix(cmd);
|
fixstore = (FixStore *) modify->add_fix(cmd);
|
||||||
fixstore = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
} else fixstore = (FixStore *) modify->fix[ifix];
|
} else fixstore = (FixStore *) modify->fix[ifix];
|
||||||
|
|
||||||
// do not carry weights with atoms during normal atom migration
|
// do not carry weights with atoms during normal atom migration
|
||||||
|
|
|
@ -562,13 +562,9 @@ void ComputeChunkAtom::init()
|
||||||
// fixstore initializes all values to 0.0
|
// fixstore initializes all values to 0.0
|
||||||
|
|
||||||
if ((idsflag == ONCE || lockcount) && !fixstore) {
|
if ((idsflag == ONCE || lockcount) && !fixstore) {
|
||||||
std::string cmd = id + std::string("_COMPUTE_STORE");
|
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
|
||||||
id_fix = new char[cmd.size()+1];
|
fixstore = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 1",
|
||||||
strcpy(id_fix,cmd.c_str());
|
id_fix, group->names[igroup]));
|
||||||
|
|
||||||
cmd += fmt::format(" {} STORE peratom 1 1", group->names[igroup]);
|
|
||||||
modify->add_fix(cmd);
|
|
||||||
fixstore = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((idsflag != ONCE && !lockcount) && fixstore) {
|
if ((idsflag != ONCE && !lockcount) && fixstore) {
|
||||||
|
|
|
@ -74,10 +74,8 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
||||||
|
|
||||||
id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE");
|
id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE");
|
||||||
std::string cmd = id_fix + fmt::format(" {} STORE peratom 1 3",
|
fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 3",
|
||||||
group->names[igroup]);
|
id_fix, group->names[igroup]));
|
||||||
modify->add_fix(cmd);
|
|
||||||
fix = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
// calculate xu,yu,zu for fix store array
|
// calculate xu,yu,zu for fix store array
|
||||||
// skip if reset from restart file
|
// skip if reset from restart file
|
||||||
|
|
|
@ -14,16 +14,15 @@
|
||||||
|
|
||||||
#include "compute_msd.h"
|
#include "compute_msd.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "update.h"
|
|
||||||
#include "group.h"
|
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "modify.h"
|
|
||||||
#include "fix_store.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "fix_store.h"
|
||||||
|
#include "group.h"
|
||||||
|
#include "modify.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
@ -66,13 +65,9 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// create a new fix STORE style for reference positions
|
// create a new fix STORE style for reference positions
|
||||||
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
||||||
|
|
||||||
std::string fixcmd = id + std::string("_COMPUTE_STORE");
|
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
|
||||||
id_fix = new char[fixcmd.size()+1];
|
fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 3",
|
||||||
strcpy(id_fix,fixcmd.c_str());
|
id_fix, group->names[igroup]));
|
||||||
|
|
||||||
fixcmd += fmt::format(" {} STORE peratom 1 3",group->names[igroup]);
|
|
||||||
modify->add_fix(fixcmd);
|
|
||||||
fix = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
// calculate xu,yu,zu for fix store array
|
// calculate xu,yu,zu for fix store array
|
||||||
// skip if reset from restart file
|
// skip if reset from restart file
|
||||||
|
|
|
@ -14,18 +14,17 @@
|
||||||
|
|
||||||
#include "compute_msd_chunk.h"
|
#include "compute_msd_chunk.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "group.h"
|
|
||||||
#include "update.h"
|
|
||||||
#include "modify.h"
|
|
||||||
#include "compute_chunk_atom.h"
|
#include "compute_chunk_atom.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "fix_store.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "fix_store.h"
|
||||||
|
#include "group.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "modify.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
@ -52,16 +51,14 @@ ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
|
||||||
// create a new fix STORE style for reference positions
|
// create a new fix STORE style for reference positions
|
||||||
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
||||||
// do not know size of array at this point, just allocate 1x3 array
|
// do not know size of array at this point, just allocate 1x1 array
|
||||||
// fix creation must be done now so that a restart run can
|
// fix creation must be done now so that a restart run can
|
||||||
// potentially re-populate the fix array (and change it to correct size)
|
// potentially re-populate the fix array (and change it to correct size)
|
||||||
// otherwise size reset and init will be done in setup()
|
// otherwise size reset and init will be done in setup()
|
||||||
|
|
||||||
id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE");
|
id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE");
|
||||||
std::string fixcmd = id_fix
|
fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE global 1 1",
|
||||||
+ fmt::format(" {} STORE global 1 1",group->names[igroup]);
|
id_fix,group->names[igroup]));
|
||||||
modify->add_fix(fixcmd);
|
|
||||||
fix = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
#include "compute_vacf.h"
|
#include "compute_vacf.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
|
@ -23,6 +21,7 @@
|
||||||
#include "fix_store.h"
|
#include "fix_store.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
@ -42,12 +41,9 @@ ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// create a new fix STORE style
|
// create a new fix STORE style
|
||||||
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
||||||
|
|
||||||
std::string fixcmd = id + std::string("_COMPUTE_STORE");
|
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
|
||||||
id_fix = new char[fixcmd.size()+1];
|
fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 3",
|
||||||
strcpy(id_fix,fixcmd.c_str());
|
id_fix, group->names[igroup]));
|
||||||
fixcmd += fmt::format(" {} STORE peratom 1 3", group->names[igroup]);
|
|
||||||
modify->add_fix(fixcmd);
|
|
||||||
fix = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
// store current velocities in fix store array
|
// store current velocities in fix store array
|
||||||
// skip if reset from restart file
|
// skip if reset from restart file
|
||||||
|
|
|
@ -1960,18 +1960,15 @@ int DumpCustom::modify_param(int narg, char **arg)
|
||||||
thresh_last[nthresh] = -1;
|
thresh_last[nthresh] = -1;
|
||||||
} else {
|
} else {
|
||||||
thresh_fix = (FixStore **)
|
thresh_fix = (FixStore **)
|
||||||
memory->srealloc(thresh_fix,(nthreshlast+1)*sizeof(FixStore *),
|
memory->srealloc(thresh_fix,(nthreshlast+1)*sizeof(FixStore *),"dump:thresh_fix");
|
||||||
"dump:thresh_fix");
|
|
||||||
thresh_fixID = (char **)
|
thresh_fixID = (char **)
|
||||||
memory->srealloc(thresh_fixID,(nthreshlast+1)*sizeof(char *),
|
memory->srealloc(thresh_fixID,(nthreshlast+1)*sizeof(char *),"dump:thresh_fixID");
|
||||||
"dump:thresh_fixID");
|
|
||||||
memory->grow(thresh_first,(nthreshlast+1),"dump:thresh_first");
|
memory->grow(thresh_first,(nthreshlast+1),"dump:thresh_first");
|
||||||
|
|
||||||
std::string threshid = fmt::format("{}{}_DUMP_STORE",id,nthreshlast);
|
std::string threshid = fmt::format("{}{}_DUMP_STORE",id,nthreshlast);
|
||||||
thresh_fixID[nthreshlast] = utils::strdup(threshid);
|
thresh_fixID[nthreshlast] = utils::strdup(threshid);
|
||||||
modify->add_fix(fmt::format("{} {} STORE peratom 1 1",threshid,
|
threshid += fmt::format(" {} STORE peratom 1 1", group->names[igroup]);
|
||||||
group->names[igroup]));
|
thresh_fix[nthreshlast] = (FixStore *) modify->add_fix(threshid);
|
||||||
thresh_fix[nthreshlast] = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
thresh_last[nthreshlast] = nthreshlast;
|
thresh_last[nthreshlast] = nthreshlast;
|
||||||
thresh_first[nthreshlast] = 1;
|
thresh_first[nthreshlast] = 1;
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#ifdef LMP_USER_OMP
|
#ifdef LMP_OPENMP
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "fix_omp.h"
|
#include "fix_omp.h"
|
||||||
#include "thr_data.h"
|
#include "thr_data.h"
|
||||||
|
@ -48,7 +48,7 @@ static void mpi_timings(const char *label, Timer *t, enum Timer::ttype tt,
|
||||||
MPI_Comm world, const int nprocs, const int nthreads,
|
MPI_Comm world, const int nprocs, const int nthreads,
|
||||||
const int me, double time_loop, FILE *scr, FILE *log);
|
const int me, double time_loop, FILE *scr, FILE *log);
|
||||||
|
|
||||||
#ifdef LMP_USER_OMP
|
#ifdef LMP_OPENMP
|
||||||
static void omp_times(FixOMP *fix, const char *label, enum Timer::ttype which,
|
static void omp_times(FixOMP *fix, const char *label, enum Timer::ttype which,
|
||||||
const int nthreads,FILE *scr, FILE *log);
|
const int nthreads,FILE *scr, FILE *log);
|
||||||
#endif
|
#endif
|
||||||
|
@ -363,7 +363,7 @@ void Finish::end(int flag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LMP_USER_OMP
|
#ifdef LMP_OPENMP
|
||||||
int ifix = modify->find_fix("package_omp");
|
int ifix = modify->find_fix("package_omp");
|
||||||
|
|
||||||
// print thread breakdown only with full timer detail
|
// print thread breakdown only with full timer detail
|
||||||
|
@ -691,7 +691,7 @@ void mpi_timings(const char *label, Timer *t, enum Timer::ttype tt,
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef LMP_USER_OMP
|
#ifdef LMP_OPENMP
|
||||||
void omp_times(FixOMP *fix, const char *label, enum Timer::ttype which,
|
void omp_times(FixOMP *fix, const char *label, enum Timer::ttype which,
|
||||||
const int nthreads,FILE *scr, FILE *log)
|
const int nthreads,FILE *scr, FILE *log)
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,12 +252,9 @@ void FixAdapt::post_constructor()
|
||||||
id_fix_chg = nullptr;
|
id_fix_chg = nullptr;
|
||||||
|
|
||||||
if (diamflag && atom->radius_flag) {
|
if (diamflag && atom->radius_flag) {
|
||||||
std::string fixcmd = id + std::string("_FIX_STORE_DIAM");
|
id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM"));
|
||||||
id_fix_diam = utils::strdup(fixcmd);
|
fix_diam = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 1",
|
||||||
fixcmd += fmt::format(" {} STORE peratom 1 1",group->names[igroup]);
|
id_fix_diam,group->names[igroup]));
|
||||||
modify->add_fix(fixcmd);
|
|
||||||
fix_diam = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
if (fix_diam->restart_reset) fix_diam->restart_reset = 0;
|
if (fix_diam->restart_reset) fix_diam->restart_reset = 0;
|
||||||
else {
|
else {
|
||||||
double *vec = fix_diam->vstore;
|
double *vec = fix_diam->vstore;
|
||||||
|
@ -273,12 +270,9 @@ void FixAdapt::post_constructor()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chgflag && atom->q_flag) {
|
if (chgflag && atom->q_flag) {
|
||||||
std::string fixcmd = id + std::string("_FIX_STORE_CHG");
|
id_fix_chg = utils::strdup(id + std::string("_FIX_STORE_CHG"));
|
||||||
id_fix_chg = utils::strdup(fixcmd);
|
fix_chg = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 1",
|
||||||
fixcmd += fmt::format(" {} STORE peratom 1 1",group->names[igroup]);
|
id_fix_chg,group->names[igroup]));
|
||||||
modify->add_fix(fixcmd);
|
|
||||||
fix_chg = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
if (fix_chg->restart_reset) fix_chg->restart_reset = 0;
|
if (fix_chg->restart_reset) fix_chg->restart_reset = 0;
|
||||||
else {
|
else {
|
||||||
double *vec = fix_chg->vstore;
|
double *vec = fix_chg->vstore;
|
||||||
|
|
|
@ -1222,7 +1222,7 @@ bool Info::has_accelerator_feature(const std::string &package,
|
||||||
return lmp_gpu_config(category,setting);
|
return lmp_gpu_config(category,setting);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(LMP_USER_OMP)
|
#if defined(LMP_OPENMP)
|
||||||
if (package == "OPENMP") {
|
if (package == "OPENMP") {
|
||||||
if (category == "precision") {
|
if (category == "precision") {
|
||||||
if (setting == "double") return true;
|
if (setting == "double") return true;
|
||||||
|
@ -1238,7 +1238,7 @@ bool Info::has_accelerator_feature(const std::string &package,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(LMP_USER_INTEL)
|
#if defined(LMP_INTEL)
|
||||||
if (package == "INTEL") {
|
if (package == "INTEL") {
|
||||||
if (category == "precision") {
|
if (category == "precision") {
|
||||||
if (setting == "double") return true;
|
if (setting == "double") return true;
|
||||||
|
|
|
@ -798,7 +798,7 @@ void LAMMPS::create()
|
||||||
else neighbor = new Neighbor(this);
|
else neighbor = new Neighbor(this);
|
||||||
|
|
||||||
if (kokkos) domain = new DomainKokkos(this);
|
if (kokkos) domain = new DomainKokkos(this);
|
||||||
#ifdef LMP_USER_OMP
|
#ifdef LMP_OPENMP
|
||||||
else domain = new DomainOMP(this);
|
else domain = new DomainOMP(this);
|
||||||
#else
|
#else
|
||||||
else domain = new Domain(this);
|
else domain = new Domain(this);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// import MolSSI Driver Interface library
|
// import MolSSI Driver Interface library
|
||||||
#if defined(LMP_USER_MDI)
|
#if defined(LMP_MDI)
|
||||||
#include <mdi.h>
|
#include <mdi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
MPI_Comm lammps_comm = MPI_COMM_WORLD;
|
MPI_Comm lammps_comm = MPI_COMM_WORLD;
|
||||||
|
|
||||||
#if defined(LMP_USER_MDI)
|
#if defined(LMP_MDI)
|
||||||
// initialize MDI interface, if compiled in
|
// initialize MDI interface, if compiled in
|
||||||
|
|
||||||
int mdi_flag;
|
int mdi_flag;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
#if defined(LMP_USER_INTEL) && \
|
#if defined(LMP_INTEL) && \
|
||||||
((defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)))
|
((defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)))
|
||||||
#ifndef LMP_INTEL_NO_TBB
|
#ifndef LMP_INTEL_NO_TBB
|
||||||
#define LMP_USE_TBB_ALLOCATOR
|
#define LMP_USE_TBB_ALLOCATOR
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
|
#if defined(LMP_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
|
||||||
#define LAMMPS_MEMALIGN 64
|
#define LAMMPS_MEMALIGN 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -121,8 +121,7 @@ void Min::init()
|
||||||
// create fix needed for storing atom-based quantities
|
// create fix needed for storing atom-based quantities
|
||||||
// will delete it at end of run
|
// will delete it at end of run
|
||||||
|
|
||||||
modify->add_fix("MINIMIZE all MINIMIZE");
|
fix_minimize = (FixMinimize *) modify->add_fix("MINIMIZE all MINIMIZE");
|
||||||
fix_minimize = (FixMinimize *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
// clear out extra global and per-atom dof
|
// clear out extra global and per-atom dof
|
||||||
// will receive requests for new per-atom dof during pair init()
|
// will receive requests for new per-atom dof during pair init()
|
||||||
|
|
|
@ -37,7 +37,6 @@ using namespace FixConst;
|
||||||
|
|
||||||
#define DELTA 4
|
#define DELTA 4
|
||||||
#define BIG 1.0e20
|
#define BIG 1.0e20
|
||||||
#define NEXCEPT 7 // change when add to exceptions in add_fix()
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -985,7 +984,7 @@ Fix *Modify::add_fix(const std::string &fixcmd, int trysuffix)
|
||||||
Fix *Modify::replace_fix(const char *replaceID, int narg, char **arg, int trysuffix)
|
Fix *Modify::replace_fix(const char *replaceID, int narg, char **arg, int trysuffix)
|
||||||
{
|
{
|
||||||
int ifix = find_fix(replaceID);
|
int ifix = find_fix(replaceID);
|
||||||
if (ifix < 0) error->all(FLERR,"Modify replace_fix ID could not be found");
|
if (ifix < 0) error->all(FLERR,"Modify replace_fix ID {} could not be found", replaceID);
|
||||||
|
|
||||||
// change ID, igroup, style of fix being replaced to match new fix
|
// change ID, igroup, style of fix being replaced to match new fix
|
||||||
// requires some error checking on arguments for new fix
|
// requires some error checking on arguments for new fix
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
|
#if defined(LMP_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
|
||||||
#define LAMMPS_MEMALIGN 64
|
#define LAMMPS_MEMALIGN 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
|
#if defined(LMP_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
|
||||||
#define LAMMPS_MEMALIGN 64
|
#define LAMMPS_MEMALIGN 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -302,9 +302,8 @@ void Respa::init()
|
||||||
// if supported, we also store torques on a per-level basis
|
// if supported, we also store torques on a per-level basis
|
||||||
|
|
||||||
std::string cmd = fmt::format("RESPA all RESPA {}",nlevels);
|
std::string cmd = fmt::format("RESPA all RESPA {}",nlevels);
|
||||||
if (atom->torque_flag) modify->add_fix(cmd + " torque");
|
if (atom->torque_flag) cmd += " torque";
|
||||||
else modify->add_fix(cmd);
|
fix_respa = (FixRespa *) modify->add_fix(cmd);
|
||||||
fix_respa = (FixRespa *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
// insure respa inner/middle/outer is using Pair class that supports it
|
// insure respa inner/middle/outer is using Pair class that supports it
|
||||||
|
|
||||||
|
|
|
@ -5065,16 +5065,10 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) :
|
||||||
|
|
||||||
if (style == Variable::ATOMFILE) {
|
if (style == Variable::ATOMFILE) {
|
||||||
if (atom->map_style == Atom::MAP_NONE)
|
if (atom->map_style == Atom::MAP_NONE)
|
||||||
error->all(FLERR,"Cannot use atomfile-style "
|
error->all(FLERR,"Cannot use atomfile-style variable unless an atom map exists");
|
||||||
"variable unless an atom map exists");
|
|
||||||
|
|
||||||
std::string cmd = name + std::string("_VARIABLE_STORE");
|
|
||||||
id_fix = utils::strdup(cmd);
|
|
||||||
|
|
||||||
cmd += " all STORE peratom 0 1";
|
|
||||||
modify->add_fix(cmd);
|
|
||||||
fixstore = (FixStore *) modify->fix[modify->nfix-1];
|
|
||||||
|
|
||||||
|
id_fix = utils::strdup(std::string(name) + "_VARIABLE_STORE");
|
||||||
|
fixstore = (FixStore *) modify->add_fix(std::string(id_fix) + " all STORE peratom 0 1");
|
||||||
buffer = new char[CHUNK*MAXLINE];
|
buffer = new char[CHUNK*MAXLINE];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
lammps_version: 8 Apr 2021
|
lammps_version: 8 Apr 2021
|
||||||
date_generated: Tue Apr 20 14:47:51 2021
|
date_generated: Tue Apr 20 14:47:51 2021
|
||||||
epsilon: 7.5e-13
|
epsilon: 7.5e-13
|
||||||
skip_tests: intel single
|
skip_tests: intel single gpu
|
||||||
prerequisites: ! |
|
prerequisites: ! |
|
||||||
pair buck/coul/cut
|
pair buck/coul/cut
|
||||||
fix qeq/point
|
fix qeq/point
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
lammps_version: 8 Apr 2021
|
lammps_version: 8 Apr 2021
|
||||||
date_generated: Tue Apr 20 14:48:00 2021
|
date_generated: Tue Apr 20 14:48:00 2021
|
||||||
epsilon: 7.5e-13
|
epsilon: 7.5e-13
|
||||||
skip_tests: intel single
|
skip_tests: intel single gpu
|
||||||
prerequisites: ! |
|
prerequisites: ! |
|
||||||
pair buck/coul/cut
|
pair buck/coul/cut
|
||||||
fix qeq/shielded
|
fix qeq/shielded
|
||||||
|
|
Loading…
Reference in New Issue