geomopt — Geometry optimization

The geomopt module implements geometry optimization via interfaces to geomeTRIC and PyBerny. The following example shows how to optimize the structure of the N2 molecule with PyBerny:

from pyscf import gto, scf
from pyscf.geomopt.berny_solver import optimize
mol = gto.M(atom='N 0 0 0; N 0 0 1.2', basis='ccpvdz')
mf = scf.RHF(mol)
mol_eq = optimize(mf)


Program reference

Helper functions for geometry optimizer

pyscf.geomopt.addons.as_pyscf_method(mol, scan_function)[source]

Creat an wrapper for the given scan_function, to make it work as a pyscf gradients scanner. The wrapper can be passed to optimize().


scan_function : [mol] => (e_tot, grad)

Examples:: >>> mol = gto.M(atom=’H; H 1 1.2’, basis=’ccpvdz’) >>> scan_fn = scf.RHF(mol).nuc_grad_method().as_scanner() >>> m = as_pyscf_method(mol, scan_fn) >>> pyscf.geomopt.berny_solver.kernel(m)

pyscf.geomopt.addons.dump_mol_geometry(mol, new_coords, log=None)[source]

Dump the molecular geometry (new_coords) and the displacement wrt old geometry.


new_coords (ndarray) : Cartesian coordinates in Angstrom

pyscf.geomopt.addons.symmetrize(mol, coords)[source]

Symmetrize the structure of a molecule.