Skip to content

Relativistic second order multi-configuration perturbation calculation program with 1- and 2-electron integrals obtained from the DIRAC calculation.

License

Notifications You must be signed in to change notification settings

RQC-HU/dirac_caspt2

Repository files navigation

DIRAC-CASPT2: A relativistic second order multi-configuration perturbation calculation program

DIRAC-CASPT2-CI-test 日本語README

  • This program performs the second order multi-configuration perturbation calculation using the IVO/CASCI/CASPT2 or IVO/RASCI/RASPT2 method with 1- and 2-electron integrals obtained from the DIRAC calculation.

Contribution

If you want to contribute to this project (bug report, feature request, pull request, etc.), please read the CONTRIBUTING.md file before you start contributing.

Table of Contents

Download

  • Download the source code from GitHub.
git clone --depth=1 https://github.com/RQC-HU/dirac_caspt2.git

Prerequisites for build

If you want to build this program, you need to have the following compilers, tools and libraries installed on your machine.

  • GNU Fortran or Intel Fortran compiler (You can use the MPI compiler for parallel calculation)

  • CMake(version >= 3.14)

  • Intel MKL(Math Kernel Library)

    • You need to configure the environment variable $MKLROOT to link MKL. To verify that $MKLROOT is configured, run the following command

      echo $MKLROOT
    • If you want to build with BLAS/LAPACK implementation other than MKL, you need to specify --no-mkl option and specify the link path of BLAS/LAPACK in --flags at this moment.

      Example

      ./setup --no-mkl --flags "Replace this by Your BLAS and LAPACK Library link path" --fc gfortran --build
  • Python(version >= 3.6)

    • The setup script(build script), the dcaspt2 script(program execution script) and pytest use Python.

    • If Python (version >= 3.6) is not installed on your machine and you don't have root privileges, it is recommended to install and setup Python with Python version management tool such as pyenv

      (e.g.) pyenv setup instruction for Bash users

      # Download pyenv
      git clone https://github.com/pyenv/pyenv.git ~/.pyenv
      
      # Write the environmental variable and setup script for pyenv to the ~/.bashrc file
      echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
      echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
      echo 'eval "$(pyenv init -)"' >> ~/.bashrc
      
      # Reload ~/.bashrc
      source ~/.bashrc
      
      # Install Python (version >= 3.6)
      pyenv install 3.9.9
      
      # Set default Python version to the one installed with pyenv
      pyenv global 3.9.9
  • pytest

    • This program uses pytest to run tests.

    • If pytest is not installed on your machine, please install pytest with pip.

      pip install pytest

How to build

  • You can build this program with the setup script.
    • You can also build this program directly with CMake command, but we recommend you to use the setup script.
    • If you want to build directly with CMake, please see CMake build options.

Basic build

  • Change the directory to the source code directory.
