Skip to content

Commit

Permalink
Merge pull request lammps#4164 from akohlmey/collected-small-changes
Browse files Browse the repository at this point in the history
Collected small changes and fixes
  • Loading branch information
stanmoore1 authored May 20, 2024
2 parents 77239a7 + 30704d0 commit a8687b5
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 29 deletions.
32 changes: 20 additions & 12 deletions python/lammps/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,16 @@ def __init__(self,name='',cmdargs=None,ptr=None,comm=None):
narg = 0
cargs = None
if cmdargs is not None:
cmdargs.insert(0,"lammps")
narg = len(cmdargs)
for i in range(narg):
if type(cmdargs[i]) is str:
cmdargs[i] = cmdargs[i].encode()
cargs = (c_char_p*(narg+1))(*cmdargs)
myargs = ["lammps".encode()]
narg = len(cmdargs) + 1
for arg in cmdargs:
if type(arg) is str:
myargs.append(arg.encode())
elif type(arg) is bytes:
myargs.append(arg)
else:
raise TypeError('Unsupported cmdargs type ', type(arg))
cargs = (c_char_p*(narg+1))(*myargs)
cargs[narg] = None
self.lib.lammps_open.argtypes = [c_int, c_char_p*(narg+1), MPI_Comm, c_void_p]
else:
Expand All @@ -397,12 +401,16 @@ def __init__(self,name='',cmdargs=None,ptr=None,comm=None):
self.comm = self.MPI.COMM_WORLD
self.opened = 1
if cmdargs is not None:
cmdargs.insert(0,"lammps")
narg = len(cmdargs)
for i in range(narg):
if type(cmdargs[i]) is str:
cmdargs[i] = cmdargs[i].encode()
cargs = (c_char_p*(narg+1))(*cmdargs)
myargs = ["lammps".encode()]
narg = len(cmdargs) + 1
for arg in cmdargs:
if type(arg) is str:
myargs.append(arg.encode())
elif type(arg) is bytes:
myargs.append(arg)
else:
raise TypeError('Unsupported cmdargs type ', type(arg))
cargs = (c_char_p*(narg+1))(*myargs)
cargs[narg] = None
self.lib.lammps_open_no_mpi.argtypes = [c_int, c_char_p*(narg+1), c_void_p]
self.lmp = c_void_p(self.lib.lammps_open_no_mpi(narg,cargs,None))
Expand Down
2 changes: 1 addition & 1 deletion src/EXTRA-COMPUTE/compute_stress_cartesian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ void ComputeStressCartesian::compute_array()
if (tag[i] > tag[j]) {
if ((tag[i] + tag[j]) % 2 == 0) continue;
} else if (tag[i] < tag[j]) {
if ((tag[i] < tag[j]) % 2 == 1) continue;
if ((tag[i] + tag[j]) % 2 == 1) continue;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/EXTRA-FIX/fix_deform_pressure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ FixDeformPressure::FixDeformPressure(LAMMPS *lmp, int narg, char **arg) :
if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "fix deform/pressure erate/rescale", error);
set[index].style = ERATERS;
set[index].rate = utils::numeric(FLERR, arg[iarg + 2], false, lmp);
iarg += 3;
i += 3;
} else error->all(FLERR, "Illegal fix deform/pressure command: {}", arg[iarg + 1]);

Expand Down
2 changes: 1 addition & 1 deletion src/ML-PACE/pair_pace.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PairPACE : public Pair {

protected:
struct ACEImpl *aceimpl;
int nmax_corerep = 0;
int nmax_corerep;

virtual void allocate();
double *corerep_factor; //per-atom core-rep factor (= 1 - fcut)
Expand Down
10 changes: 5 additions & 5 deletions src/ML-PACE/pair_pace_extrapolation.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ class PairPACEExtrapolation : public Pair {

protected:
struct ACEALImpl *aceimpl;
int nmax = 0, nmax_corerep = 0;
int nmax, nmax_corerep;

virtual void allocate();
std::vector<std::string> element_names; // list of elements (used by dump pace/extrapolation)
double *extrapolation_grade_gamma = nullptr; //per-atom gamma value
double *corerep_factor = nullptr; //per-atom core-rep factor (= 1 - fcut)
double *extrapolation_grade_gamma; //per-atom gamma value
double *corerep_factor; //per-atom core-rep factor (= 1 - fcut)

int flag_compute_extrapolation_grade = 0;
int flag_corerep_factor = 0;
int flag_compute_extrapolation_grade;
int flag_corerep_factor;

double **scale;

Expand Down
16 changes: 9 additions & 7 deletions src/replicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,34 @@
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "label_map.h"
#include "memory.h"
#include "special.h"
#include "label_map.h"

#include <cstring>

using namespace LAMMPS_NS;

static constexpr double LB_FACTOR = 1.1;
static constexpr double EPSILON = 1.0e-6;
static constexpr double EPSILON = 1.0e-6;

/* ---------------------------------------------------------------------- */

Replicate::Replicate(LAMMPS *lmp) : Command(lmp) {}
Replicate::Replicate(LAMMPS *lmp) : Command(lmp), old(nullptr), old_x(nullptr), old_tag(nullptr)
{
bbox_flag = 0;
bond_flag = 0;
}

/* ---------------------------------------------------------------------- */

void Replicate::command(int narg, char **arg)
{
int i,j,m,n;
int i,n;

if (domain->box_exist == 0)
error->all(FLERR,"Replicate command before simulation box is defined");

if (narg < 3 || narg > 4) error->all(FLERR,"Illegal replicate command");

int me = comm->me;
Expand Down Expand Up @@ -78,9 +83,6 @@ void Replicate::command(int narg, char **arg)

// optional keywords

bbox_flag = 0;
bond_flag = 0;

int iarg = 3;
while (iarg < narg) {
if (strcmp(arg[iarg],"bbox") == 0) {
Expand Down
8 changes: 6 additions & 2 deletions tools/lammps-gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ if(APPLE)
elseif(MSVC)
install(TARGETS lammps-gui DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES $<TARGET_RUNTIME_DLLS:lammps-gui> TYPE BIN)
install(FILES $<TARGET_RUNTIME_DLLS:lammps> TYPE BIN)
if(BUILD_SHARED_LIBS)
install(FILES $<TARGET_RUNTIME_DLLS:lammps> TYPE BIN)
endif()
install(FILES $<TARGET_RUNTIME_DLLS:lmp> TYPE BIN)
# find path to VC++ init batch file
get_filename_component(VC_COMPILER_DIR "${CMAKE_CXX_COMPILER}" DIRECTORY)
Expand All @@ -262,7 +264,9 @@ elseif(MSVC)
elseif((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
install(TARGETS lammps-gui DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES $<TARGET_RUNTIME_DLLS:lammps-gui> TYPE BIN)
install(FILES $<TARGET_RUNTIME_DLLS:lammps> TYPE BIN)
if(BUILD_SHARED_LIBS)
install(FILES $<TARGET_RUNTIME_DLLS:lammps> TYPE BIN)
endif()
install(FILES $<TARGET_RUNTIME_DLLS:lmp> TYPE BIN)
add_custom_target(zip
COMMAND sh -vx ${LAMMPS_DIR}/cmake/packaging/build_windows_cross_zip.sh ${CMAKE_INSTALL_PREFIX}
Expand Down

0 comments on commit a8687b5

Please sign in to comment.