libOMM
Orbital Minimization Method (OMM) to solve the Kohn-Sham equation as a generalized eigenvalue problem for a fixed Hamiltonian.
Summary
| Latest Version | Unknown |
|---|---|
| License | Unknown |
| CI Status | Failing |
| Stars | 1 |
| Forks | 2 |
| Open Issues | 0 |
| Last Commit | 2026-11-18 |
| Downloads | 0 |
| Last Indexed | 2026-11-23 09:07 |
Installation
nimble install libOMM
choosenim install libOMM
git clone https://gitlab.com/ElectronicStructureLibrary/omm/libomm
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| libOMM | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://gitlab.com/ElectronicStructureLibrary/omm/libomm |
|---|---|
| Homepage | https://gitlab.com/ElectronicStructureLibrary/omm/libomm |
| Registry Source | gitlab |
README
libOMM
Description
libOMM solves the Kohn-Sham equation as a generalized eigenvalue problem for a fixed Hamiltonian. It implements the orbital minimization method (OMM), which works within a density matrix formalism. The basic strategy of the OMM is to find the set of Wannier functions (WFs) describing the occupied subspace by direct unconstrained minimization of an appropriately-constructed functional. The density matrix can then be calculated from the WFs. The solver is usually employed within an outer self-consistency (SCF) cycle. Therefore, the WFs resulting from one SCF iteration can be saved and then re-used as the initial guess for the next iteration.
Detecting MatrixSwitch
libOMM is built on top of MatrixSwitch. Installing MatrixSwitch is thus required before configuring libOMM. For instructions on how to install MatrixSwitch, please consult https://gitlab.com/ElectronicStructureLibrary/omm/matrixswitch.
One essential concept to set up the detection is the root installation path,
also called "install prefix", of MatrixSwitch. We will call it
MATRIXSWITCH_ROOT. When using it, a build system will always expect the
following:
- A Fortran module or C header file will be found in the corresponding
include directory, i.e.
${MATRIXSWITCH_ROOT}/include. - A library will be found in the corresponding library directory, i.e.
${MATRIXSWITCH_ROOT}/lib(sometimes${MATRIXSWITCH_ROOT}/lib64).
This is because the structure of installation directories has been standardised a long time ago.
This means that, by providing the root installation path, most build systems are able to deduce where to look for specific files. This is for instance the case of the Autotools, which rely a lot on standardisation.
In addition to the required files, helper files may also be installed with the rest of the package and provide relevant information to build systems. This is very useful when multiple installations of the same library coexist on the same machine.
There are 2 preferred ways to access relevant information about an installed
MatrixSwitch library: CMake modules and pkg-config. This can however be done
manually as well.
With CMake modules
When installing MatrixSwitch, a ${MATRIXSWITCH_ROOT}/lib/cmake subdirectory
is created and filled-in with CMake modules. By pointing the
-DCMAKE_PREFIX_PATH option of CMake to this directory when configuring the
build, CMake will be able to leverage all the information contained in this
directory to link against that particular version of MatrixSwitch.
With pkg-config
pkg-config is a popular developer tool to look for the dependencies of a
software package. To check whether it is installed on your machine, simply type
pkg-config --version. If it returns a version number, you are good to go.
Otherwise, it can easily be installed with your preferred package manager.
To know about a specific version of MatrixSwitch, pkg-config has to be
pointed to the ${MATRIXSWITCH_ROOT}/lib/pkgconfig directory. This can be done
by setting an environment variable in your shell session or build script:
PKG_CONFIG_PATH="${MATRIXSWITCH_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH
Manually
When the build system is able to use the information provided by CMake modules
or pkg-config directly, the detection of MatrixSwitch is automatic.
Otherwise, this information can be provided in a different format by
pkg-config itself, when the build system is not able to access it, e.g.:
MATRIXSWITCH_INCS="$(pkg-config --cflags matrixswitch)"
MATRIXSWITCH_LIBS="$(pkg-config --libs matrixswitch)"
If pkg-config is absent, the corresponding compiler flags can still be
specified directly, e.g.:
MATRIXSWITCH_INCS="-I/opt/esl/matrixswitch/include"
MATRIXSWITCH_LIBS="-L/opt/esl/matrixswitch/lib -lMatrixSwitch"
In such a case, the MATRIXSWITCH_ROOT variable could be set to
/opt/esl/matrixswitch and used in the above lines, instead of specifying the
absolute path, i.e.:
MATRIXSWITCH_INCS="-I${MATRIXSWITCH_ROOT}/include"
MATRIXSWITCH_LIBS="-L${MATRIXSWITCH_ROOT}/lib -lMatrixSwitch"
Detecting optional features
There are 3 optional features in libOMM: MPI, LINALG (linear algebra), and DBCSR. There are set as "auto" by default. This means that, if the build system is able to configure them, they will be enabled, otherwise they will be disabled. If they are explicitly requested by the user, they will cause the configure step to fail if they cannot be set up properly. If they are not desired by the user, they must be truned off explicitly.
MPI is a compiler feature and is detected by checking that the compiler is able to compile MPI-aware code. The other optional features are detected the same way as MatrixSwitch.
These optional features are interdependent. If MPI is not found, linear algebra will be available in serial mode only (BLAS, LAPACK), and DBCSR will always be disabled. If MPI is found, linear algebra will require all libraries to run in parallel mode, including ScaLAPACK, and DBCSR will be enabled when found.
With CMake
Requesting MPI support is done by pointing the CMake compilers to working MPI wrappers, e.g. for GCC:
cmake \
-DCMAKE_C_COMPILER="mpicc" \
-DCMAKE_CXX_COMPILER="mpic++" \
-DCMAKE_Fortran_COMPILER="mpifort" \
...
Linear algebra is divided into 2 options: WITH_LAPACK for serial linear
algebra, and WITH_SCALAPACK for parallel linear algebra (with MPI). If the
operating system environment has been configured to provide a seamless access
to these libraries, they will be detected and configured automatically. In this
case, the -DWITH_LAPACK=ON will be sufficient. If not, the -DLAPACK_LIBRARY
option of CMake must be used to tell the build system to use a specific
library, e.g.:
...
-DWITH_LAPACK="ON" \
-DLAPACK_LIBRARY="-L/usr/local/lib -lopenblas" \
...
The same holds for ScaLAPACK. Please note that ScaLAPACK can be enabled only if MPI and LAPACK are available.
To request the support for DBCSR, the path to the DBCSR root directory needs to be
provided setting the variable -DDBCSR_ROOT. DBCSR can be enabled only if MPI and
LAPACK are available.
With the Autotools
Requesting MPI support can be done in 2 ways: providing MPI-aware compiler
wrappers to the configure script, or using its --with-mpi option. In the
first case, the CC, CXX and FC environment variables have to be provided
externally or as command-line arguments, e.g.:
CC="mpicc"; export CC
CXX="mpic++"; export CXX
FC="mpifort"; export FC
or:
../configure \
... possible configure options ... \
CC="mpicc" \
CXX="mpic++" \
FC="mpifort"
In the second case, the --with-mpi option must point to the root installation
directory of a MPI implementation, e.g.:
../configure \
... possible configure options ... \
--with-mpi="/opt/openmpi/4.1.4"
Using --with-mpi without argument is equivalent to require MPI support,
assuming that the compiler environment variables have already been defined in
the environment. In this case, the configure script will fail if MPI is not
working.
Linear algebra support can be requested through the --with-linalg option or
through environment variables. As with MPI, the --with-linalg option must
point to the installation root directory of a linear algebra implementation,
e.g.:
../configure \
... possible configure options ... \
--with-linalg="/opt/openblas/0.3.21"
The environment variables can be provided externally or as command-line arguments, e.g.:
LINALG_INCS="-I/opt/openblas/0.3.21/include"; export LINALG_INCS
LINALG_LIBS="-L/opt/openblas/0.3.21/lib -lopenblas"; export LINALG_LIBS
or:
../configure \
... possible configure options ... \
LINALG_INCS="-I/opt/openblas/0.3.21/include" \
LINALG_LIBS="-L/opt/openblas/0.3.21/lib -lopenblas"
Using --with-linalg without argument is equivalent to requiring linear
algebra support and assuming the compilers have intrinsic support for linear
algebra.
If MPI is enabled, the full set of linear algebra libraries, including ScaLAPACK, must be specified as one block, e.g.:
LINALG_LIBS="-L/opt/netlib/3.11/lib -lscalapack -llapack -lblas"
Requesting support for DBCSR works the same as for ScaLAPACK. Please note that MPI must be enabled.
Manually
As for MatrixSwitch, pkg-config can be used as helper tool for some of the
optional features, provided that it has been configured correctly. Otherwise,
it is necessary to determine explicitly where the files have been installed,
which often requires a precise knowledge about the machine and/or the operating
system.
Please note that, due to the high number of ways linear algebra can be
provided, the related information is very rarely accessible through
pkg-config.
Installation
There are three build systems provided for the library. The first is based on
CMake, the second on the Autotools, and the third is a manual build system
implemented through a set of Makefile.manual files.
In this section, we provide generic instructions from a practical perspective.
For details about the design of the build systems and their fine-grained
configuration, please consult the files located in the doc/ subdirectory.
With CMake
cmake -S . -B _build -DCMAKE_INSTALL_PREFIX=/path/to/install/directory
cmake --build _build
cmake --install _build
To include the MatrixSwitch library from MATRIXSWITCH_ROOT,
a custom ScaLAPACK library, and DBCSR from DBCSR_ROOT, use e.g.:
cmake \
-S . -B _build \
-DCMAKE_INSTALL_PREFIX=/path/to/install/directory \
-DCMAKE_PREFIX_PATH="${MATRIXSWITCH_ROOT}/lib/cmake" \
-DSCALAPACK_LIBRARY="-lscalapack-openmpi" \
-DDBCSR_ROOT="${DBCSR_ROOT}"
Further configuration examples can be found in the quickcheck-cmake.sh
maintainer script.
With the Autotools
Installing the library follows the classical "configure - make - make install"
trilogy. The build parameters are set when running configure. To know which
parameters can be adjusted, please run ./configure --help from the top
directory of the source tree.
When building the library from source, we highly recommend that you create a build directory and run the configure script from there, e.g.:
mkdir _build_SHORTNAME
cd _build_SHORTNAME
../configure \
--prefix=/my/install/path \
... possible other options ...
make
make install
where you replace SHORTNAME by a keyword that will help you remember the
configuration of the build. Please note that you can create as many build
directories as you wish.
Using build directories makes it possible to build the library for several combinations of parameters from the very same source tree. It is also safer because it leaves all source files untouched.
Helper scripts are available in the helpers/ subdirectory to make it easier
to configure the build for common situations without having to remember the
parameters each time. They also constitute useful examples and good starting
points for highly-tuned configurations. Please consult the README file in
helpers/ for more details.
Further examples can also be found in the quickcheck.sh maintainer script.
For generic and detailed information about how to build a package with the
Autotools, please consult the INSTALL file.
With Makefile.manual
To install the library manually:
- Enter the
srcdirectory. -
Copy
make.inc.exampletomake.incand modify it to suit your needs.MSWLIBPATHshould point to the MatrixSwitch directory (the default inmake.inc.exampleis for the version included in the distribution). MatrixSwitch should already have been compiled with the-DCONVflag. Other available options forFPPFLAGSare: -
-DHAVE_MPI: enable MPI parallel routines. -DHAVE_LAPACK: enable LAPACK routines (currently necessary for preconditioning/Cholesky factorization).-DHAVE_SCALAPACK: enable ScaLAPACK routines (requires MPI).-DHAVE_PSPBLAS: enable pspBLAS routines (requires MPI, LAPACK and ScaLAPACK).-DNORAND: fixed seed for the random number generator. Enable for testing purposes.-
-DCBIND: use ISO_C_BINDING for LOGICAL inputs in the wrapper interfaces. Enable for linking to C. -
Type
make -f Makefile.manual. - Type
make -f Makefile.manual install.
Testing
The examples/ subdirectory contains a number of small programs that make use
of libOMM with MatrixSwitch. These can be useful both for testing the installation
and for learning how to use the libraries.
With CMake
cd _build
ctest
With the Autotools
make check
With Makefile.manual
- Enter the
examples/directory. - Copy
make.inc.exampletomake.incand modify it to suit your needs. Be aware thatmake.incin thesrcdirectory will also be used. - Type
make -f Makefile.manual.
Each example contains a header explaining what the program does and providing sample output to compare against.
Running interactive tests
To run interactive tests on a HPC cluster, you may have to open a session with specific parameters, e.g.:
salloc -p general -n1 -q test
If in doubt, consult the cluster documentation or ask the system administrators for advice.
Publications
The algorithms provided by libOMM and their implementation are described in:
F. Corsetti, The orbital minimization method for electronic structure calculations with finite-range atomic basis sets, Comput. Phys. Commun. 185, 873 (2014). https://doi.org/10.1016/j.cpc.2013.12.008
Documentation
A complete documentation is maintained at:
https://esl.cecam.org/en/software/libomm/. See also the examples in the
examples/ subdirectory.