cd /path/to/dirac_caspt2
  • Build the program with the setup script (If you don't specify the compiler, use the compiler that CMake finds first.)

    ./setup --build
    • If you want to build with the specific compiler, please specify the compiler with the --fc option

      ./setup --build --fc ifort
    • You can check the options of setup script with the following command

      ./setup --help
    • You can also do a parallel build with multiple cores. You can specify the number of cores with the -j option

      ./setup --build -j 4
    • If you want to use OpenMP for thread parallel execution, please specify the --omp option

      ./setup --build --omp
  • We recommend you to run tests after build

pytest --all

MPI Support

  • You can enable MPI support with the --mpi option (default compiler is mpiifort)

    ./setup --mpi --build
    • You can specify the compiler with the --fc option

      ./setup --mpi --fc mpif90 --build -j 4
    • You can also build with hybrid parallel execution with OpenMP

      ./setup --mpi --omp --fc mpiifort --build -j 4
  • We recommend you to run tests after build

# pytest --all --mpi=<number of MPI processes>
pytest --all --mpi=4

Installation

  • You can install the program into the directory specified by the --prefix option with the following command
# Use CMake to install the program
cmake --install build
# or use make to install the program
make -C build install

CMake build options

(This section is for advanced users.)

If you want to build directly with CMake, you can build with the following command

# DCMAKE_Fortran_COMPILER: Fortran compiler, (e.g.) ifort, gfortran, mpiifort
cmake -B build -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_BUILD_TYPE=Release -DOPENMP=ON && cmake --build build
pytest --all

You can use build options with cmake -DBUILDOPTION1=on -DBUILDOPTION2=off ,,, The following custom CMake build options are currently supported

  • MPI

    • Required if you want to use MPI. You need to build with MPI support to perform parallel execution.(default: OFF) (e.g.) Build with MPI support

      cmake -B build -DCMAKE_Fortran_COMPILER=mpiifort -DCMAKE_BUILD_TYPE=Release -DMPI=ON && cmake --build build
  • OpenMP

    • Required if you want to use OpenMP for thread parallel execution.(default: OFF) (e.g.) Build with OpenMP support

      cmake -B build -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_BUILD_TYPE=Release -DOPENMP=ON && cmake --build build
  • MKL

    • You need to disable this option if you want to use BLAS and LAPACK libraries other than MKL.(default: ON) (e.g.) Build without MKL support

      cmake -B build -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_BUILD_TYPE=Release -DMKL=OFF && cmake --build build

How to use

User manual

  • This section explains the minimum usage of the program
  • For more detailed usage of this program, please refer to the GitHub Wiki.

Prerequisites for execution

  • This program assumes that 1 and 2 electron integral files (MRCONEE, MDCINT, MDCINXXXX1...) are obtained by DIRAC calculation
  • You need an input file with any file name

Calculation

  • You can use this program with the dcaspt2 script
    • The dcaspt2 script is located in the bin directory or in the destination directory if installed by specifying with a --prefix option.

      # If you did not install with --prefix
      /path/to/dirac_caspt2/bin/dcaspt2 -i input_file
      # If you installed with --prefix
      $PREFIX/dcaspt2 -i input_file

      (e.g.)

      dcaspt2 -i h2.caspt2.inp

Input file

  • The input file is a text file with the following format

    • keyword (e.g. .ninact) is case-insensitive, so you are free to write it in uppercase or lowercase.

    • CASCI/CASPT2 input

      .ninact
      8
      .nact
      6
      .nsec
      142
      .nelec
      2
      .caspt2_ciroots
      3 1 2 3  ! calculate CASCI energy for total symmetry 3 (row 1) and CASPT2 energies for the 1st, 2nd, and 3rd roots of total symmetry 3 (row 2, 3 and 4)
      4 1      ! calculate CASCI energy for total symmetry 4 (row 1) and CASPT2 energies for the 1st root of total symmetry 4 (row 2)
      .eshift
      0.0
      .diracver
      21
      .subprograms
      CASCI
      CASPT2
      .end
      
    • RASCI/RASPT2 input

      .ninact
      30
      .nact ! sum of ras1, ras2 and ras3
      28
      .nsec
      574
      .nelec
      12
      .caspt2_ciroots
      33 1
      .eshift
      0.0
      .diracver
      22
      .ras1
      31..42
      2
      .ras2
      43..48
      .ras3
      49..58
      2
      .subprograms
      CASCI
      CASPT2
      .end
      
  • Please refer to the following for the meaning of each parameter and whether it is a required parameter or not

Input for CASCI and CASPT2

[required parameters]
.ninact         : the number of inactive spinors
.nact           : the number of active spinors
.nsec           : the number of secondary spinors
.nelec          : the number of active electrons in active space
.totsym         : total symmetry (ex. 5 for Ag in C2h closed shell)
.diracver       : DIRAC version
.subprograms    : List of subprograms separated by newlines (currently supported CASCI, CASPT2 and IVO)
.end            : The identifier at the end of the input file

[required parameters (IVO)]
.nocc           : The number of occupied MO (This option is for molecules without inversion center symmetry)
.noccg          : The number of occupied MO (gerade)
.noccu          : The number of occupied MO (ungerade)

[required parameters (CASCI and CASPT2)]
.caspt2_ciroots : Multiple line input. total symmery to calculate CASCI/CASPT2 energy (ex. 5 for Ag in C2h closed shell) (row 1),
                  number of roots that you want to calculate CASPT2 energy (row 2 and later)

[optional parameters]
.eshift         : for real shift (default: 0)
.ras1           : RAS1 spinor list (row 1)and the maximum number of hole allowed in ras1(row 2)
.ras2           : RAS2 spinor list
.ras3           : RAS3 spinor list (row 1) and the maximum number of electrons in ras3(row2)
.minholeras1    : The minimum number of hole in ras1 (default: 0)
.scheme         : MOLTRA SCHEME, if you explicitly set the non-default .SCHEME value in **MOLTRA, you must set the same value for this option. (ref .SCHEME: https://diracprogram.org/.doc/release-23/manual/moltra.html#scheme)
.debugprint     : This keyword invokes priniting of additional information in the output file
.restart        : Restart calculation from the previous calculation. You need to generate the caspt2_restart file by running gen_dcaspt2_restart [previous_calclation_output] and put it in the same directory as the input file. (default: .false.)
.countndet      : Count and print the number of determinants for each total symmetry of this input file, and skip the any other calculations. If you set this option, you don't need to set .subprograms parameter. (default: false)

[optional parameters (IVO)]
.nhomo          : The number of HOMO-like spinors (default: 0)
.nvcut          : The number of virtual cut MO (default: 0, This option is for molecules without inversion center symmetry)
.nvcutg         : The number of virtual cut MO (default: 0, gerade)
.nvcutu         : The number of virtual cut MO (default: 0, ungerade)

Input file specification

  • Reads 500 characters per a line

  • Recognizes lines with an end parameter as the end of the input file

  • Exits the program as invalid input if the required variable specifications are not filled.

  • If you write ! or #, the rest of the characters are recognized as comments.

     .nact ! The number of nact
     ↓
     .nact
    
  • Two or more consecutive dots are considered to be a range specification

    • You need to write the smaller number to the left of the dot and the larger number to the right
  .RAS2
  2..5
  ↓
  2,3,4,5
  • Recognizes a , (semicolon) or half-width space as a numeric delimiter
  .RAS1
  1..4, 7   8 11..14
  ↓
  1,2,3,4,7,8,11,12,14

License

Citation

  • Please cite the following paper when you publish the data obtained by using this program.
    1. Masuda Y, Noda K, Iwamuro S, Nakatani N, Hada M, Abe M. Relativistic CASPT2/RASPT2 Program along with DIRAC software. ChemRxiv. 2024; doi: 10.26434/chemrxiv-2024-t9x0l This content is a preprint and has not been peer-reviewed.

About

Relativistic second order multi-configuration perturbation calculation program with 1- and 2-electron integrals obtained from the DIRAC calculation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages