peterspackman / chmpy Goto Github PK
View Code? Open in Web Editor NEWSpherical harmonic shape descriptors, promolecule densities, isosurfaces and Hirshfeld surfaces in python
License: Other
Spherical harmonic shape descriptors, promolecule densities, isosurfaces and Hirshfeld surfaces in python
License: Other
@peterspackman
I asked my student @weiluntang89 to extract the spherical harmonics coefficients from chmpy so that we can reconstruct the surface shape. We did the following,
But the output does not make sense to us.
For a given l_max, the number of coefficients should be (l_max + 1)^2. Can you help?
Hi Peter,
I was unsure why there's an import error for setuptools, even though separately (see end of the snippet code), import work just fine in this conda environment.
$ conda activate chmpypackage
$ pip install chmpy
Collecting chmpy
Using cached chmpy-1.0b4.tar.gz (7.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting Jinja2<4.0.0,>=3.1.2 (from chmpy)
Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting matplotlib<4.0.0,>=3.5.2 (from chmpy)
Downloading matplotlib-3.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.8 kB)
Collecting numpy<2.0,>=1.12 (from chmpy)
Downloading numpy-1.26.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 kB 2.2 MB/s eta 0:00:00
Collecting scipy<2.0.0,>=1.8.1 (from chmpy)
Downloading scipy-1.11.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.4/60.4 kB 6.3 MB/s eta 0:00:00
Collecting seaborn<0.12.0,>=0.11.2 (from chmpy)
Using cached seaborn-0.11.2-py3-none-any.whl (292 kB)
Collecting trimesh<4.0.0,>=3.12.9 (from chmpy)
Using cached trimesh-3.23.5-py3-none-any.whl.metadata (17 kB)
Collecting MarkupSafe>=2.0 (from Jinja2<4.0.0,>=3.1.2->chmpy)
Downloading MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.0 kB)
Collecting contourpy>=1.0.1 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Downloading contourpy-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.8 kB)
Collecting cycler>=0.10 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Using cached cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)
Collecting fonttools>=4.22.0 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Downloading fonttools-4.44.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (153 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 153.6/153.6 kB 15.2 MB/s eta 0:00:00
Collecting kiwisolver>=1.3.1 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Downloading kiwisolver-1.4.5-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.metadata (6.4 kB)
Collecting packaging>=20.0 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Collecting pillow>=8 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Downloading Pillow-10.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (9.5 kB)
Collecting pyparsing>=2.3.1 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Using cached pyparsing-3.1.1-py3-none-any.whl.metadata (5.1 kB)
Collecting python-dateutil>=2.7 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting importlib-resources>=3.2.0 (from matplotlib<4.0.0,>=3.5.2->chmpy)
Using cached importlib_resources-6.1.1-py3-none-any.whl.metadata (4.1 kB)
Collecting pandas>=0.23 (from seaborn<0.12.0,>=0.11.2->chmpy)
Downloading pandas-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (18 kB)
Collecting zipp>=3.1.0 (from importlib-resources>=3.2.0->matplotlib<4.0.0,>=3.5.2->chmpy)
Using cached zipp-3.17.0-py3-none-any.whl.metadata (3.7 kB)
Collecting pytz>=2020.1 (from pandas>=0.23->seaborn<0.12.0,>=0.11.2->chmpy)
Using cached pytz-2023.3.post1-py2.py3-none-any.whl.metadata (22 kB)
Collecting tzdata>=2022.1 (from pandas>=0.23->seaborn<0.12.0,>=0.11.2->chmpy)
Using cached tzdata-2023.3-py2.py3-none-any.whl (341 kB)
Collecting six>=1.5 (from python-dateutil>=2.7->matplotlib<4.0.0,>=3.5.2->chmpy)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Downloading matplotlib-3.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.6/11.6 MB 95.6 MB/s eta 0:00:00
Downloading numpy-1.26.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.2/18.2 MB 97.2 MB/s eta 0:00:00
Downloading scipy-1.11.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (36.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 36.6/36.6 MB 68.5 MB/s eta 0:00:00
Using cached trimesh-3.23.5-py3-none-any.whl (685 kB)
Downloading contourpy-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (310 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 311.0/311.0 kB 28.6 MB/s eta 0:00:00
Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)
Downloading fonttools-4.44.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 93.0 MB/s eta 0:00:00
Using cached importlib_resources-6.1.1-py3-none-any.whl (33 kB)
Downloading kiwisolver-1.4.5-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 77.2 MB/s eta 0:00:00
Downloading MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Using cached packaging-23.2-py3-none-any.whl (53 kB)
Downloading pandas-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.3/12.3 MB 103.6 MB/s eta 0:00:00
Downloading Pillow-10.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.5/3.5 MB 92.9 MB/s eta 0:00:00
Using cached pyparsing-3.1.1-py3-none-any.whl (103 kB)
Using cached pytz-2023.3.post1-py2.py3-none-any.whl (502 kB)
Using cached zipp-3.17.0-py3-none-any.whl (7.4 kB)
Building wheels for collected packages: chmpy
Building wheel for chmpy (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for chmpy (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
Traceback (most recent call last):
File "/tmp/pip-install-nyucsble/chmpy_ac4e494d0b88479c80794999f2c19fcb/build.py", line 1, in
import setuptools
ModuleNotFoundError: No module named 'setuptools'
Traceback (most recent call last):
File "/cluster/home/iyemperu/miniconda3/envs/chmpypackage/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
main()
File "/cluster/home/iyemperu/miniconda3/envs/chmpypackage/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/cluster/home/iyemperu/miniconda3/envs/chmpypackage/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-au4ygtoi/overlay/lib/python3.9/site-packages/poetry/core/masonry/api.py", line 58, in build_wheel
return WheelBuilder.make_in(
File "/tmp/pip-build-env-au4ygtoi/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 88, in make_in
wb.build(target_dir=directory)
File "/tmp/pip-build-env-au4ygtoi/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 123, in build
self._build(zip_file)
File "/tmp/pip-build-env-au4ygtoi/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 172, in _build
self._run_build_script(self._package.build_script)
File "/tmp/pip-build-env-au4ygtoi/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 266, in _run_build_script
subprocess.check_call([self.executable.as_posix(), build_script])
File "/cluster/home/iyemperu/miniconda3/envs/chmpypackage/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/cluster/home/iyemperu/miniconda3/envs/chmpypackage/bin/python', 'build.py']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for chmpy
Failed to build chmpy
ERROR: Could not build wheels for chmpy, which is required to install pyproject.toml-based projects
WARNING: There was an error checking the latest version of pip.
$ python -c "import setuptools"
$
Following from #4 Just need to add some convenience methods to filter
Should be straightforward.
@peterspackman It is a nice tool. I am in the middle of learning how to use it. However, I came into several issues as follows,
1, I firstly met the following complaints,
>>> from chmpy import Crystal, Molecule
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/qiangzhu/Desktop/github/chmpy/chmpy/__init__.py", line 1, in <module>
from .crystal import Crystal, SpaceGroup, UnitCell
File "/Users/qiangzhu/Desktop/github/chmpy/chmpy/crystal/__init__.py", line 9, in <module>
from .crystal import Crystal
File "/Users/qiangzhu/Desktop/github/chmpy/chmpy/crystal/crystal.py", line 15, in <module>
from trimesh import Trimesh
ModuleNotFoundError: No module named 'trimesh'
This can be trivially solved by pip install trimesh
. However, I am curious if you have a mechanism to list all required package during the installation. This will make life easier.
2, I tried to get the Hirschfield surface.
>>> from chmpy import Crystal, Molecule
>>> c = Crystal.load("tests/test_files/acetic_acid.cif")
>>> surfaces = c.hirshfeld_surfaces()
>>> from chmpy.util.mesh import save_mesh
>>> save_mesh(surfaces[0], "acetic_acid.ply")
How can I visualize it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.