Metadata-Version: 2.4
Name: cg-pytools
Version: 0.1.0
Summary: Crystal-shape / coarse-grained morphology analysis library
Author: Alvin Jenner W, Adam R. Hill
License: MIT License
        
        Copyright (c) 2026 Alvin Jenner W
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/CrystoGenLtd/cg-pytools
Keywords: crystallography,morphology,wulff,crystal-shape
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Chemistry
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.3.4
Requires-Dist: scipy>=1.16.2
Requires-Dist: pandas>=2.3.3
Requires-Dist: matplotlib>=3.10.7
Requires-Dist: seaborn>=0.13.2
Requires-Dist: trimesh>=4.6.6
Requires-Dist: chmpy>=1.1.6
Dynamic: license-file

# cg-pytools

A small library for analysing crystal morphology from CrystoGen (formerly CrystalGrower) - crystal growth
simulations: shape characterisation (Zingg ratios, aspect ratios, surface
area / volume), Wulff and surface processing, energy-network parsing, and
plotting utilities. It also ships example SGE / SLURM job scripts for running
CrystoGen + OCC workflows (solvent screens, growth rates, growth modifiers, …)
on HPC clusters.

For a full, GUI-driven workflow, see
[CGAspects](https://github.com/CrystoGenLtd/cgaspects) — CrystoGen's official
(PySide6) data-analysis tool for CrystoGen output. `cg-pytools` is
a stripped-down, lightweight alternative: a scriptable library and command-line
utilities for the same kind of analysis, without the GUI. It is currently
limited in scope, and may in future grow to contain the core of CGAspects.

## Installation

```bash
pip install cg-pytools
```

Or, for local development:

```bash
git clone https://github.com/CrystoGenLtd/cg-pytools.git
cd cg-pytools
pip install -e .
```

## Usage

```python
from cgpytools import CrystalShape, ShapeAnalyser

crystal = CrystalShape.from_file("crystal.xyz")

analyser = ShapeAnalyser(zingg_method="svd")
analyser.analyse_crystal(crystal)
metrics = analyser.get_all_frame_metrics()
```

## Modules

| Module | Purpose |
|--------|---------|
| `crystal_io` | Read crystal shapes / frames (`CrystalShape`) |
| `shape_analysis` | Morphology metrics, Zingg classification (`ShapeAnalyser`) |
| `surfaces` | Wulff construction and surface/size-file processing |
| `cg_net` | Interaction-energy network parsing (`CGNet`) |
| `plot` | Shared plotting theme and styling helpers |
| `log` | Logging configuration |

## Scripts

Command-line tools live in [`scripts/python/`](scripts/python):

| Script | Depends on | Description |
|--------|------------|-------------|
| `screen.py` | `cgpytools` | Main crystal-shape analysis tool (general / solvent / size / movie / CDA modes). See [`scripts/python/README.md`](scripts/python/README.md). |
| `growth_kinetics.py` | numpy, pandas, matplotlib, scipy | Standalone: time-evolution plots of size data from simulation subfolders. |
| `growth_rates.py` | numpy, pandas, matplotlib | Standalone: growth-rate-vs-supersaturation summaries from `size.csv` files. |

`screen.py` imports `cgpytools`, so install the package first. The two `growth_*`
scripts are single-file and have no dependency on `cgpytools` — they can be copied
and run on their own.

### HPC job scripts

Example SGE and SLURM job scripts for the CrystoGen + OCC workflows live
under [`scripts/HPC/`](scripts/HPC) organised by use case (solvent screens,
growth rates, etc.). Each folder has a `README.txt` describing the inputs
it needs.

Copy the scripts to a folder containing a CIF or other inputs, depending on
which job type is to be submitted.

## License

MIT — see [LICENSE](LICENSE).
