Metadata-Version: 2.4
Name: pyberny
Version: 0.7.0
Summary: Molecular/crystal structure optimizer
License: MPL-2.0
License-File: LICENSE
Author: Jan Hermann
Author-email: dev@jan.hermann.name
Requires-Python: >=3.10,<4.0
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Physics
Provides-Extra: benchmark
Provides-Extra: doc
Provides-Extra: plot
Provides-Extra: test
Requires-Dist: coverage (>=6) ; extra == "test"
Requires-Dist: matplotlib (>=3.5) ; extra == "plot"
Requires-Dist: molsym (>=0.2.1)
Requires-Dist: numpy (>=1.21,<3)
Requires-Dist: pyscf (>=2.5) ; extra == "benchmark"
Requires-Dist: pytest (>=6) ; extra == "test"
Requires-Dist: sphinx (>=5,<8) ; extra == "doc"
Requires-Dist: sphinx-multiversion (>=0.2) ; extra == "doc"
Requires-Dist: sphinxcontrib-katex (>=0.9) ; extra == "doc"
Requires-Dist: tblite (>=0.3) ; extra == "benchmark"
Requires-Dist: toml (>=0.10) ; extra == "doc"
Project-URL: Documentation, https://pyberny.nablapsi.science
Project-URL: Repository, https://github.com/pyberny/pyberny
Description-Content-Type: text/markdown

# PyBerny

![checks](https://img.shields.io/github/checks-status/pyberny/pyberny/master.svg)
[![coverage](https://img.shields.io/codecov/c/github/pyberny/pyberny.svg)](https://codecov.io/gh/pyberny/pyberny)
![python](https://img.shields.io/pypi/pyversions/pyberny.svg)
[![pypi](https://img.shields.io/pypi/v/pyberny.svg)](https://pypi.org/project/pyberny/)
[![commits since](https://img.shields.io/github/commits-since/pyberny/pyberny/latest.svg)](https://github.com/pyberny/pyberny/releases)
[![last commit](https://img.shields.io/github/last-commit/pyberny/pyberny.svg)](https://github.com/pyberny/pyberny/commits/master)
[![license](https://img.shields.io/github/license/pyberny/pyberny.svg)](https://github.com/pyberny/pyberny/blob/master/LICENSE)
[![code style](https://img.shields.io/badge/code%20style-black-202020.svg)](https://github.com/ambv/black)
[![doi](https://img.shields.io/badge/doi-10.5281%2Fzenodo.3695037-blue)](http://doi.org/10.5281/zenodo.3695037)

PyBerny is an optimizer of molecular geometries with respect to the total energy, using nuclear gradient information.

In each step, it takes energy and Cartesian gradients as an input, and returns a new equilibrium structure estimate.

The package implements a single optimization algorithm, which is an amalgam of several techniques, comprising the quasi-Newton method, redundant internal coordinates, an iterative Hessian approximation, a trust region scheme, linear search, and coordinate weighting. The algorithm is described in more detail in the [documentation](https://pyberny.nablapsi.science/master/algorithm.html).

Several desirable features are missing or incomplete at the moment, some of them being actively worked on (help is always welcome): [crystal geometries](https://github.com/pyberny/pyberny/issues/5), [coordinate constraints](https://github.com/pyberny/pyberny/issues/14), [coordinate weighting](https://github.com/pyberny/pyberny/issues/32), [transition state search](https://github.com/pyberny/pyberny/issues/4).

PyBerny is available in [PySCF](https://sunqm.github.io/pyscf/geomopt.html#pyberny) and [QCEngine](http://docs.qcarchive.molssi.org/projects/QCEngine/en/latest/index.html?highlight=pyberny#backends).

## Installing

Install and update using [Pip](https://pip.pypa.io/en/stable/quickstart/):

```
pip install -U pyberny
```

## Example

The snippet below optimizes a geometry from `geom.xyz` end-to-end using
GFN2-xTB (via [tblite](https://tblite.readthedocs.io)) as the
energy/gradient backend:

```python
from berny import Berny, geomlib, optimize
from berny.solvers import XTBSolver

optimizer = Berny(geomlib.readfile('geom.xyz'))
relaxed = optimize(optimizer, XTBSolver())
```

To plug in a different backend, replace `XTBSolver()` with any
coroutine that follows the same interface (see the
[documentation](https://pyberny.nablapsi.science/master/getting-started.html)
for the manual generator pattern and the solver protocol).

## Citing

If you use PyBerny in published work, please cite it via its Zenodo DOI:
[10.5281/zenodo.3695037](https://doi.org/10.5281/zenodo.3695037). The
linked record resolves to the latest release and lists per-version DOIs
for citing a specific version.

## Links

- Documentation: https://pyberny.nablapsi.science

