QSym² is a program for Quantum Symbolic Symmetry analysis of quantum-chemical calculations written in Rust with the following capabilities:
- on-the-fly generation of symbolic character tables,
- analysis of degeneracy and symmetry breaking effects in Abelian and non-Abelian groups,
- analysis of symmetry in external magnetic and electric fields,
- inclusion of antiunitary symmetry based on corepresentation theory, and
- inclusion of double-valued representations and corepresentations via explicit spin rotations
for the following targets:
- Slater determinants,
- molecular orbitals,
- multi-determinantal wavefunctions obtained via non-orthogonal configuration interaction,
- real-space functions defined on a grid,
- electron densities, and
- vibrational coordinates.
QSym² has been integrated with QUEST and its complementary GUI, QuestView. QSym² can also work with Q-Chem HDF5 archive files and Orca output files.
The main website for QSym² can be found here.
The public API documentation for QSym² can be found here.
[[TOC]]
Developmental and programming issues with the crate qsym2
can be reported on GitLab. For scientific enquiries such as how to run the program QSym² for a particular quantum-chemical calculation or how to interpret the results of QSym², please join the dedicated Slack workspace using this invite link.
The following instructions for installing QSym² from source are specific to Debian/Ubuntu operating systems. On Microsoft Windows platforms, Windows Subsystem for Linux is recommended.
There are two main ways of installing QSym²:
- as a binary named
qsym2
providing the command-line interface, or - as a Python library named
qsym2
providing the exposed Python bindings.
Both methods can be configured via Rust features.
The QSym² crate defines the following features that can be specified at compilation via cargo
. Some of these features are mutually exclusive.
There are six features defining six different ways a linear algebra backend can be configured for QSym². These are inherited from the ndarray-linalg crate. One (and only one) of these must be specified:
openblas-static
: Downloads, builds OpenBLAS, and links staticallyopenblas-system
: Finds and links existing OpenBLAS in the systemnetlib-static
: Downloads, builds LAPACK, and links staticallynetlib-system
: Finds and links existing LAPACK in the systemintel-mkl-static
: Finds and links existing static Intel MKL in the system, or downloads and links statically if not foundintel-mkl-system
: Finds and links existing shared Intel MKL in the system
If the *-static
backends give rise to numerical problems, please try installing the linear algebra backends directly (either via your system's package manager or by compiling from source) and then using the corresponding *-system
backends.
qchem
: Enables Q-Chem's HDF5 archive files to be read in and analysedpython
: Enables the Python bindings for several core functionalities
-
integrals
: Enables the computation of$n$ -centre overlap integrals and$n$ -centre overlap integral derivatives within QSym²
standard
: Enables theopenblas-static
andqchem
featuresfull
: Enables thestandard
andintegrals
features
sandbox
: Enables experimental features that are still being actively developed
The installation of QSym² requires the following:
-
Common:
curl
for installing the Rust compiler- the Rust compiler and the
cargo
package manager git
for obtaining the source code of QSym²libssl-dev
(Debian/Ubuntu) oropenssl-devel
(Rocky/Fedora/RHEL)pkg-config
(Debian/Ubuntu) orpkgconfig
(Rocky/Fedora/RHEL)
-
Feature-specific:
Feature | Dependencies | Notes |
---|---|---|
openblas-static |
make , gcc , gfortran |
Builds OpenBLAS and links statically (see ndarray-linalg documentation) |
openblas-system |
|
Finds and links existing OpenBLAS in the system (see ndarray-linalg documentation) |
netlib-static |
make , gfortran |
Builds LAPACK and links statically (see ndarray-linalg documentation) |
netlib-system |
|
Finds and links existing LAPACK in the system (see ndarray-linalg documentation) |
intel-mkl-static |
|
Finds and links existing static Intel MKL in the system, or downloads and links statically if not found (see ndarray-linalg documentation) |
intel-mkl-system |
|
Finds and links existing shared Intel MKL in the system (see ndarray-linalg documentation) |
qchem |
cmake , gcc |
Builds the HDF5 C library and links statically |
integrals |
|
Installs the TLS framework required for reqwest |
python |
Python, which is best managed via Anaconda | Installs the Python bindings for core functionalities of QSym² |
The following instructions assume that the full
feature is to be installed on a Debian/Ubuntu distro to make available the qsym2
binary.
-
Install the basic dependencies by running the following commands (sudo privileges required):
sudo apt-get update sudo apt-get install curl git libssl-dev pkg-config
-
Install the Rust compiler by running the command below and following the on-screen instructions:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
The default configurations should suffice in most cases. Ensure that the current shell is restarted or the command
source "$HOME/.cargo/env"
is run upon installation completion so that the Rust compiler and thecargo
package manager can be found. -
Install the feature-specific dependencies by running the following command (sudo privileges required):
sudo apt-get install build-essential gfortran cmake
-
Obtain the source code of QSym² either via
git
:git clone https://gitlab.com/bangconghuynh/qsym2.git
or by downloading a compressed tarball release and extracting it.
-
Inside the source code directory, install QSym² by running the following command:
cargo install --features full --path .
which will compile and install the
qsym2
binary into$HOME/.cargo/bin
to allow for system-wide availability.Note that the
--features
option in the command above specifies that thefull
feature is to be installed. This option accepts a comma-separated list of features listed in the Rust features section and can be modified to select other features to be installed as appropriate.It is possible to install the
qsym2
binary into a different path by runningcargo install --features full --path . --root custom/install/path/for/qsym2
instead. The custom path
/custom/install/path/for/qsym2
must then be added to the$PATH
environment variable to makeqsym2
discoverable by the operating system.
The following instructions assume that the openblas-static
, integrals
, and python
features are to be compiled on a Debian/Ubuntu distro and then installed as a Python library inside a conda environment. These features are specified in the pyproject.toml
file.
-
Follow steps 1 to 4 under the Binary compilation section above to install the required prerequisites.
-
Make sure that the Anaconda package manager is available on your system. Instructions for installing Anaconda on a Linux system can be found here.
-
Create a new conda environment named
qsym2-python
(or a different name of your choice) running Python 3.11 (or a different version of your choice):conda create -n qsym2-python python=3.11
and then activate this environment:
conda activate qsym2-python
-
From inside the source code directory, execute
pip install .
This command calls
pip
which automatically acquires the build toolmaturin
to compile and install QSym² as a Python library into theqsym2-python
conda environment. This library has theopenblas-static
,integrals
, andpython
features enabled due to the specification in thepyproject.toml
file.The Python library
qsym2
can now be imported by any Python scripts running inside theqsym2-python
conda environment.
There are two main ways of running QSym²:
- via the command-line interface provided by the binary
qsym2
, or - via the exposed Python bindings provided by the Python library
qsym2
.
This method is currently able to perform symmetry analysis of:
- Slater determinants,
- Hartree–Fock or Kohn–Sham molecular orbitals, and
- vibrational coordinates
that have been exported by Q-Chem 6 to a HDF5 file named qarchive.h5
saved in the job's scratch directory,
or
- Slater determinants, and
- Hartree–Fock or Kohn–Sham molecular orbitals
that have been stored in binary files, together with other basis-set-related data.
The command-line interface supports several subcommands and options:
qsym2 -h
A program for Quantum Symbolic Symmetry
Usage: qsym2 <COMMAND>
Commands:
template
Generates a template YAML configuration file and exits
run
Runs an analysis calculation and exits
help
Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help
-V, --version
Print version
The subcommand template
, runnable as
qsym2 template
generates a template configuration YAML file populated with some default control parameters. This file can be modified to adjust the parameters to suit the calculation at hand.
The subcommand run
, runnable as
qsym2 run -c path/to/config -o output_name
takes a configuration YAML file as a parameter, performs the specified symmetry analysis, and displays the results in the specified output file.
Examples of symmetry analysis performed by QSym² for several Q-Chem calculations can be found on QSym²'s website.
This method is currently able to perform symmetry analysis of:
- Slater determinants,
- Hartree–Fock or Kohn–Sham molecular orbitals,
- multi-determinantal wavefunctions obtained via non-orthogonal configuration interaction,
- real-space functions defined on a grid,
- vibrational coordinates, and
- one-electron densities
that can be computed directly in Python or read into Python from calculation files of quantum-chemistry packages, such as by the use of cclib. The main driver functions of QSym² are all exposed to Python, which means that they can be used and integrated into existing workflows flexibly.
To view the documentation for the Python API, execute the following Python commands inside the qsym2-python
conda environment (see above), either interactively or in a Python script:
import qsym2
help(qsym2)
An example Python script that performs symmetry analysis for self-consistent-field calculations from Orca output files (parsed by cclib) can be found at utils/qsym2-orca.py
. This script requires the Python packages mendeleev
, cclib
, and numpy
to run.
Another example where the Python bindings of QSym² are used extensively for the analysis of unitary and magnetic symmetry in the presence of external fields can be found in QUEST and its complementary GUI, QuestView.
QSym² has been developed and maintained by Dr Bang C. Huynh at the University of Nottingham, UK since July 2022 with scientific support from Prof. Andrew M. Wibowo-Teale and Dr Meilani Wibowo-Teale and financial support from the ERC grant under the topDFT project.
The logo for QSym², which is a stylised stellated octahedron, was designed with artistic support from Mr Thinh Nguyen.