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.
Several desirable features are missing or incomplete at the moment, some of them being actively worked on (help is always welcome): crystal geometries, coordinate constraints, coordinate weighting, transition state search.
PyBerny is available in PySCF and QCEngine.
Install and update using Pip:
pip install -U pyberny
The snippet below optimizes a geometry from geom.xyz end-to-end using
MOPAC as the energy/gradient backend:
from berny import Berny, geomlib, optimize
from berny.solvers import MopacSolver
optimizer = Berny(geomlib.readfile('geom.xyz'))
relaxed = optimize(optimizer, MopacSolver())To plug in a different backend, replace MopacSolver() with any
coroutine that follows the same interface (see the
documentation
for the manual generator pattern and the solver protocol).
If you use PyBerny in published work, please cite it via its Zenodo DOI: 10.5281/zenodo.3695037. The linked record resolves to the latest release and lists per-version DOIs for citing a specific version.
- Documentation: https://jhrmnn.github.io/pyberny