2.2 Linux Pre-built and MacOS brew Build

This section goes over several installing approaches that, unlike Section 2.3, does not require building from source manually.

  1. Install from conda (for Linux only). Binary package is provided in this approach.

  2. Use homebrew build (for MacOS only). Although there's no binaries for MacOS yet, this approach will build it automatically.

  3. Manually download pre-built Linux binaries (it's not a conda package).

    Unlike conda, this approach will not take care of dependency versions (like numpy) for you, and you need to set environment variables manually. So this approach is usually not recomended.

    However, this approach does not require network, which may be a reason for choosing it.

  4. Even simpler way to use pre-built Linux binaries.

Setups after installation

Like Section 2.3, there is still something to do after "installation".

  1. Setup the environment variables of MOKIT itself. Except conda users, all other users need to set that, which is mentioned at the end of each approaches.
  2. Setup the environment variables of dependencies, like Gaussian, GAMESS, PySCF, etc. Please read Section 2.5 to determine which dependencies are necessary for you and read Section 2.3.4 to set up them.

2.2.1 Online Installation

You can choose option 1 or 2 below. After mokit is successfully installed, if you want GAMESS to be called by automr, you need to install GAMESS properly and write related environment variables.

Option 1: Install from conda (for Linux only)

This is the easiest way, but network is required to auto-download the requirements (like Intel MKL).

If you have no access to network, but still do not want to compile MOKIT manually, you can try options in Section 2.2.2.

use MOKIT with default channel

Creating a new environment before installing is highly recommended, to avoid changing your base environment.

conda create -n mokit-py39 python=3.9 # 3.8-3.11 are available
conda activate mokit-py39
conda install mokit -c mokit

Each time when you login onto the machine, you need to activate the virtual environment by conda activate mokit-py39 and then you can use MOKIT.

If you have not installed PySCF and you want to install it now, you can choose to

(1) run pip install pyscf in this virtual environment.

(2) follow the instruction below to install pyscf and MOKIT with conda-forge channel.

Update MOKIT with conda

Usually conda update mokit -c mokit works. Sometimes it may fail to find the latest version of MOKIT. In this case, a workaround can be

conda uninstall mokit mkl
conda install mokit -c mokit

use MOKIT with conda-forge channel

The MOKIT installed following instructions above, which is from mokit channel by default, is hardly compatible with conda-forge environment. If you have to enable conda-forge, an alternative way is to install from mokit/label/cf

If you have enabled conda-forge (by conda config --add channels conda-forge or modifying condarc), you can directly do

conda install mokit -c mokit/label/cf

If not, it's recommended to create an environment first before installing.

conda create -n mokit-cf python=3.9 -c conda-forge # 3.9-3.11 are available
conda activate mokit-cf
conda install mokit -c mokit/label/cf -c conda-forge

When pyscf is also needed, it can be installed in the conda-forge channel at the same time

conda install mokit pyscf -c mokit/label/cf -c conda-forge

or separately

conda install pyscf -c conda-forge
conda install mokit -c mokit/label/cf -c conda-forge

Option 2: Use homebrew-toolchains (for MacOS only)

  • Prerequisites:
    • You need to install homebrew on your mac

If you are mainland China user, follow brew mirrors help doc to install prerequisites

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Release Installation

Assume you will use mokit in a python 3.9 environment (3.8-3.11 are all available)

brew install ansatzx/homebrew-mokit/mokit --with-py39

or

brew tap ansatzx/homebrew-mokit
brew install mokit --with-py39 

However, the release version is not up-to-date, it's highly recommended to install the latest commit.

Latest Commit Installation

Also assume you use mokit in a py-39 environment.

brew install ansatzx/homebrew-mokit/mokit --with-py39 --HEAD

Finally, follow caveats guides, add these commmand in your ~/.zshrc (or bash/fish etc. profile).

You can run brew info mokit to check details.

export MOKIT_ROOT="$(brew --prefix mokit)"
export PATH=$MOKIT_ROOT/bin:$PATH
export PYTHONPATH=$MOKIT_ROOT:$PYTHONPATH
export LD_LIBRARY_PATH=$MOKIT_ROOT/mokit/lib:$LD_LIBRARY_PATH

Upgrade Mokit

release upgrade
brew update -f 

Run the command below if there's a newer mokit release.

brew upgrade mokit  # or `brew upgrade ` to upgrade everything

latest commit upgrade
brew upgrade --fetch-HEAD mokit

2.2.2 Pre-built Linux Executables and Libraries

Unlike the conda install approach, using pre-built MOKIT in this subsection do not require network. If you want full functionality of MOKIT, you still need to have necessary dependencies: Python3 environment and NumPy, which can be achieved by anaconda/miniconda (Read here for installing anaconda offline). If you only want part of MOKIT, especially some certain binary utilities, see Section 2.2.3 for a simpler instruction.

Download

centos7_conda_py38
centos7_conda_py39
py39_gcc10
py310_gcc10

After downloading the pre-built artifacts, you need to set the following environment variables (assuming MOKIT is put in $HOME/software/mokit) in your ~/.bashrc:

export MOKIT_ROOT=$HOME/software/mokit
export PATH=$MOKIT_ROOT/bin:$PATH
export PYTHONPATH=$MOKIT_ROOT:$PYTHONPATH
export LD_LIBRARY_PATH=$MOKIT_ROOT/mokit/lib:$LD_LIBRARY_PATH
export GMS=$HOME/software/gamess/rungms

The LD_LIBRARY_PATH is needed since the OpenBLAS dynamic library is put there. Remember to modify the GMS path to suit your local environment.

Warning

The PYTHONPATH has changed since MOKIT version 1.2.5rc2.

Note that you need to run source ~/.bashrc or exit the terminal as well as re-login, in order to activate newly written environment variables.

How to choose Anaconda Version if installing offline

Installing prebuilt MOKIT offline usually means the user cannot get NumPy with network. So it's important to get a certain version of anaconda which provides proper version of NumPy needed by MOKIT. The recommended versions of anaconda for some prebuilts are listed below (compatible miniconda version is also listed but it does not mean miniconda comes with NumPy). See Anaconda release note for more information.

If your linux kernel is roughly as old as Centos7's, choose the one started with centos7_.

ArtifactsPython versionCompatible Anaconda versionCompatible Miniconda versionNumPy version
centos7_conda_py383.82021.05py38_4.10.31.20
centos7_conda_py393.92022.10py39_22.11.11.21
py39_gcc103.92022.10py39_22.11.11.21
py310_gcc103.102023.03py310_23.3.11.23

How to download certain version of anaconda?

For example, if you are using TUNA Mirror, you can go to mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ and find Anaconda3-[some version]-Linux-x86_64.sh. The page address is similar in other mirror site, like NJU Mirror.

Detailed Compatibility Note

ArtifactsCompatible OSMaybe CompatiblePython versionGCC versionNumPy version
centos7_conda_py38Centos 73.84.8.51.20
centos7_conda_py39Centos 73.94.8.51.21
py39_gcc10Debian 11, Ubuntu 20.04SUSE 153.910.21.21
py310_gcc10Debian 11Ubuntu 22.043.1010.21.23

Tips:

  • Do not extract the zip with right-click (like the one in KDE)! Use unzip in command line.
  • The artifacts started with 'centos7_conda' need to be used with Anaconda3/Miniconda3, and the rest works with system-provided python (conda is also OK).
  • We cannot list every supported linux distribution here, especially those similar to listed ones: Rocky Linux, OpenEuler, etc. More compatibility tests and reports are welcome.
  • The GCC and NumPy version listed refer to the version used to compile the artifacts.
    • NumPy can be sensitive to version sometimes. Try upgrade (or downgrade) numpy if your python complained about version when import.
    • The NumPy version for each prebuilt is fixed, because offline anaconda users cannot update anything and have to follow the anaconda version recommendation above. We may switch to newer miniconda image when the current ones are considered too old. The NumPy version for py*_gcc* prebuilts used to be latest but after 1.2.6rc26 they are also fixed.

2.2.3 Only want frag_guess_wfn?

If you do not need full functionality of MOKIT and only want frag_guess_wfn for generating the input file of various EDA methods (or other binary utilities, like fch2mkl), the easiest way is to download the pre-compiled MOKIT in Section 2.2.2. There is no need to install Miniconda/Anaconda Python in this case, and no need for conda install.

Firstly, download a pre-compiled MOKIT package according to your OS (e.g. CentOS 7), and change the directory name

unzip mokit-master_linux_centos7_conda_py39.zip
rm -f mokit-master_linux_centos7_conda_py39.zip
mv mokit-master_linux_centos7_conda_py39 mokit

Then write proper environment variables in your ~/.bashrc file,

export MOKIT_ROOT=$HOME/software/mokit
export PATH=$MOKIT_ROOT/bin:$PATH
export LD_LIBRARY_PATH=$MOKIT_ROOT/mokit/lib:$LD_LIBRARY_PATH

Remember to run source ~/.bashrc to make the environment variables valid. If you are working on a Cluster(集群) and using a script to submit any computational task, you should write the environment variables into your script.