PyXtal is an open-source Python library designed for the ab-initio generation of crystal structures based on symmetry constraints. It supports the generation of atomic and molecular systems across 0D to 3D dimensions, facilitates symmetry analysis, and offers structural manipulation capabilities. The library is currently at version 1.1.3 and is actively maintained with regular updates and contributions from the materials science community.
pip install pyxtalVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to generate a 3D atomic crystal, specifically a diamond-like carbon structure, using the `pyxtal` class's `from_random` method. It initializes a crystal instance, attempts to generate a structure based on dimension, space group, element, and stoichiometry, and then prints the structure details or saves it to a CIF file if successful.
Carefully review the chosen `dim`, `group`, `species`/`molecules`, `numIons`/`numMols`, and `factor` parameters. Increase the `factor` (volume expansion) or `max_attempts` for more challenging structures. Consider using pre-defined `sites` for more control over Wyckoff positions.
First, install the C++ OpenBabel library and SWIG (version >= 2.0) via your system's package manager (e.g., `sudo apt-get install openbabel swig` on Debian/Ubuntu). Then, install the Python bindings: `pip install openbabel`.
If you require crystals containing mirror images of chiral molecules, you will need to explicitly configure PyXtal to allow inversion. Consult the molecular crystal generation documentation for specific parameters.
Revise your input parameters: try a different space group, adjust the `numIons` or `numMols` list, or increase the `factor` parameter to provide more volume for atom placement. If generating molecular crystals, ensure molecular symmetry is compatible with Wyckoff site symmetry.
Ensure the C++ `openbabel` library and `swig` (a tool for generating Python bindings) are installed on your system. For example, on Debian/Ubuntu, run `sudo apt-get install openbabel swig`. After these are installed, reinstall the Python `openbabel` package: `pip install openbabel`.