3. MacOS

There are three options:

A: Run simulations from Terminal.

B: Run simulations with nextnanopy.

C: Run simulations with nextnanomat using Wine or Mono (not yet tested).

We strongly recommend the option B.

Basic simulation is possible from (A) Terminal. (B) nextnanopy Python package can not only run the simulations but also sweep variables and postprocess the results. For the options A and B, you need nextnano executables compiled for Mac, which we can provide you on request. Please feel free to contact us at support [at] nextnano.com. For the option C, Mono requires the Mac executables but Wine uses the ones compiled for Windows.

As of 1 Jul. 2021, we have not yet tested the option (C) for macOS Big Sur.

3.1. Option A: Run simulations from Terminal

The terminal commands for two nextnano++ and nextnano³ sample input files can then be given as follows, to be executed from the nextnano folder:

./<nextnano3 mac executable name>.exe -log -license "License/License_nnp.lic" -outputdirectory "Output/<name_of_input_file>" -inputfile "Sample files/nextnano3 sample files/1D_simple_GaAs_QW.in"
./<nextnano++ mac executable name>.exe --license "License/License_nnp.lic" --outputdirectory "Output" -log "Sample files/nextnano++ sample files/Quantum Mechanics examples/QW_finite_1D_nnp.in"

Detailed documentation on command line features can be found in Command line arguments (nextnano++) and Command line arguments (nextnano³).

3.2. Option B: Run simulations with nextnanopy

nextnanopy (see Introduction) is our Python package for running simulations, sweeping variables and postprocessing results.

Install Python

You can 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 ARM64 Mac with macOS 11.4 (Big Sur).

  1. In a macOS Terminal, type in:

    # install Command Line Tools, if not installed on your machine
    xcode-select --install
    
    # install Homebrew, if not installed (cf. Homebrew website)
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    # update Homebrew
    brew update
    
    # search for available Python packages
    brew search python
    
    # install Python3
    brew install python3
    
  2. 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=/opt/homebrew/opt/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
    
  3. 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 Installation. Manual installation using Git looks like:

## 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

For the automatic installation, you can use pip:

pip install nextnanopy

Configure nextnanopy

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 Tutorials and sample Python scripts to learn how to run a simulation with nextnanopy. nextnanopy repository includes sample Python scripts under /nextnanopy/templates.

3.3. Option C: Run simulations with nextnanomat using Wine or Mono

This option is for those who wish to use GUI nextnanomat to run simulations.

nextnanomat is programmed in C#, and can thus be executed on any operating system. It is, however, developed on and optimized for Windows. On macOS, you have to install either Wine or Mono to run nextnanomat.

Wine was available from Mountain Lion 10.8 until Mojave 10.14. We confirmed that using Wine one could run nextnanomat.exe on Mojave 10.14.

Wine did not work on Catalina 10.15 or later. However, Wine version 6.0.1 released on 7 Jun. 2021 is said to support wine64 on Apple M1. We will test once the built package becomes available.

The following is for macOS 10.14 Mojave.

Installation procedure

  1. Install XQuartz (version 2.7.7 or later).

    • Please open Xquartz and check if it starts without errors.

  2. Install Wine Stable for macOS.

    • On the website, both .pkg files and .tar.gz files are provided. Installation from .pkg files is handy. In this case, however, only the 32-bit version of nextnano software can be used, and currently one has to make sure that appropriate libiomp5.dll files are located in the same directory as “nextnano3.exe” and “nextnano++.exe” (even for the serial version of nextnano). If you need libiomp5.dll files, please contact us.

    • If you install Tarball for “Wine Stable” (32 + 64-bit), the 64-bit version is also available.

  3. Install winetricks.

    • Launch Wine stable from Applications or Launchpad.

    • Terminal window shows up with a short introduction of important commands.

      Wine
    • Run
      ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
      brew install winetricks
      
  4. Install .NET Framework using winetricks. .NET Framework of version 4.5.2 or later is needed.

winetricks dotnet452

- Follow the instructions and ignore Warnings.
- Restart the computer.
  1. Fonts and configuration

    • Launch Wine stable again.

    • Run:
      winetricks corefonts   # install basic fonts of Windows
      winecfg  # Configure Wine
      
    • Setting window shows up. Select “Windows 10” for Windows version in the “Application” tab.

    • Press “OK” button.

Running nextnanomat

  1. Launch Wine Stable from Application or Launchpad.

  2. Run:

    wine /<your directory>/nextnanomat.exe
    
  3. Activate the license with your email address (only once) and have fun!

If you have any feedback on these instructions, please let us know by sending an email to support [at] nextnano.com. It helps us keeping our documentation up to date.