From 0cdc151dd59960ca48039e8c682da61bb7bb1e9a Mon Sep 17 00:00:00 2001 From: Andreas Singraber Date: Tue, 11 May 2021 23:25:35 +0200 Subject: [PATCH] Ensure compatibility with LAMMPS PR --- src/interface/LAMMPS/src/USER-NNP/Install.sh | 3 +- src/libnnpif/LAMMPS/Makefile.lammps | 6 ++-- src/libnnpif/makefile | 30 ++++++++++++++------ src/makefile | 1 + 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/interface/LAMMPS/src/USER-NNP/Install.sh b/src/interface/LAMMPS/src/USER-NNP/Install.sh index 5cdb084b8..b480b4451 100644 --- a/src/interface/LAMMPS/src/USER-NNP/Install.sh +++ b/src/interface/LAMMPS/src/USER-NNP/Install.sh @@ -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 @@ -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 diff --git a/src/libnnpif/LAMMPS/Makefile.lammps b/src/libnnpif/LAMMPS/Makefile.lammps index 144fd0dbc..fc83b61f8 100644 --- a/src/libnnpif/LAMMPS/Makefile.lammps +++ b/src/libnnpif/LAMMPS/Makefile.lammps @@ -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 = diff --git a/src/libnnpif/makefile b/src/libnnpif/makefile index e4db1e0d3..2213678c2 100644 --- a/src/libnnpif/makefile +++ b/src/libnnpif/makefile @@ -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 \ @@ -122,7 +136,7 @@ $(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 @@ -130,9 +144,7 @@ clean: clean-headers clean-lammps-mf 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 diff --git a/src/makefile b/src/makefile index 580c91d4e..30e56d5e8 100644 --- a/src/makefile +++ b/src/makefile @@ -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: