Option B: Run simulations with nextnanopy
nextnanopy is our open-source Python package for running simulations, sweeping variables and post-processing results.
To run a simulation on MacOS (Intel or ARM) with nextnanopy, you need to download nextnano executables compiled for that operating system and processor, which you can find on our download page macOS and Linux.
Install Python
One way is to install Python package Anaconda to establish a Python environment including NumPy, Matplotlib and an IDE called “Spyder”. With this, you can use nextnanopy from a graphical user interface.
Here, we explain an alternative way to install a Python package from Terminal via Homebrew. We have tested this with an M1 Mac with macOS 11.4 (Big Sur).
See Homebrew documentation and install Homebrew.
In a macOS Terminal, type in:
# install Command Line Tools, if not installed on your machine xcode-select --install # update Homebrew brew update # install Python3 brew install python3
Unversioned commands ‘python’, ‘pip’ etc. pointing to ‘python3’, ‘pip3’ etc., respectively, are installed into, e.g.,
/opt/homebrew/opt/python@3.9/libexec/bin. It is useful to set this path to~./zprofile.# open ~/.zprofile with a text editor and write ``eval "$(/opt/homebrew/bin/brew shellenv)"`` ``export PATH=/path/to/python@3.9/libexec/bin:$PATH`` # apply the changes source ~/.zprofile # make sure that the version 3.9 or later has been installed python --version # upgrade pip (NOT update) pip install --upgrade pip
Using
pip, please install NumPy and Matplotlib which are required for nextnanopy.pip install numpy pip install matplotlib
Install nextnanopy
You can either manually or automatically install nextnanopy. For more details, please refer to: nextnanopy
Manual installation:
# go to a folder where you want to store local repository of |nextnanopy| project
cd <folder name>
# clone source code from Github
git clone https://github.com/nextnanopy/nextnanopy.git
# build nextnanopy
cd nextnanopy/
python setup.py install
Automatic installation:
pip install nextnanopy
Configure nextnanopy
Please refer to our documentation on License Activation.
Open the file config_nextnano.py with an text editor to adjust the paths to your license, output and executable installation folders:
open config_nextnano.py
# (adjust the paths)
# (save the file)
# run the config file to apply changes
python config_nextnano.py
Running nextnanopy
Please see nextnanopy and sample Python scripts to learn how to run a simulation with nextnanopy. The repository of nextnanopy includes sample Python scripts under /nextnanopy/templates.
Last update: 07/11/2024