I have been trying to install MBX onto a Mac computer (the new version with the Apple M1 Pro chip and an arm64 architecture) and have been having some troubles with linking MBX with i-PI.
I first installed fftw (3.3.10) using the following
./configure --enable-mpi --enable-threads --enable-float --enable-sse
make
make check
make install
make installcheck
Then, I made sure that all my system variables were set
export MBX_HOME=/Users/julesoppenheim/Downloads/MBX-master
export FFTW_HOME=/Users/julesoppenheim/Downloads/fftw-3.3.10
export GSL_HOME=/Users/julesoppenheim/Downloads/gsl-2.7.1
export MPI_HOME=/Users/julesoppenheim/Downloads/openmpi-4.1.4
Then, I installed MB-master using the following
autoreconf -fi
./configure --enable-mpi
make && make install
I then copied over the Makefile to lammps (23June2022 version) and built lammps according to the following:
First I modified the make file with the compiler settings for my computer (changing to the mpicxx compiler, and removing the -fopenmp command as it doesn't work with Macs)
CC = mpicxx
CCFLAGS = -O3 -mcpu=native
CCFLAGS += -I$(MBX_INC)
CCFLAGS += -I$(FFTW)/include
SHFLAGS = -fPIC
DEPFLAGS = -M
LINK = mpicxx
LINKFLAGS = -g -O
LIB =
LIB += $(MBX_LIB)/libmbx.a
SIZE = size
Then I ran the following, and the the lmp_mpi_mbx was generated.
CXX=/usr/bin/gcc
CXXFLAGS= -Wall -std=c++11 -g -O2
/usr/bin/gcc -Wall -std=c++11 -g -O2 -I/Users/julesoppenheim/Downloads/MBX-master/install/include -I../utils -L/Users/julesoppenheim/Downloads/MBX-master/install/lib driver.cpp -l:libmbx.a -lfftw3 -o driver
In file included from driver.cpp:45:
In file included from /Users/julesoppenheim/Downloads/MBX-master/install/include/io_tools/read_nrg.h:48:
...
In file included from /Users/julesoppenheim/Downloads/MBX-master/install/include/bblock/system.h:51:
6 warnings generated.
ld: library not found for -l:libmbx.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [driver] Error 1
0 0.211
0 0.422
0 0.633
0 0.844
0 1.055
0 1.266
0 1.477
0 1.688
0 1.899
0 2.11
0 2.321
0 2.532
0 2.743
0 2.954
0 3.165
0 3.376
0 3.587
0 3.798
0 4.009
40.09"
After fixing my typo, I am still seeing the same segmentation fault error. I've tried to debug everything, and am still unsure of why FFTW is not working properly. I have tried to change the ./configure parameters for FFTW, but nothing has changed.
My current Makefile is as follows
CC = mpicxx
CCFLAGS = -g -O3 -Xpreprocessor -fopenmp -std=c++11
CCFLAGS += -I$(MBX_INC)
CCFLAGS += -I$(FFTW)/include -I$(LIBOMP)/include -L$(LIBOMP)/lib -lomp
SHFLAGS = -fPIC
DEPFLAGS = -M
LINK = mpicxx
LINKFLAGS = -g -O3 -Xpreprocessor -fopenmp -std=c++11
LIB =
LIB += $(MBX_LIB)/libmbx.a -I$(LIBOMP)/include -L$(LIBOMP)/lib -lomp
SIZE = size
ARCHIVE = ar
ARFLAGS = -rc
SHLIBFLAGS = -shared
And I am using the default 'brew' install of open-mpi, llvm, libomp, and fftw.
With this Makefile, I currently see the following output after make mpi_mbx (using autoreconf -fi, ./configure, and make && make install to prepare MBX)
mpicxx -g -O2 -Xpreprocessor -fopenmp -std=c++11 main.o -L. -llammps_mpi_mbx -L/opt/homebrew/Cellar/fftw/3.3.10_1/lib -lfftw3 -lfftw3f /Users/julesoppenheim/Downloads/MBX-master5/install/lib/libmbx.a -I/opt/homebrew/Cellar/libomp/15.0.7/include -L/opt/homebrew/Cellar/libomp/15.0.7/lib -lomp -o ../lmp_mpi_mbx
Undefined symbols for architecture arm64:
"LAMMPS_NS::FixMBX::FixMBX(LAMMPS_NS::LAMMPS*, int, char**)", referenced from:
LAMMPS_NS::Fix* style_creator<LAMMPS_NS::Fix, LAMMPS_NS::FixMBX>(LAMMPS_NS::LAMMPS*, int, char**) in liblammps_mpi_mbx.a(modify.o)
"LAMMPS_NS::PairMBX::PairMBX(LAMMPS_NS::LAMMPS*)", referenced from:
LAMMPS_NS::Pair* style_creator<LAMMPS_NS::Pair, LAMMPS_NS::PairMBX>(LAMMPS_NS::LAMMPS*) in liblammps_mpi_mbx.a(force.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [../lmp_mpi_mbx] Error 1
make: *** [mpi_mbx] Error 2
I have also tried to run i-PI using my current set up,
This makefile seems to work
CXX=mpicxx #g++
CXXFLAGS= -Wall -std=c++11 -g -O2
MBX=$(MBX_HOME)/install
MBX_INC=$(MBX)/include
MBX_LIB=$(MBX)/lib
LIBOMP=$(LIBOMP_HOME)
LIBS = $(MBX_LIB)/libmbx.a -Xpreprocessor -fopenmp -lfftw3
LIBDIR = -L$(MBX_HOME)/install/lib/ -I$(LIBOMP)/include -L$(LIBOMP)/lib -lomp
INCLUDEDIR = -I$(MBX_HOME)/install/include -I../utils
BINDIR = ../../bin
OBJDIR = ../../obj
all: driver
driver: driver.cpp $(BINDIR)/.sentinel
$(CXX) $(CXXFLAGS) $(INCLUDEDIR) $(LIBDIR) driver.cpp $(LIBS) -o $@
mv driver $(BINDIR)/driver
$(BINDIR)/.sentinel:
mkdir -p $(BINDIR)
touch $@
clean:
rm -rf $(BINDIR)
I've then tried to run the i-Pi example for CH4 and see the following output:
____ ____ ____ ____
/ \ / \ / \ / \
| ################################# |
\__#_/ \____/ \____/ \_#__/
# _ _______ _____ #
# (_) |_ __ \|_ _| # -*- v 2.0 -*-
# __ ______ | |__) | | | #
Y [ ||______|| ___/ | | # A Universal Force Engine
0 0 | | _| |_ _| |_ #
# [___] |_____| |_____| #
__#_ ____ ____ _#__
/ # \ / \ / \ / # \
| ################################# |
\____/ \____/ \____/ \____/
# @simulation: Fetchingffsocket
# Initializing system object
# Initializing simulation object
# Initializing from file config.xyz. Dimension: length, units: angstrom, cell_units: automatic
# Initializing from file config.xyz. Dimension: length, units: automatic, cell_units: automatic
# Initializing from file config.xyz. Dimension: length, units: automatic, cell_units: automatic
# Initializing from file config.xyz. Dimension: length, units: automatic, cell_units: automatic
# Resampling velocities at temperature 100.0 kelvin
# Binding the forces
@ForceField: Starting the polling thread main loop.
Backup performed: simulation.out -> #simulation.out#0#
Backup performed: simulation.pot -> #simulation.pot#0#
Backup performed: simulation.temperature -> #simulation.temperature#0#
Backup performed: simulation.pos_0.xyz -> #simulation.pos_0.xyz#0#
# i-PI loaded input file: config.xml
Backup performed: simulation.checkpoint -> #simulation.checkpoint#0#
@SOCKET: Client asked for connection from . Now hand-shaking.
@SOCKET: Handshaking was successful. Added to the client list.
# Average timings at MD step 0. t/step: 3.10373e-02
# Average timings at MD step 1000. t/step: 2.16075e-02
# Average timings at MD step 2000. t/step: 2.15009e-02
# Average timings at MD step 3000. t/step: 2.14084e-02
# Average timings at MD step 4000. t/step: 2.13720e-02
SOFTEXIT CALLED FROM THREAD <_MainThread(MainThread, started 8002945280)> @ SIMULATION: Exiting cleanly.
!W! Soft exit has been requested with message: ' @ SIMULATION: Exiting cleanly.
I-PI reports success. Restartable as is: NO.'. Cleaning up.
@SOCKET: Shutting down the driver interface.
@SOCKET: Problem shutting down the server socket. Will just continue and hope for the best.
SOFTEXIT: Saving the latest status at the end of the step
** Error ** : Wrapper did not send the positions
Backup performed: RESTART -> #RESTART#0#
!W! @SOFTEXIT: Kill signal. Trying to make a clean exit.
SOFTEXIT CALLED FROM THREAD <_MainThread(MainThread, started 8002945280)> @SOFTEXIT: Kill signal received
It seems to me like this works (it was supposed to run 5000 steps and it did), although the exit of the program confuses me. Why does it say "Error"?
Hi,
I tried to do a fresh install, but that made no difference. The env outputs of initial, after MBX, and after LAMMPS are all identical.
__CFBundleIdentifier=com.apple.Terminal
TMPDIR=/var/folders/t5/yf9ll0md7dl27z3qs5f4wc900000gn/T/
XPC_FLAGS=0x0
LaunchInstanceID=61C8B52A-03AB-4CAE-93AD-B18A75BE41AF
TERM=xterm-256color
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.obkUQQEDgS/Listeners
SECURITYSESSIONID=186a6
XPC_SERVICE_NAME=0
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=447
TERM_SESSION_ID=E46D64E5-6C51-4B14-82C8-24DEDD06A630
SHELL=/bin/zsh
HOME=/Users/julesoppenheim
LOGNAME=julesoppenheim
USER=julesoppenheim
PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/Users/julesoppenheim/opt/usr/local/lib:/Users/julesoppenheim/opt/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
SHLVL=1
PWD=/Users/julesoppenheim/Downloads/lammps-23Jun20227/src
OLDPWD=/Users/julesoppenheim/Downloads/lammps-23Jun20227/src/MAKE
MBX_HOME=/Users/julesoppenheim/Downloads/MBX-master7
FFTW_HOME=/opt/homebrew/Cellar/fftw/3.3.10_1
GSL_HOME=/opt/homebrew/Cellar/gsl/2.7.1
MPI_HOME=/opt/homebrew/Cellar/open-mpi/4.1.4_2
LLVM_HOME=/opt/homebrew/Cellar/llvm/15.0.7_1
LIBOMP_HOME=/opt/homebrew/Cellar/libomp/15.0.7
IPI_HOME=/Users/julesoppenheim/Downloads/i-pi-master
LAMMPS_POTENTIALS=/Users/julesoppenheim/Downloads/lammps-23Jun20226/potentials
LDFLAGS=-L/opt/homebrew/opt/llvm/lib
CPPFLAGS=-I/opt/homebrew/opt/llvm/include
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
MANPATH=/opt/homebrew/share/man::
INFOPATH=/opt/homebrew/share/info:
LANG=en_US.UTF-8
_=/usr/bin/env
unittest-system.cpp:1193:24: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
tools::ReadNrg("unittests_inputs/input_h2o_co2_ch4_dp1_unittest_system.nrg", systems);
unittest-system.cpp:1206:20: error: call to member function 'SetUpFromJson' is ambiguous
systems[1].SetUpFromJson("unittests_inputs/mbx_wextrajson_rightpaths.json");
~~~~~~~~~~~^~~~~~~~~~~~~
../../src/bblock/system.h:767:10: note: candidate function
void SetUpFromJson(std::string json_text);
^
../../src/bblock/system.h:773:10: note: candidate function
void SetUpFromJson(nlohmann::json j);