Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Francesco's psi4/ambit/forte setup (Mac BigSur 11.6.1, Dec. 2021) #277

Open
fevangelista opened this issue Dec 6, 2021 · 3 comments
Open

Comments

@fevangelista
Copy link
Member

I have recently updated the OS on my Mac and decided that it would be a good idea to post a recipe to configure psi4/ambit/forte.

  1. Conda-forge environment. Download Miniconda and install it via:

    sh Miniforge3-MacOSX-x86_64.sh
  2. Create a forte environment. We create an environment with Python 3.9 and psi4/forte dependencies:

    conda create -n forte cmake nomkl numpy boost hdf5 yaml jupyterlab eigen mpfr pytest scikit-image python=3.9 pydantic pint pybind11
  3. Install libint2. This is required by psi4 and will save a ton of compilation time:

    conda install -c psi4/label/dev libint2
  4. Install pythreejs (optional). This is a 3D rendering library required to run fortecubeview:

    conda install -c conda-forge pythreejs
    conda install nodejs -c conda-forge --repodata-fn=repodata.json # this is here to download a fairly recent version of Node.js
    jupyter labextension install @jupyter-widgets/jupyterlab-manager 
    jupyter labextension install jupyter-threejs
  5. Compile ambit. I keep all my source files in the directory /Users/fevange/src. Start by git cloning ambit

    src> git clone https://github.com/jturney/ambit.git

    In the folder src I store the following script (compile-ambit.sh) which can be called to compile ambit

    #! /bin/tcsh
    # Script to compile ambit on a mac
    
    # Modify the following parameters
    set srcdir = /Users/fevange/Source/ambit        # <- location of source
    set build_type = Release                                   # <- debug, release, or relwithdebinfo
    
    # define object and prefix dirs
    set prefix = /Users/fevange/Bin/ambit-$build_type
    
    # prepare to run cmake
    cd $srcdir
    rm -rf objdir
    rm -rf $prefix
    
    cmake -H. -Bobjdir \
    -DCMAKE_BUILD_TYPE=$build_type \
    -DCMAKE_INSTALL_PREFIX=$prefix \
    
    cd objdir
    make
    make install
  6. Compile psi4. Start by git cloning psi4

    src> git clone https://github.com/psi4/psi4.git

    In the folder src I store the following script (compile-psi4.sh) which can be called to compile psi4

    #! /bin/tcsh
    # Script to compile psi4 on a mac
    
    # Modify the following four parameters
    set srcdir = $HOME/Source/psi4    # <- location of psi4 source
    set bindir = $HOME/Bin/psi4       # <- location of psi4 bin
    set psi4type = Debug              # <- debug, release, ...
    set anaconda = $HOME/miniforge3/envs/forte
    
    # define object and prefix dirs
    set objdir = $srcdir/objdir-$psi4type
    set prefix = $bindir-$psi4type
    
    # prepare to run cmake 
    rm -rf $objdir
    cd $srcdir
    
    cmake -H. -B$objdir \
    -DCMAKE_BUILD_TYPE=$psi4type \
    -DLibint2_DIR=$anaconda/share/cmake/Libint2 \
    -DCMAKE_INSTALL_PREFIX=$prefix \
    -DENABLE_PLUGIN_TESTING=OFF \
    -DENABLE_OPENMP=OFF \
    -DBUILD_SHARED_LIBS=ON
    
    cd $objdir
    make -j4
  7. Compile forte. Start by git cloning forte

    src> git clone https://github.com/evangelistalab/forte.git

    In the folder src I store the following script (compile-forte.sh) which can be called to compile psi4

    #! /bin/tcsh
    # Script to compile forte
    
    # Modify the following parameters
    set ambit_dir = /Users/fevange/Bin/ambit-Release/share/cmake/ambit/
    set srcdir = /Users/fevange/Source/forte        # <- location of source
    set build_type = RelWithDebInfo                 # <-  
    
    # prepare to run cmake
    cd $srcdir
    
    set cmake_psi4 = `psi4 --plugin-compile`
    
    $cmake_psi4 \
    -Dambit_DIR=$ambit_dir \
    -DCMAKE_BUILD_TYPE=$build_type \
    -DENABLE_ForteTests=TRUE
    
    make -j4
@chrinide
Copy link

chrinide commented Jan 7, 2022

Will it be available in Anaconda PSI4 Packages?

@fevangelista
Copy link
Member Author

@chrinide: making a conda package is on our todo list.

@abidart
Copy link

abidart commented Oct 19, 2022

Just sharing in case it could be helpful to someone else:

Step 2 was not working for me because it seems pint is not in the default miniconda channels. I was able to complete step 2 it after adding conda-forge as a channel.

conda create -n forte -c conda-forge cmake nomkl numpy boost hdf5 yaml jupyterlab eigen mpfr pytest scikit-image python=3.9 pydantic pint pybind11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants