Skip to content

Commit

Permalink
add logos, modify doc generation/aesthetics
Browse files Browse the repository at this point in the history
  • Loading branch information
peterspackman committed Feb 24, 2024
1 parent a128938 commit a336316
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ __pycache__/
.coverage
junk/
.*.swp
.DS_Store
13 changes: 13 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"title": "Chmpy: A python library for computational chemistry",
"authors": [
{
"name": "Spackman, Peter R.",
"affiliation": "Curtin University"
},
],
"description": "Molecules, crystals, promolecule and Hirshfeld surfaces using python.",
"license": "GPLv3",
"keywords": ["chemistry", "isosurface"]
}

41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
# chmpy

![CI](https://github.com/peterspackman/chmpy/workflows/CI/badge.svg)
[![DOI](https://zenodo.org/badge/211644812.svg)](https://zenodo.org/doi/10.5281/zenodo.10697512)


<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://github.com/peterspackman/chmpy">
<img src="docs/assets/chmpy_logo.png" alt="Logo" height="80" width="80">
</a>

<h3 align="center">chmpy</h3>

<p align="center">
A library for computational chemistry in python.
<br />
<a href="https://peterspackman.github.io/chmpy"><strong>Documentation»</strong></a>
<br />
<a href="https://github.com/peterspackman/chmpy/issues">Report a bug</a>
·
<a href="https://github.com/peterspackman/chmpy/issues">Request a new feature</a>
</p>
</div>

A library for computational chemistry in python. Featuring support for
molecules, crystals, Hirshfeld & promolecule density isosurfaces,
spherical harmonic shape descriptors and much more...
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
``` 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
``` bash
pip install -e .
```

Expand Down Expand Up @@ -49,7 +65,7 @@ python.
Loading a crystal structure from a CIF (`.cif`) or SHELX (`.res`)
file, or a molecule from an XMOL (`.xyz`) file is straightforward:

```python
``` python
from chmpy import Crystal, Molecule
c = Crystal.load("tests/acetic_acid.cif")
print(c)
Expand All @@ -70,7 +86,7 @@ Generation of surfaces with the default settings can be done with
minimal hassle, simply by using the corresponding members of the Crystal
class:

```python
``` 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
Expand All @@ -88,6 +104,11 @@ save_mesh(surfaces[0], "acetic_acid.ply")

The resulting surface should look something like this when visualized:

![acetic_acid.png](src/chmpy/tests/acetic_acid.png)
<br />
<div align="center">
<img src="src/chmpy/tests/acetic_acid.png" alt="Acetic acid" height=200>
</div>




Binary file added docs/assets/chmpy_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/chmpy_logo_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/chmpy_logo_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/chmpy_logo_small_no_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/chmpy_logo_small_no_text_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 22 additions & 24 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,49 @@ how to represent crystal structures, molecules etc. and evaluate
scientifically relevant information quickly and efficiently using
python.

## At a glance

### Crystal structures and molecules
## 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/test_files/acetic_acid.cif")
>>> c
<Crystal C2H4O2 Pna2_1>
``` py title="chmpy_basics.py"
from chmpy import Crystal, Molecule
c = Crystal.load("tests/test_files/acetic_acid.cif")
c
# <Crystal C2H4O2 Pna2_1>

# Calculate the unique molecules in this crystal
>>> c.symmetry_unique_molecules()
[<Molecule: C2H4O2(2.12,1.15,0.97)>]
c.symmetry_unique_molecules()
# [<Molecule: C2H4O2(2.12,1.15,0.97)>]

>>> m = Molecule.load("tests/test_files/water.xyz")
>>> m
<Molecule: H2O(-0.67,-0.00,0.01)>
m = Molecule.load("tests/test_files/water.xyz")
m
# <Molecule: H2O(-0.67,-0.00,0.01)>
```


### 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")
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()
>>> surfaces
[<trimesh.Trimesh(vertices.shape=(3598, 3), faces.shape=(7192, 3))>]
surfaces = c.hirshfeld_surfaces()
surfaces
# [<trimesh.Trimesh(vertices.shape=(3598, 3), faces.shape=(7192, 3))>]

# We can generate lower resolution surfaces with the separation parameter
>>> surfaces = c.hirshfeld_surfaces(separation=0.5)
>>> surfaces
[<trimesh.Trimesh(vertices.shape=(584, 3), faces.shape=(1164, 3))>]
surfaces = c.hirshfeld_surfaces(separation=0.5)
surfaces
# [<trimesh.Trimesh(vertices.shape=(584, 3), faces.shape=(1164, 3))>]

# Surfaces can be saved via trimesh
>>> surfaces[0].export("acetic_acid_trimesh.ply", "ply")
surfaces[0].export("acetic_acid_trimesh.ply", "ply")
# or a utility function provided in chmpy
>>> from chmpy.util.mesh import save_mesh
>>> save_mesh(surfaces[0], "acetic_acid.ply")
from chmpy.util.mesh import save_mesh
save_mesh(surfaces[0], "acetic_acid.ply")
```
17 changes: 15 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ repo_name: peterspackman/chmpy

theme:
name: material
logo: assets/chmpy_logo_small_no_text_dark.png
features:
- content.code.copy
palette:
primary: light blue
primary: blue grey
scheme: preference
font:
text: Helvetica
code: Noto Sans Mono

extra:
social:
- icon: fontawesome/brands/github
Expand All @@ -24,7 +31,13 @@ plugins:


markdown_extensions:
- codehilite
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences

nav:
- Home: index.md
Expand Down

0 comments on commit a336316

Please sign in to comment.