Python utilities interfaced with ASE for atomic crystal analysis
Project description
CellConstructor
Welcome to the CellConstructor python package!
What is CellConstructor?
CellConstructor is a Python library that allows for easy manipulation of crystal structures and phonon dynamical matrices. It is based on Quantum Espresso and wraps many of the utilities available in the Phonon package in Python for post-processing tools. It is also interfaced with ASE for I/O of standard file formats (.cif, input for common calculators, etc.) and with SPGLIB for a more stable tool for symmetry identification (the Quantum Espresso symmetry library is also available).
What can I do with CellConstructor?
CellConstructor is a general-purpose library. Some of the things you can do with one single command:
- Compute Quasi-Harmonic free energies from a dynamical matrix at any temperature.
- Impose symmetries on a structure, or on a dynamical matrix.
- Impose the acoustic sum rule on a dynamical matrix
- Compute the phonon dispersion along high-symmetry paths
- Extract harmonic, randomly displaced configurations according to the dynamical matrix.
And also many other cool features!
Requirements
To correctly install and use the package, you need to have
- python >= 3.8
- ASE: Atomic Simulation Environment (suggested but not mandatory)
- numpy
- scipy
- A FORTRAN compiler
- Lapack and BLAS
Suggested, but not required, is the installation of ASE and spglib. The presence of a valid ASE installation will enable some more features, like the possibility to load structures by any ASE-supported file format, or the possibility to export the structures into a valid ASE Atoms class.
Please note that some Fortran libraries require compilation; therefore, the Python header files should be localized during the compilation process. Starting from version 1.5, the compilation is handled by meson and can be performed automatically using pip.
For example, using mamba (or conda), you can install all the binary dependencies with:
mamba install -c conda-forge python=3.12 ase spglib=2.2 gfortran libblas lapack openmpi openmpi-mpicc pip numpy scipy
To use conda, just replace mamba with conda. Note that conda may take a long time to resolve the environment; therefore, mamba or micromamba are recommended.
Installation
The code can be compiled and installed from the PyPi repository with
pip install CellConstructor
Or, alternatively, directly by downloading the GitHub repository and running the following command in the directory containing the code
pip install .
This will start the automatic compilation. If some libraries or compilers aren't found, please take a look at the next section.
To test if the installation runs properly, you can just run the examples reported in the test directory. The Python code in these tests should be almost self-explanatory and introduce you to the potential of this library.
Please note that all the functions of the library have a proper numpy style docstring.
You can test the installation using the script:
cellconstructor_test.py
To run the complete testsuite, you can use pytest, running the following command:
pytest
For a complete API documentation, you can compile the documentation inside the UserGuide directory.
To compile it, use the make utility followed by the frontend.
For example, if you want the HTML version, run:
make html
Inside the UserGuide directory. It will generate a build directory that contains the HTML version of the complete documentation.
Installation using 'Meson'
Here, we follow the manual step to compile the code using meson. These steps are required if you
want to compute the code on an HPC by exploiting the fast optimized libraries of the HPC nodes.
Compiling with Meson
To compile and install CellConstructor with Meson, follow these typical steps:
1. Change to the Source Directory
First, open a terminal and navigate to the root directory of the project source code. This is where the meson.build file is located.
cd /path/to/source/root/cellconstructor
2. Configure the Build Directory
Create and configure a build directory by running:
meson setup builddir
or if you are in a conda env (the best option for a local installation):
meson setup builddir --prefix=$CONDA_PREFIX
if you want to use Intel MKL:
setup builddir -Duse_mkl=true
This command sets up a separate build directory (builddir) where all compiled files and build artifacts will be placed, keeping the source directory clean. After this, change into the build directory:
cd builddir
3. Compile the Project
Once inside the build directory, compile the project using:
meson compile
This will compile the source code according to the configuration from the previous step.
4. Run Tests (Optional)
The project includes tests, you need to install pytest to work. You can run them with:
meson test
This step helps verify that the build works correctly.
5. Install the Project (Optional)
To install the compiled binaries, libraries, and other files system-wide (or to a custom location), run:
meson install
or
sudo meson install
You may need superuser privileges (hence sudo) to install into system directories.
Following these steps will help you successfully compile, test, and install SSCHA with Meson as its build system.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cellconstructor-1.6.0.tar.gz.
File metadata
- Download URL: cellconstructor-1.6.0.tar.gz
- Upload date:
- Size: 16.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0d20f70df9b533cc354bda595a2264057246cf213019f0aae77778781eab6c0
|
|
| MD5 |
73e1603213f4b3ba709c9baf1a990250
|
|
| BLAKE2b-256 |
fcadf629db02fee440fea432cc1a0613aa7c7e51cbb44e16184e8c430009d203
|