Skip to main content

Fast calculation of spherical harmonics

Project description

sphericart

Test

This is sphericart, a multi-language library for the efficient calculation of the spherical harmonics and their derivatives in Cartesian coordinates.

For instructions and examples on the usage of the library, please refer to our documentation.

A plot of the +-1 isosurfaces of the Y^0\_3 solid harmonic, including also gradients.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphericart-0.4.0b1.tar.gz (50.4 kB view details)

Uploaded Source

Built Distributions

sphericart-0.4.0b1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

sphericart-0.4.0b1-py3-none-macosx_11_0_x86_64.whl (346.6 kB view details)

Uploaded Python 3 macOS 11.0+ x86-64

sphericart-0.4.0b1-py3-none-macosx_11_0_arm64.whl (309.7 kB view details)

Uploaded Python 3 macOS 11.0+ ARM64

File details

Details for the file sphericart-0.4.0b1.tar.gz.

File metadata

  • Download URL: sphericart-0.4.0b1.tar.gz
  • Upload date:
  • Size: 50.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for sphericart-0.4.0b1.tar.gz
Algorithm Hash digest
SHA256 ae7e1ec08d1bd5f671ff584e007ed217a4cd49e5717a58f12f5c9afb2c583a3b
MD5 4d9548058c3197ed0d9a02826c865f8b
BLAKE2b-256 9db9af33b994e731b627d704c7fb6f1907cf17f5f26544aaf85c8b6f732c0f45

See more details on using hashes here.

Provenance

File details

Details for the file sphericart-0.4.0b1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sphericart-0.4.0b1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dfc379f754f8a89a79e0487c8916e85aa205490acac55cdfa694f73f599c8be8
MD5 5afefcbdb0e59dadb1a93f878cae915a
BLAKE2b-256 6b878a4156beec55e4f8703834beb2933e7c435e5f58767bf6ded7c7cbd93b9d

See more details on using hashes here.

Provenance

File details

Details for the file sphericart-0.4.0b1-py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for sphericart-0.4.0b1-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 220a261a28e4f4552d8b3b23e17eeb59bd1aa788196326b02d5866b60835c066
MD5 afaaec0efb46932adaf62178d8506478
BLAKE2b-256 b2ada06ddcd3b84c316fc7d7f5ed78872782b14911d2be28714d22f0b6e4afb9

See more details on using hashes here.

Provenance

File details

Details for the file sphericart-0.4.0b1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sphericart-0.4.0b1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 632e062ca36b6b3f12ac92fe05bdb2536db585f2d34390022393af7657311f94
MD5 d15093e5ec54411849e3bd315301b72a
BLAKE2b-256 e3a030c9a8a926406a9529458ddecc967ebed70e821b7f39b23012d08484d37e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page