The Ghent Quantum Chemistry Package is a C++ library for electronic structure calculations.
Follow along the following documented example that calculates the FCI energy:
#include <gqcp.hpp>
// Create the molecular Hamiltonian parameters in an AO basis
auto h2o = GQCP::Molecule::Readxyz("data/h2o.xyz");
auto mol_ham_par = GQCP::HamiltonianParameters::Molecular(h2o, "STO-3G");
// Create a plain RHF SCF solver and solve the SCF equations
GQCP::PlainRHFSCFSolver plain_scf_solver (mol_ham_par, h2o);
plain_scf_solver.solve();
auto rhf = plain_scf_solver.get_solution();
// Transform the Hamiltonian parameters to the RHF basis
mol_ham_par.transform(rhf.get_C());
// Set up the FCI Fock space
auto K = mol_ham_par.get_K(); // number of spatial orbitials
auto N_alpha = h2o.get_N()/2;
auto N_beta = h2o.get_N()/2;
GQCP::ProductFockSpace fock_space (K, N_alpha, N_beta); // number of spatial orbitals, number
// Find the lowest eigenvalue using the Davidson algorithm, providing the Hartree-Fock initial guess
GQCP::FCI fci (fock_space); // has implemented the FCI matrix-vector product
Eigen::VectorXd initial_guess = fock_space.HartreeFockExpansion();
GQCP::DavidsonSolverOptions davidson_solver_options (initial_guess); // number of requested eigenpairs defaults to 1
GQCP::CISolver ci_solver (fci, mol_ham_par);
ci_solver.solve(davidson_solver_options);
// Retrieve the lowest eigenvalue
double fci_davidson_eigenvalue = ci_solver.get_eigenpair(0).get_eigenvalue();
Usage of this library can be found in the documented tests
directory, and common use cases are explained in the Wiki page. Full documentation can be generated using Doxygen, see below.
Before installing gqcp, please make sure the following dependencies are available on your system:
As gqcp uses the bassisets packaged with libint, please set the LIBINT_DATA_PATH
environment variable to the folder that contains these bases. In a default installation (of e.g. version v2.3.1), the data path is given by:
export LIBINT_DATA_PATH=/usr/local/libint/2.3.1/share/libint/2.3.1/basis
For a default CMake build, the steps are the following:
-
clone the master branch, which contains the latest release
https://github.com/GQCG/gqcp.git --branch master --single-branch cd gqcp
-
perform an out-of-source build:
mkdir build && cd build cmake .. make && make test && sudo make install
For this library, there are several extra options you can pass to the cmake ..
command:
-
-DINSTALLATION_PREFIX=prefix
, withprefix
(defaulted to/usr/local
) the installation prefix you want the library to be installed it. This option controls where the library is installed:- the header files will be installed in
prefix/gqcp/include
- the compiled library will be installed in
prefix/gqcp/lib
- drivers (optional) and benchmarks (optional) will be installed in
prefix/gqcp/bin
- CMake target files will be installed in
prefix/gqcp/cmake
- the header files will be installed in
-
-DBUILD_DOCS=ON
specifies that documentation should be built using Doxygen, in which case Graphviz is required for UML generation. A customdocs
target will then be configured by CMake, so thatmake docs
compiles the documentation. After compilation, the HTML documentation can be found in the
docs/html
directory inside your out-of-sourcebuild
directory. Navigating the documentation is easiest if you start with theindex.html
file. -
-DBUILD_DRIVERS=ON
controls that you want to build the extra drivers, which are executables for some common use-cases. -
-DBUILD_BENCHMARKS=ON
makes sure CMake adds the benchmark executables as targets. This uses Google benchmark, so make sure you have this installed if you wish to proceed with benchmarking on your system. -
-DUSE_MKL=ON
specifies that you would like to use MKL as your BLAS library.
If you want to use gqcp in another project, just add
find_package(gqcp 0.2.0)
to its CMake configuration, and it will ben provide gqcp_INCLUDE_DIRS
to be used in target_include_directories
and the target library gqcp
to be used in target_link_libraries
.