Installation on macOS (via MacPorts)
This section will guide you through installing and compiling NextGenPB from source using MacPorts, a package manager for macOS.
Homebrew can be used too.
✅ Step 1: Install Core Dependencies
We’ll begin by installing necessary packages via MacPorts. This may take a while.
sudo port install openmpi cmake onetbb boost cgal5 nlohmann-json jansson octave
sudo port install mumps +openmpi -mpich
sudo port install lis +openmpi -mpich
sudo port install p4est +openmpi -mpich
+openmpi
ensures compatibility with the MPI implementation NextGenPB expects.-mpich
avoids conflicts from having multiple MPI stacks.
✅ Step 2: Install External Libraries
These libraries are not managed by MacPorts and must be installed manually.
NanoShaper: Generate molecular surfaces
NanoShaper is required to compute molecular surfaces.
git clone https://gitlab.iit.it/SDecherchi/nanoshaper.git
cd nanoshaper
cp CMakeLists_so.txt CMakeLists.txt
cd build_lib
cmake .. -DCGAL_DIR=/opt/local/ -DCMAKE_BUILD_TYPE=Release
make
- CGAL is required for NanoShaper’s surface triangulation.
- The library will be used later by the main NextGenPB build.
octave_file_io: Required for .octbin handling
Needed to interface with .octbin files generated by GNU Octave.
git clone https://github.com/carlodefalco/octave_file_io.git
cd octave_file_io
./autogen.sh
mkdir build
cd build
../configure CXX=mpicxx --prefix=/opt/octave_file_io/1.0.91 --with-octave-home=/opt/local/bin 'LDFLAGS=-Wl,-rpath -Wl,/opt/local/lib/libgcc -Wl,-rpath -Wl,/opt/local/lib/gcc13 -ld_classic'
make
sudo make install
bim++ (NextGenPB branch)
Download and configure the custom FEM library:
wget https://github.com/carlodefalco/bimpp/archive/refs/tags/NextGenPB-v0.0.01.tar.gz
tar -xvzf NextGenPB-v0.0.01.tar.gz
cd bimpp-NextGenPB-v0.0.01
./autogen.sh
mkdir build && cd build
Configure build options carefully:
../configure --prefix=/opt/bimpp \
LDFLAGS="-L/opt/local/lib -Wl,-rpath,/opt/local/lib/libgcc -Wl,-rpath,/opt/local/lib/gcc14" \
CPPFLAGS="-I/opt/local/include/ -I/opt/local/include/gcc14 -DOMPI_SKIP_MPICXX -DHAVE_OCTAVE_44 -DBIM_TIMING" \
--with-blas-lapack="-lopenblas" \
--with-octave_file_io-home=/opt/octave_file_io/1.0.91 \
--with-octave-home=/opt/local/bin \
--with-p4est-home=/opt/local \
--with-lis-home=/opt/local \
--with-mumps-home=/opt/local \
--with-mumps-extra-libs="-L/opt/local/lib -lptscotch -lscotch -lmpi -Wl,-flat_namespace -Wl,-commons,use_dylibs \
-L/opt/local/lib/openmpi-mp -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lopenblas -L/opt/local/lib/gcc14 -lgfortran" \
F77=mpif90 CXX=mpicxx MPICC=mpicc CC=mpicc \
CXXFLAGS="-std=c++17 -O3 -mtune=native -march=native"
Then compile and install:
make
sudo make install
✅ Step 3: Build NextGenPB
Prepare Build Settings
Copy the appropriate local_settings.mk file from the local_setting/
directory:
cp local_setting/local_settings_mac.mk src/local_settings.mk
Edit this file as needed for macOS-specific paths and compiler flags.
Compile the executable
From the src
directory:
make clean all
This will create the binary ngpb
inside the src
directory.
✅ Step 4: (Optional) Add ngpb to Your Path
To call ngpb from any directory:
echo 'export PATH=/path/to/ngpb/src:$PATH' >> ~/.zshrc
source ~/.zshrc
✅ You’re now ready to run simulations with NextGenPB!
➡️ Go to running section to learn out to run the solver.