跳转到主要内容

球谐函数快速计算

项目描述

球形艺术

Test

这是一个球形艺术,一个用于在笛卡尔坐标系中高效计算实球谐函数及其导数的多语言库。

有关库的使用说明和示例,请参阅我们的文档

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

如果您在学术工作中使用球形艺术,您可以引用它如下

@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},
}

本库采用Apache License 2.0和MIT许可的双重授权。您可以根据任意一种许可协议使用它。

安装

Python

预构建版本(https://pypi.ac.cn/project/sphericart/)。

pip install sphericart             # numpy version
pip install sphericart[torch]      # including also the torch bindings
pip install sphericart[jax]        # JAX bindings (CPU-only)

请注意,预构建包是为通用CPU编译的,可能在特定处理器上性能不如预期。为了生成针对目标系统优化的库,您可以从源代码构建。

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]

从源代码构建也是使用sphericart的PyTorch GPU功能所必需的,并且需要CUDA编译器。

Julia

提供了sphericart的本地Julia实现,称为SpheriCart。通过打开REPL,切换到包管理器,输入]然后输入add SpheriCart来安装包。有关使用说明,请参阅julia/README.md

C和C++

从源代码

git clone https://github.com/lab-cosmo/sphericart
cd sphericart

mkdir build && cd build

cmake .. <cmake configuration options>
cmake --build . --target install

以下cmake配置选项可用

  • -DSPHERICART_BUILD_TORCH=ON/OFF:除了主库外,还构建torch绑定
  • -DSPHERICART_BUILD_TESTS=ON/OFF:构建C++单元测试
  • -DSPHERICART_BUILD_EXAMPLES=ON/OFF:构建C++示例和基准测试
  • -DSPHERICART_OPENMP=ON/OFF:启用OpenMP并行性
  • -DCMAKE_INSTALL_PREFIX=<where/you/want/to/install>设置安装根路径

运行测试和文档

可以使用tox运行测试和本地构建的文档。默认测试,也在CI上运行,可以简单地通过在仓库的主要文件夹中运行来执行:

tox

要在一个仅CPU的环境中运行测试,您可以在调用tox之前设置环境变量PIP_EXTRA_INDEX_URL,例如:

PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu tox -e docs

将在一个仅CPU的环境中构建文档。

其他球谐函数版本

虽然sphericart原生地根据笛卡尔位置计算实球谐函数,但很容易操纵其输出以计算复球谐函数和/或接受球坐标作为输入。您可以在此处查看示例这里

项目详情


下载文件

下载您平台上的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

sphericart-0.5.0.tar.gz (53.6 kB 查看哈希值

上传时间 源代码

构建分发

sphericart-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB 查看哈希值

上传时间 Python 3 manylinux: glibc 2.17+ x86-64

sphericart-0.5.0-py3-none-macosx_11_0_x86_64.whl (423.8 kB 查看哈希值

上传时间 Python 3 macOS 11.0+ x86-64

sphericart-0.5.0-py3-none-macosx_11_0_arm64.whl (361.2 kB 查看哈希值)

上传时间 Python 3 macOS 11.0+ ARM64

支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面