https://github.com/peterspackman/chmpy
Spherical harmonic shape descriptors, promolecule densities, isosurfaces and Hirshfeld surfaces in python
https://github.com/peterspackman/chmpy
crystallography descriptor descriptor-learning electron-density hirshfeld-surface isosurface machine-learning-library promolecule
Last synced: 9 months ago
JSON representation
Spherical harmonic shape descriptors, promolecule densities, isosurfaces and Hirshfeld surfaces in python
- Host: GitHub
- URL: https://github.com/peterspackman/chmpy
- Owner: peterspackman
- License: other
- Created: 2019-09-29T10:20:06.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-11-22T03:28:39.000Z (over 1 year ago)
- Last Synced: 2024-12-11T07:18:21.727Z (over 1 year ago)
- Topics: crystallography, descriptor, descriptor-learning, electron-density, hirshfeld-surface, isosurface, machine-learning-library, promolecule
- Language: Python
- Homepage:
- Size: 26.1 MB
- Stars: 19
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- License: LICENSE.txt
- Citation: CITATION.cff
Awesome Lists containing this project
README

[](https://zenodo.org/doi/10.5281/zenodo.10697512)
chmpy
A library for computational chemistry in python.
Documentation»
Report a bug
·
Request a new feature
chmpy supports handling molecules, crystals, Hirshfeld & promolecule
density isosurfaces, spherical harmonic shape descriptors and much more...
# Installation
Basic installation can be done through the python package manager `pip`:
``` bash
pip install chmpy
# or to install directly from GitHub:
pip install git+https://github.com/peterspackman/chmpy.git
```
For development or modifications, install locally using pip:
``` bash
pip install -e .
```
# Features
While the library is intended to be flexible and make it easy to build
complex pipelines or properties, the following is a brief summary of
intended features:
- Load crystal structures from `.cif`, `.res`, `POSCAR` files.
- Evaluate promolecule and procrystal electron densities.
- Easily generate Hirshfeld or promolecule isosurfaces and associated properties.
- Easily generate spherical harmonic shape descriptors for atoms, molecules, or molecular fragments.
- Efficiently calculate crystal slabs, periodic connectivity and more...
- Automatic parallelization of some calculations using OpenMP (set the `OMP_NUM_THREADS` environment variable)
It should also serve as a simple, easy to read library for learning
how to represent crystal structures, molecules etc. and evaluate
scientifically relevant information quickly and efficiently using
python.
# Examples
## Crystal structures and molecules
Loading a crystal structure from a CIF (`.cif`) or SHELX (`.res`)
file, or a molecule from an XMOL (`.xyz`) file is straightforward:
``` python
from chmpy import Crystal, Molecule
c = Crystal.load("tests/acetic_acid.cif")
print(c)
#
# Calculate the unique molecules in this crystal
c.symmetry_unique_molecules()
# []
m = Molecule.load("tests/water.xyz")
print(m)
#
```
## Hirshfeld and promolecule density isosurfaces
Hirshfeld and promolecule density isosurfaces
Generation of surfaces with the default settings can be done with
minimal hassle, simply by using the corresponding members of the Crystal
class:
``` python
c = Crystal.load("tests/test_files/acetic_acid.cif")
# This will generate a high resolution surface
# for each symmetry unique molecule in the crystal
surfaces = c.hirshfeld_surfaces()
print(surfaces)
# []
# We can generate lower resolution surfaces with the separation parameter
surfaces = c.hirshfeld_surfaces(separation=0.5)
print(surfaces)
# []
# Surfaces can be saved via trimesh, or a utility function provided in chmpy
from chmpy.util.mesh import save_mesh
save_mesh(surfaces[0], "acetic_acid.ply")
```
The resulting surface should look something like this when visualized: