Contributing#
Bug reports, questions, fixes and new descriptors are welcome.
Reporting a bug or asking for a feature#
Open an issue on the issue page of the repository.
For a bug, include a short script that shows it, the output you expected, and the versions of pyscal, ASE and Python (pyscal.__version__).
For other questions, write to sarath.menon@pyscal.org.
Development setup#
Fork the repository on GitHub and clone your fork.
Create a separate environment, for example with conda, and install pyscal from the clone. The build needs a C++17 compiler.
cd pyscal3 pip install -e .
Create a branch for your change:
git checkout -b my-change.Run the tests with
pytest tests. After changes to the C++ code, rebuild withpip install -e .before testing.
Adding a descriptor#
Write the descriptor as a function in
src/pyscal3/descriptors.pythat takes an ASEAtomsobject as its first argument, returns its result and stores it on theAtomsobject under a key that starts withpyscal_. Add it to__all__insrc/pyscal3/__init__.py.Descriptors that use neighbors read them with
neighbor_arraysfromsrc/pyscal3/_bridge.py, which gives the flat neighbor arrays described in Finding neighbors.Per-atom loops that need speed go into C++ in
src/pyscal3/, with pybind11 bindings insystem_binding.cpp. Usepyscal::parallel_forfromparallel.hfor loops over atoms, and write each atom’s result only from the thread that handles it, so that the result does not depend on the number of threads.Write a docstring in the numpydoc format, with the reference to the original publication.
Add tests in
tests/. Compare with published values or an independent implementation where possible.
Documentation#
The documentation is a Jupyter Book.
The pages in docs/ are Markdown files, and most of them are notebooks in the MyST format: their code cells run when the book is built, so the results and figures always match the code.
pip install -r requirements.txt
jupyter-book build .
The book is written to _build/html.
A single page can be built with jupyter-book build docs/descriptors/cna.md.
A new descriptor page goes into docs/descriptors/, and is added to _toc.yml and to the overview in docs/descriptors/index.md.
Use the page of a similar descriptor as a template.
Each page has a definition, a short usage example with the stored keys, one or two examples on realistic structures with figures, the pitfalls, and the references.
Figures use the shared style in docs/_plotstyle.py, and their plotting code goes into cells tagged hide-input.
Pull requests#
Open a pull request against the main branch.
Before you open it, make sure the tests pass and the new feature has tests, a docstring and documentation.
The tests run automatically on Linux, macOS and Windows.