Skip to content

Commit

Permalink
Ensure compatibility with LAMMPS PR
Browse files Browse the repository at this point in the history
  • Loading branch information
singraber committed May 11, 2021
1 parent 9c350fb commit 0cdc151
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/interface/LAMMPS/src/USER-NNP/Install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ if (test $1 = 1) then
sed -i -e 's/[^ \t]*nnp[^ \t]* //g' ../Makefile.package
sed -i -e 's|^PKG_INC =[ \t]*|&-I..\/..\/lib\/nnp\/include |' ../Makefile.package
sed -i -e 's|^PKG_PATH =[ \t]*|&-L..\/..\/lib\/nnp\/lib |' ../Makefile.package
sed -i -e 's|^PKG_LIB =[ \t]*|&-lnnpif -lnnp |' ../Makefile.package
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(nnp_SYSINC) |' ../Makefile.package
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(nnp_SYSLIB) |' ../Makefile.package
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(nnp_SYSPATH) |' ../Makefile.package
Expand All @@ -48,7 +47,7 @@ if (test $1 = 1) then
sed -i -e '/^include.*nnp.*$/d' ../Makefile.package.settings
# multiline form needed for BSD sed on Macs
sed -i -e '4 i \
include ..\/..\/lib\/nnp\/src\/libnnpif\/LAMMPS\/Makefile.lammps
include ..\/..\/lib\/nnp\/lib\/Makefile.lammps-extra
' ../Makefile.package.settings

fi
Expand Down
6 changes: 3 additions & 3 deletions src/libnnpif/LAMMPS/Makefile.lammps
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Settings that the LAMMPS build will import when this package library is used

nnp_SYSINC =
nnp_SYSLIB =
nnp_SYSPATH =
hdnnp_SYSINC =
hdnnp_SYSLIB = -lnnpif -lnnp
hdnnp_SYSPATH =
30 changes: 21 additions & 9 deletions src/libnnpif/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,36 @@ OBJ=$(SRC:.cpp=.o)
###############################################################################
# RULES
###############################################################################
.PHONY: all headers lammps-mf clean rebuild
.PHONY: all \
headers \
lammps-prep \
lammps-mf \
lammps-mf-internal \
lammps-cmake \
clean rebuild

ifeq ($(MODE), shared)
all: headers lammps-mf $(LIB).so
all: headers lammps-prep $(LIB).so
else
all: headers lammps-mf $(LIB).a
all: headers lammps-prep $(LIB).a
endif

headers:
cp $(HEADERS) $(PROJECT_INCLUDE)

LAMMPS_OPTIONS := $(filter -DN2P2_%,$(OPTIONS))
lammps-prep: lammps-mf lammps-cmake

lammps-mf:
@sed -i.bak -E "s,(nnp_SYSINC =).*,\1 $(LAMMPS_OPTIONS)," LAMMPS/Makefile.lammps
@rm LAMMPS/Makefile.lammps.bak
cp LAMMPS/Makefile.lammps $(PROJECT_LIB)/Makefile.lammps-extra
@sed -i.bak -E "s,(hdnnp_SYSINC =).*,\1 $(LAMMPS_OPTIONS)," $(PROJECT_LIB)/Makefile.lammps-extra
@rm $(PROJECT_LIB)/Makefile.lammps-extra.bak

lammps-mf-internal: lammps-mf
sed -i.bak -E "s,hdnnp,nnp," $(PROJECT_LIB)/Makefile.lammps-extra
@rm $(PROJECT_LIB)/Makefile.lammps-extra.bak

lammps-cmake:
$(RM) -f $(PROJECT_LIB)/lammps-extra.cmake
touch $(PROJECT_LIB)/lammps-extra.cmake
for flag in $(LAMMPS_OPTIONS); do \
Expand All @@ -122,17 +136,15 @@ $(LIB).a: $(OBJ)
%.o: %.cpp
$(MPICC) $(CFLAGS) $(DEBUG) $(INCLUDES) $(OPTIONS) -o $@ -c $<

clean: clean-headers clean-lammps-mf
clean: clean-headers clean-lammps-prep
$(RM) $(OBJ)
$(RM) $(OBJ:.o=.gcno) $(OBJ:.o=.gcda) $(LIB).so $(LIB).a
$(RM) $(PROJECT_LIB)/$(LIB).so $(PROJECT_LIB)/$(LIB).a

clean-headers:
cd $(PROJECT_INCLUDE) && $(RM) $(notdir $(HEADERS))

clean-lammps-mf:
@sed -i.bak -E "s,(nnp_SYSINC =).*,\1," LAMMPS/Makefile.lammps
$(RM) LAMMPS/Makefile.lammps.bak
clean-lammps-prep:
$(RM) $(PROJECT_LIB)/Makefile.lammps-extra
$(RM) $(PROJECT_LIB)/lammps-extra.cmake

Expand Down
1 change: 1 addition & 0 deletions src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ $(CLEAN_APP):
# lammps-nnp #
##############
lammps-nnp: libnnpif
cd libnnpif && $(MAKE) lammps-mf-internal
cd interface && $(MAKE) $@ COMP=$(COMP) MODE=$(MODE)

clean-lammps-nnp:
Expand Down

0 comments on commit 0cdc151

Please sign in to comment.