Fast calculation of spherical harmonics
Project description
sphericart
This is sphericart, a multi-language library for the efficient calculation of real spherical harmonics and their derivatives in Cartesian coordinates.
For instructions and examples on the usage of the library, please refer to our documentation.
If you are using sphericart for your academic work, you can cite it as
@article{sphericart,
title={Fast evaluation of spherical harmonics with sphericart},
author={Bigi, Filippo and Fraux, Guillaume and Browning, Nicholas J. and Ceriotti, Michele},
journal={J. Chem. Phys.},
year={2023},
number={159},
pages={064802},
}
This library is dual-licensed under the Apache License 2.0 and the MIT license. You can use to use it under either of the two licenses.
Installation
Python
Pre-built (https://pypi-hypernode.com/project/sphericart/).
pip install sphericart # numpy version
pip install sphericart[torch] # including also the torch bindings
pip install sphericart[jax] # JAX bindings (CPU-only)
Note that the pre-built packages are compiled for a generic CPU, and might be less performant than they could be on a specific processor. To generate libraries that are optimized for the target system, you can build from source:
git clone https://github.com/lab-cosmo/sphericart
pip install .
# if you also want the torch bindings (CPU and GPU)
pip install .[torch]
# torch bindings, CPU-only version
pip install --extra-index-url https://download.pytorch.org/whl/cpu .[torch]
Building from source is also necessary to use sphericart's PyTorch GPU functionalities, and it requires a CUDA compiler.
Julia
A native Julia implementation of sphericart
is provided, called SpheriCart
.
Install the package by opening a REPL, switch to the package manager by
typing ]
and then add SpheriCart
.
See julia/README.md for usage.
C and C++
From source
git clone https://github.com/lab-cosmo/sphericart
cd sphericart
mkdir build && cd build
cmake .. <cmake configuration options>
cmake --build . --target install
The following cmake configuration options are available:
-DSPHERICART_BUILD_TORCH=ON/OFF
: build the torch bindings in addition to the main library-DSPHERICART_BUILD_TESTS=ON/OFF
: build C++ unit tests-DSPHERICART_BUILD_EXAMPLES=ON/OFF
: build C++ examples and benchmarks-DSPHERICART_OPENMP=ON/OFF
: enable OpenMP parallelism-DCMAKE_INSTALL_PREFIX=<where/you/want/to/install>
set the root path for installation
Running tests and documentation
Tests and the local build of the documentation can be run with tox
.
The default tests, which are also run on the CI, can be executed by simply running
tox
in the main folder of the repository.
To run tests in a CPU-only environment you can set the environment variable
PIP_EXTRA_INDEX_URL
before calling tox, e.g.
PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu tox -e docs
will build the documentation in a CPU-only environment.
Other flavors of spherical harmonics
Although sphericart natively calculates real solid and spherical harmonics from Cartesian positions, it is easy to manipulate its output it to calculate complex spherical harmonics and/or to accept spherical coordinates as inputs. You can see examples here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file sphericart-0.5.0.tar.gz
.
File metadata
- Download URL: sphericart-0.5.0.tar.gz
- Upload date:
- Size: 53.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f3d2672a20efd7cf400cce42d0648f04d16fe8abaf834d167a1b45ef2f87e46 |
|
MD5 | b6524985aa71f6ca97c01466aa28f6fc |
|
BLAKE2b-256 | f12de57af54de6409b6140ebd42f9be1614fc1c7880ca2a090b10f330be6cdf1 |
Provenance
File details
Details for the file sphericart-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: sphericart-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 817248768a5358936f9404cf08625cac46bd419be20d5a39e44dd1c7c29dfbbe |
|
MD5 | cf48c662bb14e17158fc69e4a11c157d |
|
BLAKE2b-256 | 259625521d53ea67d2bd1d554b2b0a306fc96a1087c742f7f8d7f0bbbd224cb9 |
Provenance
File details
Details for the file sphericart-0.5.0-py3-none-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: sphericart-0.5.0-py3-none-macosx_11_0_x86_64.whl
- Upload date:
- Size: 423.8 kB
- Tags: Python 3, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b6bf3392708830cbb91513aef06786b65c927c12aade4835f3218c46df2765f |
|
MD5 | 71ce2abc1414d98e8323a6c4d723271f |
|
BLAKE2b-256 | f6e4e2770cf93892acdfb4a7fffd67825d389a55e83aa444b9d8dda5d2400994 |
Provenance
File details
Details for the file sphericart-0.5.0-py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: sphericart-0.5.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 361.2 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8637a9b00668b2b1bbe8771597e10e8e85b0dd868ba73bd31ecda04ba950fffd |
|
MD5 | 5608ad3560ef8935dd15dd425cc123d2 |
|
BLAKE2b-256 | acdf360fdd312a480b0ed07465e5d484641cb4d5784cdc2bc2cc57db1b4a9898 |