Welcome to pysisyphus documentation!
pysisyphus is a software-suite for the exploration of potential energy surfaces in ground- and excited states. It implements several methods to search for stationary points (minima and first order saddle points) and the calculation of minimum energy paths by means of IRC and Chain of States methods like Nudged Elastic Band and Growing String. Furthermore it provides tools to easily analyze & modify geometries (aligning, translating, interpolating, ...) and to visualize the calculation results/progress.
The required energies, gradients and hessians are calculated by calling external quantum chemistry codes. pysisyphus can also be used as a library to implement custom quantum chemistry workflows.
If any issues arise please open an issue and I'll see if it can be fixed and my time permits it. Contrubtions are welcome, so feel free to submit a PR.
This software is still work in progress. Use at your own risk. Also take a look at the license
Overview of pysisyphus
pysisyphus is a software-suite for the exploration of potential energy surfaces in ground- and excited states. User input is read from YAML files, but it can also be used as a python library to set up custom workflows.
Below you can find a screencast of the transition state (TS) search for the famous alanine dipeptide isomerization at the xtb level of theory. It starts with pre-optimizations of the initial and final geometry, a subsequent growing string calculation in delocalized internal coordinates to generate a guess for the final TS optimization and with which it concludes.

Besides being able to track excited states over the course of an optimization the idea of pysisyphus is to provide tools for handling the whole process of calculating reaction paths, starting from pre-optimizing the given input geometries for chain of states methods and ending with the hessian calculation on the optimized IRC endpoints.
Entry points
pysisyphus provides several entry points that can be called from the shell (command line). The available commands of the entry points can be queried with the -h or --help arguments:
# Run calculations (Minima optimization, TS search, IRC, NEB, GS, ...)
pysis
# Plotting of path-energies, optimization progress, IRC progress, etc ...
pysisplot
# Manipulate a .trj file or multiple .xyz files
pysistrj
pysis
Called with a YAML-input file. Simple and more complex examples can be found in the examples directory of this repository. Some common arguments are given below:
usage: pysis [-h] [--clean] --cp CP]
[yaml]
positional arguments:
yaml Start pysisyphus with input from a YAML file.
optional arguments:
--clean Ask for confirmation before cleaning.
--cp CP, --copy CP Copy .yaml file and corresponding geometries to a new
directory. Similar to TURBOMOLEs cpc command.
pysisplot
Visualization/plotting of the pysisyphus calculations. Some common arguments are given below:
usage: pysisplot (--cosforces | --cosens | --all_energies | --afir | --opt | --irc | --overlaps)
optional arguments:
--cosforces, --cf Plot image forces along a COS.
--cosens, --ce Plot COS energies.
--all_energies, -a Plot ground and excited state energies from 'overlap_data.h5'.
--afir Plot AFIR and true -energies and -forces from an AFIR calculation.
--opt Plot optimization progress.
--irc Plot IRC progress.
--overlaps, -o
pysistrj
Please see pysistrj --help for a list of available arguments.
Available calculators
Excited state capabilities
Program |
Gradient |
Hessian |
Exc. states |
Version |
---|---|---|---|---|
ORCA |
y |
y |
TD-DFT, TDA |
4.2.x |
Turbomole |
y |
y |
TD-DFT, TDA, ricc2 |
7.2-7.4 |
Gaussian16 |
y |
y |
tested TD-DFT, TDA |
|
PySCF |
y |
y |
tested TD-DFT |
1.7.5 |
OpenMOLCAS |
y |
n |
&rasscf |
Not yet derived from OverlapCalculator |
Ground states capabilities
Program |
Gradient |
Hessian |
Version |
---|---|---|---|
MOPAC2016 |
y |
y |
|
XTB |
y |
y |
6.3.2 |
QCEngine |
y |
n |
>= 0.16.0 |
Psi4 |
y |
y |
Pure python calculators & Wrappers
Program |
Gradient |
Hessian |
Comment |
---|---|---|---|
Sympy 2D |
y |
y |
Many analytical potentials (LEPS, Rosenbrock, Cerjan-Miller, Muller-Brown, ...) |
Lennard-Jones |
y |
n |
No periodic boundary conditions |
AFIR |
y |
n |
|
ONIOM |
y |
n |
Arbitrary number of layers with multicenter-support in the highest layer. |
FakeASE |
y |
n |
Wraps pysisyphus calculators so they can be used with ase. |
Available algorithms
Chain Of States Methods
Algorithm |
Coordinates |
Comment |
---|---|---|
Nudged Elastic Band (NEB) |
Cartesian, DLC planned |
Climbing Image variants, Doubly nudged variant |
Adaptive NEB |
Cartesian |
Not well tested |
Free-End NEB |
Cartesian |
Not well tested |
Simple Zero-Temperature-String |
Cartesian |
Equal spacing, energy-dependent spacing |
Growing String Method |
Cartesian, DLC |
Chain Of States Optimizer
Algorithm |
Comment |
Links |
---|---|---|
Steepest Descent |
Backtracking variant |
|
Conjugate Gradient |
Backtracking variant |
|
QuickMin |
||
FIRE |
||
BFGS |
Transition state optimization
Algorithm |
Comment |
Links |
---|---|---|
RS-P-RFO |
default |
|
RS-I-RFO |
||
TRIM |
||
Dimer method |
Intrinsic Reaction Coordinate integrators
Algorithm |
Comment |
Links |
---|---|---|
Damped-Velocity-Verlet |
||
Euler |
Not recommended |
|
EulerPC |
default |
|
Gonzales-Schlegel 2 |
||
Local Quadratic Approximation |
||
Modified IMK |
||
Runge-Kutta-4 |
Not recommended |
Additional remarks
pysisyphus uses the tempfile module from the python stdlib. The location of the temporary directories can be controlled by setting the $TMPDIR environment variable before executing pysis.
export TMPDIR=[tmpdir]
Installation
Preparing an environment
It is good idea to install pysisyphus into a separate python environment, whether it is an Anaconda environment or a virtualenv environment, derived from the system python installation or a pyenv installation (preferred).
# Optional: Create separate Anaconda environment
conda create -n pysis-env python=3.9
# Activate conda environment
conda activate pysis-env
# Optional: Create separate virtual environment
python -m venv pysis-env
# On some linux distributions 'python3' is used instead of 'python', e.g. Ubuntu
# python3 -m venv pysis-env
# Activate virtual environment. Preferably, an absolute path pointing to the
# 'activate' script should be used.
source pysis-env/bin/activate
Installation from PyPI with pip
This installs the latest stable release as published on PyPI. If you don't want to do any development work this is the preferred way of installing pysisyphus.
python -m pip install pysisyphus
# Installation of additional optional dependencies is also possible
# python -m pip install pysisyphus[test]
If you run into any problems please make sure that your pip version is recent enough. A pip upgrade is achieved via:
python -m pip install --upgrade pip
Installation from source
Decide on an $install_dir and clone the repository from github. If you want to change the code after installation (develop) do an editable (-e) installation with pip.
git clone https://github.com/eljost/pysisyphus.git $install_dir
cd $install_dir
# Install with -e if you want an editable installation
python -m pip install [-e] .
# Installation of extras is also possible. 'sphinx' is only needed if you
# want to build the documentation.
# python -m pip install [-e] .[test]
With an editable installation it is also easy to use other branches, besides the master branch, e.g., the dev branch to test out a new feature.
git switch dev
Setting up .pysisyphusrc
pysisyphus interfaces several quantum chemistry codes and related software (Multiwfn, Jmol). Software available to pysisyphus is registered in $HOME/.pysisyphusrc, so pysisyphus knows which command to execute an/or where to find the binaries.
Depending on the software different choices were made how it is registered. An example .pysisyphusrc is given below, with a short comment for each software.
# Excited state calculators
[gaussian09]
# Cmd to execute. Please ensure that g09 is on your $PATH.
cmd=g09
formchk_cmd=formchk
unfchk_cmd=unfchk
[gaussian16]
# Cmds to execute. Please ensure that the binaries are found in your $PATH.
cmd=g16
formchk=formchk
unfchk=unfchk
rwfdump=rwfdump
[openmolcas]
# Cmd to execute. Please ensure that pymolcas is on your $PATH.
cmd=pymolcas
[orca]
# ORCA needs the full path to its binary, so please provide the full path.
cmd=/scratch/programme/orca_4_2_0_linux_x86-64_openmpi314/orca
#[pyscf]
# pyscf must not have an explicit entry in the .pysisyphusrc. pysisyphus uses
# the python API of pyscf, so it is mandatory that is installed in the same environment
# as pysisyphus.
#[turbomole]
# Turbomole must not have an explicit entry in the .pysisyphusrc. The user has to take
# care that everything is set up correctly, e.g. TM-binaries are on the PATH etc...
# The respective commands are hardcoded into pysisyphus (dscf, ridft, ricc2, ...)
# Ground state calculators
[mopac]
# Similar to Psi4. An example is given below.
cmd=/user/johannes/bin/runmopac.sh
[psi4]
# As the Psi4 installation without conda is, to put it slightly, tricky it was
# decided to allow the installation of Psi4 into a separate conda environment.
# pysisyphus then creates a Psi4 input and sends it to the (bash)-script given below
# that accepts/expects one argument. It is the responsibility of the scrip to activate
# the appropriate conda environment and submit the Psi4 input. An example runpsi4.sh
# script is given below.
cmd=/user/johannes/bin/runpsi4.sh
#[qcengine]
# QCEngine must not have an entry explicit entry in the .pysisyphusrc. It is used
# via its python interface and can be installed as an extra with pip (see above).
# The user is referenced to the QCEngine-documentation for any further questions.
[xtb]
# Cmd to execute. Please ensure that xtb is on your $PATH.
cmd=xtb
[openmolcas]
# Make sure that the MOLCAS variable is set.
cmd=pymolcas
[cfour]
# Parallelism is managed by the user by setting environment variables in the runscript,
# as the name of the environment variable for MPI parallelism depends on how CFOUR_MPI_CORES
# was compiled. The GENBAS file must also be symlinked by the runscript.
# A sample is provided below.
cmd=/home/ghjones/bin/runcfour.sh
# Utilities
[wfoverlap]
# Cmd to execute. Please ensure that wfoverlap is on your $PATH. The binary/source
# can be obtained from https://github.com/sharc-md/sharc/tree/master/bin
cmd=/scratch/wfoverlap_1.0/bin/wfoverlap.x
[mwfn]
# Cmd to execute. Please ensure that Multiwfn is on your $PATH. Otherwise put an
# absolute path here. By default pysisyphus looks up "Multiwfn", so if you would
# put a relative path here you don't have to, as this is already covered by the
# defaults.
cmd=Multiwfn
[jmol]
# Cmd to execute. The same arguments apply for jmol as for Multiwfn. "jmol" is
# already the default.
cmd=jmol
When the specified path/cmd is not absolute, but relative (e.g. for xtb, g16, ...) the corresponding binaries have to be available on the $PATH and all other environment variables have to be set up correctly by the user.
Example runpsi4.sh
#!/bin/bash
# Afaik this doesn't work in non-interactive shells ...
# See https://github.com/conda/conda/issues/8072
# conda activate psi4
source /scratch/programme/anaconda3/bin/activate psi4
#conda activate psi4
psi4 -o stdout $1
Example runmopac.sh
#!/bin/bash
module purge
module load mopac
MOPAC2016.exe $1
Example runcfour.sh
#!/bin/bash
module purge
module load cfour
export OMP_NUM_THREADS=4
export CFOUR_MPI_CORES=1 # The name of this environment variable depends on how you compiled CFOUR
[ ! -f GENBAS ] && ln -s /software/cfour/basis/GENBAS
xcfour > out.log 2>&1
Verifying Installation
By executing pytest -v --pyargs pysisyphus.tests
a series of quick tests can be
executed, verifing successful calculator setup. Running these tests requires pyscf and
pytest to be present (pip install pyscf pytest).
Installation via Nix
An easy and reliable way to get a complete pysisyphus installation, including additional quantum chemistry (QC) codes, is possible through the Nix package manager. Required Nix files for the QC codes and their dependencies (linear algebra & MPI libraries etc.) are provided by the NixOS-QChem overlay.
Nix installations are fully reproducible and extremely simple to accomplish for any potential pysisyphus user, as most of the necessary configuration is already described in the respective Nix files.
The Nix Pills series provides an informative introduction to the general concepts behind Nix.
Recent stable versions of pysisyphus are also directly included in NixOS-QChem. If you do not require a development version of pysisyphus, using the NixOS-QChem overlay is the preferred option. Otherwise, continue with the instructions below.
Prerequisites
Please follow the installation instructions in the nix manual to set up a working Nix installation on your system.
You may want to enable the flakes
and nix-command
features for Nix.
Caching
The build time can be reduced drastically, if the quantum chemistry codes are fetched from a binary cache.
Pysisyphus provides a binary cache on Cachix.
Nix >= 2.6.0 with flakes directly supports the binary cache without further action required.
Alternatively, if you are allowed to add binary caches in nix, you may simply execute:
nix run nixpkgs#cachix use pysisyphus
Usage
You may use pysisyphus directly via Flakes without cloning any repository or local installation. Some examples how to use pysisyphus with nix:
Inspect the structure of pysisyphus' flake:
nix flake show github:eljost/pysisyphus
Directly run the pysis
command on an input :
nix run github:eljost/pysisyphus input.yml
Start an interactive shell with a pysisyphus installation
nix shell github:eljost/pysisyphus
For developing and hacking pysisyphus and for legacy Nix commands, first lone the pysisyphus repository
git clone https://github.com/eljost/pysisyphus.git && cd pysisyphus
You may obtain a development shell for pysisyphus via
nix develop
build pysisyphus in the legacy nix style
nix-build ./nix/default.nix
or obtain a development legacy-style dev-shell
nix-shell ./nix/shell.nix
The Flake also offers options to build pysisyphus with proprietary components such as ORCA or Turbomole, e.g.
nix run .#pysisyphusOrca
or build singularity or docker containers:
nix bundle --bundler .#toSingularityImage
Worked example
This page provides a general overview of pysisyphus's capabilities for optimizing ground state reaction paths for the example of a tris-pericyclic reaction between a tropone derivative and dimethylfulvene.
You can find a short discussion of the reaction on Steven M. Bacharachs blog. Here we focus on how to obtain TS1. Instead of using DFT as in the original publication we'll employ the semi-emperical tight binding code xtb. It allows us to run all necessary calculations on common desktop hardware in little time (2 min, using 6 physical CPU cores).

Educts, TS and products of the tris-pericyclic reaction between a tropone derivative and dimethylfulvene.
At first, we have to create appropriate educt and product geometries using the molecular editor of our choice, e.g., avogadro or TmoleX. Given a reasonable educt geometry a suitable product geometry can be constructed by decreasing the distance between the two ring systems and optimizing the result, e.g., by xtb. Sometimes it may be easier to start with the product geometry, and obtain the educt from it. Consistent atom ordering in both geometries is mandatory! Usually it's a bad idea to construct both geometries independently, as it is easy to mess up the atom ordering.
Given educts (min_xtbopt.xyz) and product (prod_xtbopt.xyz) we can create the YAML input. Our goal is to obtain the barrier heights for the reaction shown in Fig. 4.1 by means of growing string (GS) calculation, transition state (TS) optimization, intrinsic reaction coordinate (IRC) calculation and subsequent optimization of the IRC endpoints. The full input is shown below. We'll go over it step by step.
geom:
type: dlc
fn: [min_xtbopt.xyz, prod_xtbopt.xyz]
preopt:
cos:
type: gs
max_nodes: 18
climb: True
opt:
type: string
align: False
max_cycles: 20
tsopt:
type: rsirfo
do_hess: True
thresh: gau
hessian_recalc: 3
irc:
type: eulerpc
rms_grad_thresh: 0.0005
endopt:
calc:
type: xtb
pal: 6
The desired coordinate system and the file names of the input geometries are given in the
geom
block.
geom:
type: dlc
fn: [min_xtbopt.xyz, prod_xtbopt.xyz]
Here we chose delocalized internal coordiantes (DLC) for our GS, which is the
preferred way. Alternatively Cartesian coordinates could be used by
type: cart
. If DLCs fail, Cartesian coordinates should be tried.
preopt:
The preopt
block is given without any additional keywords, so sane defaults will
be used for preoptimizing educt and product geometries (Rational function
optimization (RFO) in redundant internal coordinates). Strictly, in our case preoptimization
is not necessary, as we already preoptimized the geometries using xtb. But in general
if is advised to span chain of states (COS) like GS or nudged elastic band (NEB) between
stationary points on the potential energy surface.
If the educts and products are NOT covalently bound it may be a good idea to restrict the
number of preoptimization cycles to a small number (max_cycles: 10
), as these
optimizations are sometimes hard to converge. Please see Optimization of Minima
for a list of possible keywords in the preopt
block.
cos:
type: gs
max_nodes: 18
climb: True
The cos
block configures COS calculations. Here we request a GS (gs
)
with 18 nodes (images) between educt and product, resulting in a total string length
of 20 nodes. By default first and last node (educt and product) are kept fixed
throughout the optimization. We enable a climbing image (CI) to obtain a better TS guess.
Please see Chain Of States Methods for further information on COS methods.
opt:
type: string
align: False
max_cycles: 20
COS/GS optimization is controlled via the opt
block. For GS optimization one should always
use type: string
. In internal coordinates we disable automated geometry alignment,
as it is not needed. We also restrict the number of optimization cycles to 20 (default 50).
The chosen optimizer will do steepest descent (SD) steps when the string grew in the previous
cycle, otherwise conjugate gradient (CG) steps are used. When the GS is fully grown/connected
the optimizer will use limited-memory Broyden-FletcherGoldfarb-Shanno (L-BFGS) to determine
more sophisticated steps.
tsopt:
type: rsirfo
do_hess: True
thresh: gau
hessian_recalc: 3
After GS convergence the highest energy image (HEI) is determined by cubic splining
and used as guess for a classical TS optimization using restricted step image RFO (RSIRFO).
do_hess: True
requests a frequency calculation after the TS optimization.
The Hessian is recalculated every 3th step. When the Hessian for the chosen computational
method is reasonably cheap it is a good idea to recalculate it periodically.
Between recalculations it's updated using the Bofill-update. Convergence critera are
tightened from the default thresh: gau_loose
to thresh: gau
.
irc:
type: eulerpc
rms_grad_thresh: 0.0005
IRC integration is controlled in the irc
block. By default the Euler-predictor-corrector
(EulerPC) integrator is used. Integration is terminated when the root-mean-square (RMS) of the
gradient is equal to or less than 0.0005 au. Possible inputs are given in
Intrinsic Reaction Coordinate (IRC).
endopt:
Similar to preopt
the endopt
will be executed with default arguments. It
is used to optimize the IRC endpoints to stationary points and enables printing of
additional information like RMS deviation of atomic positions (RMSD) between optimized
endpoints and initial geometries. The RMSD values help in deciding if the obtained TS
actually connects presumed educts and products.
calc:
type: xtb
pal: 6
The calc
block configures the level of theory used in energy/gradient/Hessian
calculations. Here we chose xtb and requested 6 CPU cores. Additional inputs for
xtb can be found in the xtb module documentation
With everything set up we are ready to actually execute pysisyphus! Assuming the above YAML is saved to 01_pericyclic.yaml just run
pysis 01_pericyclic.yaml | tee pysis.log
By default pysisyphus prints to STDOUT so you have to capture STDOUT explicitely. We use
tee
so everything is logged to a file and printed simulatenously.
A lot of files and output will be produced so we will go over everything slowly.
d8b 888
Y8P 888
888
88888b. 888 888 .d8888b 888 .d8888b 888 888 88888b. 88888b. 888 888 .d8888b
888 "88b 888 888 88K 888 88K 888 888 888 "88b 888 "88b 888 888 88K
888 888 888 888 "Y8888b. 888 "Y8888b. 888 888 888 888 888 888 888 888 "Y8888b.
888 d88P Y88b 888 X88 888 X88 Y88b 888 888 d88P 888 888 Y88b 888 X88
88888P" "Y88888 88888P' 888 88888P' "Y88888 88888P" 888 888 "Y88888 88888P'
888 888 888 888
888 Y8b d88P Y8b d88P 888
888 "Y88P" "Y88P" 888
Version 0.5.0.post1+450.g2c1654d3 (Python 3.8.5, NumPy 1.19.2, SciPy 1.5.2)
Git commit 2c1654d35d69e7b48ac4e9b00d38afd58a8bedd4
Executed at Tue Oct 6 10:08:30 2020 on 'your fancy hostname'
If pysisyphus benefitted your research please cite:
https://doi.org/10.1002/qua.26390
Good luck!
You will be greeted by a banner and some information about your current installation,
which hopefully aids in reproducing your results later on, if needed. Then your input
is repeated, including default values that you did not explicitely set. There you can
also see the default values chosen for preopt
and endopt
.
{'calc': {'pal': 6, 'type': 'xtb'},
'cos': {'climb': True, 'fix_ends': True, 'max_nodes': 18, 'type': 'gs'},
'endopt': {'dump': True,
'fragments': False,
'max_cycles': 100,
'overachieve_factor': 3,
'thresh': 'gau',
'type': 'rfo'},
'geom': {'fn': ['min_xtbopt.xyz', 'prod_xtbopt.xyz'], 'type': 'dlc'},
'interpol': {'between': 0, 'type': None},
'irc': {'rms_grad_thresh': 0.0005, 'type': 'eulerpc'},
'opt': {'align': False, 'dump': True, 'max_cycles': 30, 'type': 'string'},
'preopt': {'dump': True,
'max_cycles': 100,
'overachieve_factor': 3,
'preopt': 'both',
'strict': False,
'thresh': 'gau_loose',
'trust_max': 0.3,
'type': 'rfo'},
'tsopt': {'do_hess': True,
'dump': True,
'h5_group_name': 'tsopt',
'hessian_recalc': 3,
'overachieve_factor': 3,
'thresh': 'gau',
'type': 'rsirfo'}}
The whole run starts with preoptimizations of educt and product. Both optimizations converge quickly, as the geometries are already preoptimized.
#################################
# RUNNING FIRST PREOPTIMIZATION #
#################################
Spent 0.0 s preparing the first cycle.
cycle max(force) rms(force) max(step) rms(step) s/cycle
0 0.000080 0.000010 0.027005 0.003934 0.1
Converged!
Final summary:
max(forces, internal): 0.000080 hartree/(bohr,rad)
rms(forces, internal): 0.000010 hartree/(bohr,rad)
max(forces,cartesian): 0.000063 hartree/bohr
rms(forces,cartesian): 0.000015 hartree/bohr
energy: -52.35197394 hartree
Wrote final, hopefully optimized, geometry to 'first_pre_final_geometry.xyz'
Preoptimization of first geometry converged!
Saved final preoptimized structure to 'first_preopt.xyz'.
RMSD with initial geometry: 0.000000 au
################################
# RUNNING LAST PREOPTIMIZATION #
################################
Spent 0.0 s preparing the first cycle.
cycle max(force) rms(force) max(step) rms(step) s/cycle
0 0.000188 0.000025 0.002310 0.000592 0.1
Converged!
Final summary:
max(forces, internal): 0.000188 hartree/(bohr,rad)
rms(forces, internal): 0.000025 hartree/(bohr,rad)
max(forces,cartesian): 0.000182 hartree/bohr
rms(forces,cartesian): 0.000032 hartree/bohr
energy: -52.39960456 hartree
Wrote final, hopefully optimized, geometry to 'last_pre_final_geometry.xyz'
Preoptimization of last geometry converged!
Saved final preoptimized structure to 'last_preopt.xyz'.
RMSD with initial geometry: 0.000000 au
After an optimization remaining RMS and max of the forces are reported for internal and
Cartesian coordinates. If the internal force is zero, but a substantial Cartesian
force remains someting went wrong, e.g., the generated coordinate system is lacking
important coordinates. In such cases the generated coordinates can be examined manually
pysistrj [geom file] --internals
to determine important missing coordinates.
Preoptimizations are followed by the GS optimization.
#########################
# RUNNING GROWINGSTRING #
#########################
Spent 0.0 s preparing the first cycle.
cycle max(force) rms(force) max(step) rms(step) s/cycle
0 0.006403 0.001545 0.006403 0.001545 0.2
String=2+2 HEI=02/04 (E_max-E_0)=1.4 kJ/mol
1 0.009367 0.001734 0.009367 0.001734 0.3
String=3+3 HEI=03/06 (E_max-E_0)=4.1 kJ/mol
2 0.010394 0.001807 0.010394 0.001807 0.6
String=4+4 HEI=04/08 (E_max-E_0)=8.0 kJ/mol
3 0.011152 0.001790 0.011152 0.001790 1.1
String=5+5 HEI=05/10 (E_max-E_0)=12.5 kJ/mol
4 0.010687 0.001722 0.010687 0.001722 1.0
String=6+6 HEI=06/12 (E_max-E_0)=17.6 kJ/mol
5 0.008751 0.001620 0.008751 0.001620 1.1
String=7+7 HEI=07/14 (E_max-E_0)=22.8 kJ/mol
6 0.008007 0.001517 0.008007 0.001517 1.3
String=8+8 HEI=08/16 (E_max-E_0)=27.6 kJ/mol
7 0.006895 0.001423 0.006895 0.001423 1.4
String=9+9 HEI=09/18 (E_max-E_0)=31.3 kJ/mol
Starting to climb in next iteration.
8 0.006253 0.001313 0.006253 0.001314 1.6
String=Full HEI=10/20 (E_max-E_0)=32.8 kJ/mol
9 0.006134 0.001169 0.059438 0.011487 1.7
String=Full HEI=10/20 (E_max-E_0)=32.0 kJ/mol
10 0.009555 0.001504 0.022529 0.003827 1.6
String=Full HEI=10/20 (E_max-E_0)=31.6 kJ/mol
11 0.009792 0.001583 0.100000 0.011614 1.7
String=Full HEI=10/20 (E_max-E_0)=31.6 kJ/mol
12 0.008636 0.001534 0.100000 0.011518 1.7
String=Full HEI=10/20 (E_max-E_0)=30.7 kJ/mol
13 0.008708 0.001448 0.100000 0.011463 1.6
String=Full HEI=10/20 (E_max-E_0)=30.0 kJ/mol
14 0.008217 0.001363 0.100000 0.005660 1.7
String=Full HEI=10/20 (E_max-E_0)=29.4 kJ/mol
15 0.007743 0.001335 0.100000 0.005297 1.7
String=Full HEI=10/20 (E_max-E_0)=29.1 kJ/mol
16 0.007243 0.001307 0.100000 0.005143 1.6
String=Full HEI=10/20 (E_max-E_0)=28.8 kJ/mol
17 0.006897 0.001285 0.100000 0.004938 1.6
String=Full HEI=10/20 (E_max-E_0)=28.6 kJ/mol
18 0.006772 0.001277 0.100000 0.004992 1.6
String=Full HEI=10/20 (E_max-E_0)=28.5 kJ/mol
19 0.006714 0.001273 0.100000 0.005006 1.6
String=Full HEI=10/20 (E_max-E_0)=28.5 kJ/mol
Found sign 'converged'. Ending run.
Operator indicated convergence!
Wrote final, hopefully optimized, geometry to 'final_geometries.trj'
Splined HEI is at 8.07/19.00, between image 8 and 9 (0-based indexing).
Wrote splined HEI to 'splined_hei.xyz'
The string grows quickly and is fully grown in cycle 8. String size and barrier height between the first and HEI are reported in every cycle. From cycle 8 on, a CI is employed. The final HEI index is printed at the end. As we interpolate the HEI, the index may be a fractional number. The COS optimization is followed by a TS optimization.
####################################
# RUNNING TS-OPTIMIZATION FROM COS #
####################################
Creating mixed HEI tangent, using tangents at images (8, 9).
Overlap of splined HEI tangent with these tangents:
08: 0.982763
09: 0.149474
Index of splined highest energy image (HEI) is 8.07.
Wrote animated HEI tangent to cart_hei_tangent.trj
Splined HEI (TS guess)
[xyz file printed here; removed for clarity]
Splined Cartesian HEI tangent
[xyz file printed here; removed for clarity]
Wrote splined HEI coordinates to 'splined_hei.xyz'
Calculating Hessian at splined TS guess.
Negative eigenvalues at splined HEI:
[-0.005069 -0.000317]
Overlaps between HEI tangent and imaginary modes:
00: 0.856746
01: 0.009826
Imaginary mode 0 has highest overlap with splined HEI tangent.
Spent 0.3 s preparing the first cycle.
cycle max(force) rms(force) max(step) rms(step) s/cycle
0 0.009004 0.001343 0.056873 0.017930 0.2
1 0.000754 0.000227 0.158373 0.035866 0.2
2 0.001142 0.000156 0.316150 0.051562 3.6
3 0.000483 0.000082 0.339089 0.052646 0.2
4 0.000370 0.000067 0.321142 0.049527 0.2
5 0.000362 0.000050 0.243173 0.040395 3.6
6 0.000152 0.000023 0.174987 0.032910 0.2
7 0.000503 0.000063 0.092082 0.019454 0.2
8 0.000199 0.000031 0.121285 0.024502 3.5
9 0.000136 0.000019 0.061690 0.012096 0.2
Converged!
Final summary:
max(forces, internal): 0.000136 hartree/(bohr,rad)
rms(forces, internal): 0.000019 hartree/(bohr,rad)
max(forces,cartesian): 0.000164 hartree/bohr
rms(forces,cartesian): 0.000043 hartree/bohr
energy: -52.34823514 hartree
Wrote final, hopefully optimized, geometry to 'ts_final_geometry.xyz'
Optimized TS coords:
[xyz file printed here; removed for clarity]
Wrote TS geometry to 'ts_opt.xyz'
-----------------------------
| HESSIAN AT FINAL GEOMETRY |
-----------------------------
... mass-weighing cartesian hessian
... doing Eckart-projection
First 10 eigenvalues [-2.4303e-03 -3.9622e-17 -8.1858e-18 -7.8671e-19 2.1865e-18 5.1589e-18
2.6247e-17 1.3733e-05 7.3736e-05 1.2735e-04]
Imaginary frequencies: [-253.24] cm⁻¹
Wrote final (not mass-weighted) hessian to 'calculated_final_cart_hessian'.
Wrote HD5 Hessian to 'final_hessian.h5'.
Wrote imaginary mode with ṽ=-253.24 cm⁻¹ to 'imaginary_mode_000.trj'
Barrier between TS and first COS image: 9.8 kJ mol⁻¹
Barrier between TS and last COS image: 134.9 kJ mol⁻¹
The initial HEI TS guess features only two sizable imaginary frequencies, confirming that
it is a suitable TS guess. Root 0 has the highest overlap (85%) with the HEI tangent and is
chosen for maximization in the TS optimization, whereas the energy will be minimized along
the remaining modes. The optimization converged quickly in 10 cycles. A final Hessian is
computed at the optimized TS as we used do_hess: True
. Only one imaginary frequency
remains, which is the desired result for a first-order saddle point. All sizable imaginary
modes are written to .trj files and can be viewed by tools like jmol.
Barrier heights between the TS and first and last COS image (no thermochemistry is included!) are reported. In this case the energy difference between the first COS image and the TS is very small, indicating an early TS, similar to the educts. This is also be confirmed by examining Fig. 4.1.
###############
# RUNNING IRC #
###############
Calculating energy and gradient at the TS
IRC length in mw. coords, max(|grad|) and rms(grad) in unweighted coordinates.
Norm of initial displacement step: 0.1974
#################
# IRC - FORWARD #
#################
Step IRC length dE / au max(|grad|) rms(grad)
--------------------------------------------------------
0 0.298147 -0.000333 0.001413 0.000394
Integrator indicated convergence!
##################
# IRC - BACKWARD #
##################
Step IRC length dE / au max(|grad|) rms(grad)
--------------------------------------------------------
0 0.332823 -0.000938 0.004607 0.001154
1 0.662398 -0.001367 0.006116 0.001608
2 0.991868 -0.001878 0.008670 0.002208
3 1.320005 -0.002558 0.012581 0.002968
4 1.644982 -0.003249 0.015719 0.003595
5 1.966058 -0.003700 0.017023 0.003976
6 2.285006 -0.003972 0.016598 0.004230
7 2.596325 -0.004126 0.019112 0.004415
8 2.898296 -0.004206 0.021118 0.004439
9 3.186446 -0.004052 0.021182 0.004240
10 3.462246 -0.003697 0.019162 0.003793
11 3.723777 -0.003087 0.015042 0.003078
12 3.966373 -0.002263 0.009324 0.002161
13 4.173308 -0.001387 0.003822 0.001310
14 4.321559 -0.000781 0.002226 0.000838
15 4.420391 -0.000523 0.001616 0.000642
16 4.498118 -0.000418 0.001299 0.000548
17 4.571712 -0.000353 0.001967 0.000569
18 4.647481 -0.000298 0.004516 0.000754
19 4.722445 -0.000308 0.003469 0.000670
20 4.808189 -0.000290 0.003426 0.000682
21 4.881593 -0.000209 0.004155 0.000683
Integrator indicated convergence!
The imaginary mode is used to displace the TS towards educts and product.
As the TS is very similar to the educt, forward IRC integration already terminates after
one cycle. Maybe, further integration steps could be forced by tightening the threshold
in the irc:
block. Backward integration terminates after 22 cycles. At first,
the gradient increases and after the inflection point is passed, falls off again as
a stationary point is approached. In the end both IRC endpoints are fully optimized to
stationary points.
####################################
# RUNNING FORWARD_END OPTIMIZATION #
####################################
Spent 0.0 s preparing the first cycle.
cycle max(force) rms(force) max(step) rms(step) s/cycle
0 0.000491 0.000126 0.099615 0.030780 0.1
1 0.001769 0.000333 0.121277 0.033041 0.2
2 0.002986 0.000525 0.228218 0.054622 0.2
3 0.002455 0.000475 0.396872 0.096049 0.2
4 0.003106 0.000502 0.061397 0.012734 0.2
5 0.000676 0.000187 0.040565 0.007988 0.2
6 0.000498 0.000144 0.048609 0.012294 0.2
7 0.000908 0.000142 0.055895 0.016806 0.2
8 0.000715 0.000102 0.037441 0.011352 0.2
9 0.000226 0.000047 0.034467 0.006157 0.2
10 0.000119 0.000032 0.034646 0.006157 0.1
Converged!
Final summary:
max(forces, internal): 0.000119 hartree/(bohr,rad)
rms(forces, internal): 0.000032 hartree/(bohr,rad)
max(forces,cartesian): 0.000241 hartree/bohr
rms(forces,cartesian): 0.000073 hartree/bohr
energy: -52.35194671 hartree
Wrote final, hopefully optimized, geometry to 'forward_end_final_geometry.xyz'
Moved 'forward_end_final_geometry.xyz' to 'forward_end_opt.xyz'.
#####################################
# RUNNING BACKWARD_END OPTIMIZATION #
#####################################
Spent 0.0 s preparing the first cycle.
cycle max(force) rms(force) max(step) rms(step) s/cycle
0 0.004485 0.001075 0.168005 0.031009 0.1
1 0.003805 0.000731 0.158516 0.028598 0.2
2 0.003345 0.000610 0.047413 0.008626 0.2
3 0.002849 0.000531 0.093820 0.017252 0.2
4 0.001571 0.000332 0.154150 0.028740 0.2
5 0.000752 0.000148 0.034367 0.007031 0.2
6 0.000630 0.000107 0.017362 0.004137 0.2
7 0.000218 0.000047 0.019096 0.003624 0.1
8 0.000165 0.000041 0.027156 0.004814 0.2
9 0.000400 0.000065 0.044195 0.007618 0.2
10 0.000460 0.000076 0.039724 0.006652 0.1
11 0.000265 0.000059 0.021454 0.003444 0.2
12 0.000194 0.000034 0.009649 0.001594 0.1
13 0.000146 0.000025 0.009711 0.001835 0.1
Converged!
Final summary:
max(forces, internal): 0.000146 hartree/(bohr,rad)
rms(forces, internal): 0.000025 hartree/(bohr,rad)
max(forces,cartesian): 0.000183 hartree/bohr
rms(forces,cartesian): 0.000047 hartree/bohr
energy: -52.39959356 hartree
Wrote final, hopefully optimized, geometry to 'backward_end_final_geometry.xyz'
Moved 'backward_end_final_geometry.xyz' to 'backward_end_opt.xyz'.
Both optimizations converge quickly without any problems. Finally, optimized endpoint geometries are compared to the intial geometries and final barrier heights are reported. Thermochemistry is not (yet) included. Even though both endpoints are reported as dissimilar to the initial geomtries they are still very similar, confirming, that the obtained TS indeed connects presumed educts and product.
#################################
# RMSDS AFTER END OPTIMIZATIONS #
#################################
start geom 0 (first_preopt.xyz/min_xtbopt.xyz)
end geom 0 ( forward_end_opt.xyz): RMSD=0.133727 au
end geom 1 (backward_end_opt.xyz): RMSD=1.126059 au
Optimized end geometries are dissimilar to 'first_preopt.xyz/min_xtbopt.xyz'!
start geom 1 (last_preopt.xyz/prod_xtbopt.xyz)
end geom 0 ( forward_end_opt.xyz): RMSD=1.144102 au
end geom 1 (backward_end_opt.xyz): RMSD=0.093044 au
Optimized end geometries are dissimilar to 'last_preopt.xyz/prod_xtbopt.xyz'!
###########################################
# BARRIER HEIGHTS AFTER END OPTIMIZATIONS #
###########################################
Thermochemical corrections are NOT included!
Minimum energy of 0.0 kJ mol⁻¹ at 'backward_end_opt.xyz'.
forward_end_opt.xyz: 125.10 kJ mol⁻¹
TS: 134.84 kJ mol⁻¹
backward_end_opt.xyz: 0.00 kJ mol⁻¹
Wrote optimized end-geometries and TS to 'end_geoms_and_ts.trj'
Visualization/plotting of running optimizations and IRC integrations is also possible. Please see Plotting for further information.
All inputs can be found in the examples/complex/08_trispericyclic directry on github.
Coordinate Systems
Choice of coordinate system is often crucial, for the successful outcome of geometry optimizations. Pysisyphus supports different coordinate systems. By default, molecular optimizations are carried out in redundant internal coordinates (RIC).
Supported Coordinate Systems
Cartesian Coordinates
Strong coupling
Unambiguously defined, if translation and rotation (TR) are removed
Redundant set, if TR are not removed
type: cart
Redundant Internal Coordinates
Comprising bond stretches, (linear) bends, (improper) torsions and other primitives
Less coupling, compared to Cartesians
Easy estimation of diagonal model Hessians
Support constraints
Require sophisticated setup algorithm
Iterative internal-Cartesian backtransformation, which may fail
Usually highly redundant set
type: redund
Delocalized Internal Coordinates (DLC)
Complicated linear combinations of primitive internals
No coupling, coordinates are orthogonal to each other, at least at the geometrey they were defined at
Non redundant set
More efficient compared to RIC for bigger systems (if initial DLC generation is feasible)
Same comments apply, as for RICs
type: dlc
Translation & Rotation Internal Coordinates (TRIC)
Especially suited to optimize solvated/non-covalently bound systems
Translation and rotation coordinates are assigned to every fragment
Avoids error-prone assignment of interfragment coordinates
See 10.1063/1.4952956 for a full discussion
By default the B-Matrix is recalculated in every step of the internal-Cartesian backtransformation when TRIC is enabled
type: tric
Supported File Formats
All formats can be read, at least to a certain extent. Coordinate files are expected to be in Å, if not otherwise dictated by the respective format.
Suffix |
Write |
Comment |
---|---|---|
.xyz |
✓ |
Plain XYZ, single geometry. |
.trj |
✓ |
Plain XYZ, multiple geometries. |
.pdb |
✓ |
Protein Data Bank. |
.molden |
✗ |
Restricted to [Geometries] block. |
.zmat |
✗ |
Z-Matrix, see below for an example. |
.cjson |
✗ |
As saved by Avogadro. |
.crd |
✗ |
CHARMM card format |
.sdf |
✗ |
Structure-data file |
Z-Matrix example
C
N 1 1.35
H 1 1.0 2 105.0
H 2 1.4 1 105.0 3 150.0
H 2 1.4 1 110.0 3 -160.0
Indexing in Z-matrices is 1-based, so the first atom has index 1. Variable substitution is not supported in the current Z-matrix parser.
YAML Input
See below for an explanation of possible inputs in the geom section. Input related to internal coordinates is given mostly in the coord_kwargs subgroup, whereas atom-related input (isotops, freeze_atoms) is given one level above. See the example below:
geom:
type: cart # Coordinate system (cart/redund/dlc/tric)
fn: [input] # File name or inline input
union: False # Define same set of primitives at multiple geometries
isotopes: null # Specify different isotopes
freeze_atoms: null # Freeze Cartesians of certain atoms
coord_kwargs: # Keywords that are passed to the internal coordinate class
define_prims: null # Additionally define these primitives
constrain_prims: null # Primitive internals to be constrained
freeze_atoms_exclude: False # Whether to set up internal coordinates for frozen atoms
preopt:
geom: # geom block in preopt takes same keywords as above
... # no 'fn' key here!
endopt:
geom: # geom block in endopt takes same keywords as above
... # no 'fn' key here!
Employed coordinates and coordinate systems in preopt and endopt are similary controlled by a geom block. Same keywords are supported, as for the geom block, at the top level, except the fn key.
Inline input
Inline coordinates are supported for XYZ format, and expected in Å. Take care of proper indentation. The example below would yield RIC for the hydrogen molecule (1 bond).
geom:
type: redund
fn: |
2
H 0.0 0.0 0.0
H 0.0 0.0 0.7
Types of Primitive Coordinates
Pysisyphus implements many different (primitive) internal coordinates. Every coordinate is defined by its type and a set of atom indices, e.g., 2 indices for a bond, 3 indices for a bend and 4 indices for a dihedral.
Specification of a type is necessary, as there are many different kinds of bonds, bends and dihedrals/out-of-plane. One can't just assume, that a coordinate comprised of 3 atom indices is always a regular bend, as it may also be a linear bend or a translational coordinate (TRANSLATION_X, 14), describin the mean Cartesian X coordinate of 3 atoms.
Atom indices start at 0!
# Primitive types
BOND = 0
AUX_BOND = 1
HYDROGEN_BOND = 2
INTERFRAG_BOND = 3
AUX_INTERFRAG_BOND = 4
BEND = 5
LINEAR_BEND = 6
LINEAR_BEND_COMPLEMENT = 7
PROPER_DIHEDRAL = 8
IMPROPER_DIHEDRAL = 9
OUT_OF_PLANE = 10
LINEAR_DISPLACEMENT = 11
LINEAR_DISPLACEMENT_COMPLEMENT = 12
# TRANSLATION = 13 # Dummy coordinate
TRANSLATION_X = 14
TRANSLATION_Y = 15
TRANSLATION_Z = 16
# ROTATION = 17 # Dummy coordinate
ROTATION_A = 18
ROTATION_B = 19
ROTATION_C = 20
# CARTESIAN = 21 # Dummy coordinate
CARTESIAN_X = 22
CARTESIAN_Y = 23
CARTESIAN_Z = 24
BONDED_FRAGMENT = 25
DUMMY_TORSION = 26
DISTANCE_FUNCTION = 27
# atan2 based coordinates
BEND2 = 28
TORSION2 = 29
As some of these types are quite unwieldy, several shortcuts are supported, that can be used in place of the types above.
# Additional shortcuts
# Using Cartesians in the framework of internal coordinates is mainly
# useful if one wants to constrain certain atoms.
"X": [PT.CARTESIAN_X],
"Y": [PT.CARTESIAN_Y],
"Z": [PT.CARTESIAN_Z],
"XY": [PT.CARTESIAN_X, PT.CARTESIAN_Y],
"XZ": [PT.CARTESIAN_X, PT.CARTESIAN_Z],
"YZ": [PT.CARTESIAN_Y, PT.CARTESIAN_Z],
"XYZ": [PT.CARTESIAN_X, PT.CARTESIAN_Y, PT.CARTESIAN_Z],
"ATOM": [PT.CARTESIAN_X, PT.CARTESIAN_Y, PT.CARTESIAN_Z],
# Primitive aliases
"B": [PT.BOND],
"A": [PT.BEND],
"A2": [PT.BEND2],
"D": [PT.PROPER_DIHEDRAL],
"DIHEDRAL": [PT.PROPER_DIHEDRAL],
"TORSION": [PT.PROPER_DIHEDRAL],
"D2": [PT.PROPER_DIHEDRAL2],
"DIHEDRAL2": [PT.PROPER_DIHEDRAL2],
"TORSION2": [PT.PROPER_DIHEDRAL2],
# Translation & Rotation coordinates
"TRANSLATION": [PT.TRANSLATION_X, PT.TRANSLATION_Y, PT.TRANSLATION_Z],
"ROTATION": [PT.ROTATION_A, PT.ROTATION_B, PT.ROTATION_C],
# Miscellaneous
"DIST_FUNC": [PT.DISTANCE_FUNCTION]
Define Additional Primitives
Pysisyphus tries its best, to automatically come up with a reasonable set of internal coordinates, but sometimes the algorithm misses an important one. Especially at transition state guesses, where increased atom distances are common, bonds may be missed.
In such cases, additional coordinates can be requested explicitly. If additional coordinates are requested, a nested list is expected [[coord0], [coord1], ...].
# General structure (list of coordinate lists)
define_prims: [[PrimType or Shortcut], *[atom indices], ...]
# Examples
# Additional bond between atoms 4 and 7 (0-based indexing).
# All three lines below result in the same bond; the latter two use shortcuts.
define_prims: [[0, 4, 7]]
define_prims: [[B, 4, 7]]
define_prims: [[BOND, 4, 7]]
# Wrong specification (forgot outer list/brackets):
define_prims: [0, 4, 7]
# Also define an additional dihedral, beside the bond
define_prims: [[0, 4, 7], ["D", 0, 1, 2, 3]]
Freeze Atoms
All three Cartesian coordinates (X, Y, Z) of certain atoms can be frozen, so they always remain at their initial value. By setting freeze_atoms_exclude in coord_kwargs, frozen atoms can be excluded from the internal coordinate setup. By default frozen atoms are included.
geom:
type: [type]
fn: [fn]
freeze_atoms: [*atom indices]
coord_kwargs:
freeze_atoms_exclude: False
# Example; fully freeze Cartesians of first and second atom.
geom:
type: cart
fn: input.xyz
freeze_atoms: [0, 1]
coord_kwargs:
freeze_atoms: True
Constraints
Constraints beyond frozen atoms are currently only supported in conjunction with RIC (`type: redund`). It is not (yet) possible to modify the value of the specified coordinate via YAML input; the internal coordinate is constrained at its initial value. The same syntax as for define_prims is used. If the coordinate of the requested constraint is not already defined, it will be defined subsequently. There is no need to also add the constrained coordinate to define_prims.
# General structure (nested list of coordinates)
constrain_prims: [[[PrimType or Shortcut], *[atom indices]], ...]
# Examples
# Constrain Cartesian coordinate of atom 0.
# Both lines result in the same constraint.
constrain_prims: [[XYZ, 0]]
constrain_prims: [[ATOM, 0]]
# Constrain only Cartesian X and Y component of atom 0.
constrain_prims: [[XY, 0]]
# Constraint bond between atoms 4 and 7 (0-based indexing).
# All three lines below result in the same constraint; the latter two use shortcuts.
constrain_prims: [[0, 4, 7]]
constrain_prims: [[B, 4, 7]]
constrain_prims: [[BOND, 4, 7]]
Constraining the Cartesian coordinates (X, Y and Z) of one atom does not affect the final energy of an optimization. But constraining more than one atome does.
Harmonic restraints to selected primitive internals can be specified in the calc: section (see the Restraint documentation).
Isotopes
Different isotope masses can be requested. The system works similar to Gaussians system. A list of pairs is expected, where the first number specifies the atom and the second number is either an integer or a float. If it is an integer, the isotope mass closest to this integer is looked up in an internal database. Floats are used as is.
# General structure (nested list of coordinates)
isotopes: [[[atom index], [new mass, integer/float], ...]
# Modify the mass of atom with index 2 (hydrogen in this case)
# Both lines give identical results (deuterium).
# In the second line, the mass is given directly.
isotopes: [[2, 2]]
isotopes: [[2, 2.014101778]]
Different isotope masses affect calculated frequencies and IRCs. Atoms can be fixed in IRC calculations by specifying a very high mass. YAML does not recognize 1e9 as float, take care to add a dot (1.e9).
# Fix atom 0 in IRC calculation.
isotopes: [[0, 1.e9]]
Geometry & RedundantCoords
The central class in pysisyphus, handling coordinates and delegating calculations to (external QC) codes, is the Geometry class, similar to ASE's Atoms.
- class pysisyphus.Geometry.Geometry(atoms, coords, fragments=None, coord_type='cart', coord_kwargs=None, isotopes=None, freeze_atoms=None, comment='', name='')[source]
- __init__(atoms, coords, fragments=None, coord_type='cart', coord_kwargs=None, isotopes=None, freeze_atoms=None, comment='', name='')[source]
Object representing atoms in a coordinate system.
The Geometry represents atoms and their positions in coordinate system. By default cartesian coordinates are used, but internal coordinates are also possible.
- Parameters:
atoms (iterable) -- Iterable of length N, containing element symbols.
coords (1d iterable) -- 1d iterable of length 3N, containing the cartesian coordinates of N atoms.
fragments (dict, optional) -- Dict with different keys denoting different fragments. The values contain lists of atom indices.
coord_type ({"cart", "redund"}, optional) -- Type of coordinate system to use. Right now cartesian (cart) and redundand (redund) are supported.
coord_kwargs (dict, optional) -- Dictionary containing additional arguments that get passed to the constructor of the internal coordinate class.
isotopes (iterable of pairs, optional) -- Iterable of pairs consisting of 0-based atom index and either an integer or a float. If an integer is given the closest isotope mass will be selected. Given a float, this float will be directly used as mass.
freeze_atoms (iterable of integers) -- Specifies which atoms should remain fixed at their initial positions.
comment (str, optional) -- Comment string.
name (str, optional) -- Verbose name of the geometry, e.g. methanal or water. Used for printing
- property all_energies
Return energies of all states that were calculated.
This will also set self.energy, which may NOT be the ground state, but the state correspondig to the 'root' attribute of the calculator.
- approximate_radius()[source]
Approximate molecule radius from the biggest atom distance along an axis.
- as_g98_list()[source]
Returns data for fake Gaussian98 standard orientation output.
- Returns:
g98_list -- List with one row per atom. Every row contains [center number, atomic number, atomic type (always 0 for now), X Y Z coordinates in Angstrom.
- Return type:
list
- as_xyz(comment='', atoms=None, cart_coords=None)[source]
Current geometry as a string in XYZ-format.
- Parameters:
comment (str, optional) -- Will be written in the second line (comment line) of the XYZ-string.
cart_coords (np.array, 1d, shape (3 * atoms.size, )) -- Cartesians for dumping instead of self._coords.
- Returns:
xyz_str -- Current geometry as string in XYZ-format.
- Return type:
str
- assert_compatibility(other)[source]
Assert that two Geometries can be substracted from each other.
- Parameters:
other (Geometry) -- Geometry for comparison.
- atom_indices()[source]
Dict with atom types as key and corresponding indices as values.
- Returns:
inds_dict -- Unique atom types as keys, corresponding indices as values.
- Return type:
dict
- property atom_types
- property atomic_numbers
- property bond_sets
- property cart_coords
- property cart_forces
- property cart_gradient
- property cart_hessian
- property center_of_mass
Returns the center of mass.
- Returns:
R -- Center of mass.
- Return type:
np.array, shape(3, )
- center_of_mass_at(coords3d)[source]
Returns the center of mass at given coords3d.
- Parameters:
coords3d (np.array, shape(N, 3)) -- Cartesian coordiantes.
- Returns:
R -- Center of mass.
- Return type:
np.array, shape(3, )
- property centroid
Geometric center of the Geometry.
- Returns:
R -- Geometric center of the Geometry.
- Return type:
np.array, shape(3, )
- property comment
- coord_types = {'cart': None, 'cartesian': <class 'pysisyphus.intcoords.CartesianCoords.CartesianCoords'>, 'dlc': <class 'pysisyphus.intcoords.DLC.DLC'>, 'hdlc': <class 'pysisyphus.intcoords.DLC.HDLC'>, 'hredund': <class 'pysisyphus.intcoords.RedundantCoords.HybridRedundantCoords'>, 'mwcartesian': <class 'pysisyphus.intcoords.CartesianCoords.MWCartesianCoords'>, 'redund': <class 'pysisyphus.intcoords.RedundantCoords.RedundantCoords'>, 'tmtric': <class 'pysisyphus.intcoords.RedundantCoords.TMTRIC'>, 'tric': <class 'pysisyphus.intcoords.RedundantCoords.TRIC'>}
- property coords
1d vector of atomic coordinates.
- Returns:
coords -- 1d array holding the current coordinates.
- Return type:
np.array
- property coords3d
Coordinates in 3d.
- Returns:
coords3d -- Coordinates of the Geometry as 2D array.
- Return type:
np.array
- property coords_by_type
Coordinates in 3d by atom type and their corresponding indices.
- Returns:
cbt (dict) -- Dictionary with the unique atom types of the Geometry as keys. It's values are the 3d coordinates of the corresponding atom type.
inds (dict) -- Dictionary with the unique atom types of the Geometry as keys. It's values are the original indices of the 3d coordinates in the whole coords3d array.
- copy(coord_type=None, coord_kwargs=None)[source]
Returns a new Geometry object with same atoms and coordinates.
- Parameters:
coord_type (str) -- Desired coord_type, defaults to current coord_type.
coord_kwargs (dict, optional) -- Any desired coord_kwargs that will be passed to the RedundantCoords object.
- Returns:
geom -- New Geometry object with the same atoms and coordinates.
- Return type:
- property covalent_radii
- property energy
Energy of the current atomic configuration.
- Returns:
energy -- Energy of the current atomic configuration.
- Return type:
float
- property forces
Energy of the current atomic configuration.
- Returns:
force -- 1d array containing the forces acting on the atoms. Negative of the gradient.
- Return type:
np.array
- get_energy_and_forces_at(coords)[source]
Calculate forces and energies at the given coordinates.
The results are not saved in the Geometry object.
- get_normal_modes(cart_hessian=None, full=False)[source]
Normal mode wavenumbers, eigenvalues and Cartesian displacements Hessian.
- get_subgeom(indices, coord_type='cart', sort=False)[source]
Return a Geometry containing a subset of the current Geometry.
- Parameters:
indices (iterable of ints) -- Atomic indices that the define the subset of the current Geometry.
coord_type (str, ("cart", "redund"), optional) -- Coordinate system of the new Geometry.
- Returns:
sub_geom -- Subset of the current Geometry.
- Return type:
- property gradient
Negative of the force.
- Returns:
gradient -- 1d array containing the negative of the current forces.
- Return type:
np.array
- property hessian
Matrix of second derivatives of the energy in respect to atomic displacements.
- Returns:
hessian -- 2d array containing the second derivatives of the energy with respect to atomic/coordinate displacements depending on the type of coordiante system.
- Return type:
np.array
- property inertia_tensor
- property is_analytical_2d
- property layers
- property masses
- property masses_rep
- property mm_inv
Inverted mass matrix.
Returns a diagonal matrix containing the inverted atomic masses.
- property mm_sqrt_inv
Inverted square root of the mass matrix.
- property moving_atoms
- property mw_coords
Mass-weighted coordinates.
- Returns:
mw_coords -- 1d array containing the mass-weighted cartesian coordiantes.
- Return type:
np.array
- property mw_gradient
Mass-weighted gradient.
- Returns:
mw_gradient -- Returns the mass-weighted gradient.
- Return type:
np.array
- property mw_hessian
Mass-weighted hessian.
- Returns:
mw_hessian -- 2d array containing the mass-weighted hessian M^(-1/2) H M^(-1/2).
- Return type:
np.array
- principal_axes_are_aligned()[source]
Check if the principal axes are aligned with the cartesian axes.
- Returns:
aligned -- Wether the principal axes are aligned or not.
- Return type:
bool
- set_coord(ind, coord)[source]
Set a coordinate by index.
- Parameters:
ind (int) -- Index in of the coordinate to set in the self.coords array.
coord (float) -- Coordinate value.
- set_results(results)[source]
Save the results from a dictionary.
- Parameters:
results (dict) -- The keys in this dict will be set as attributes in the current object, with the corresponding item as value.
- property sum_formula
- property total_mass
- unweight_mw_hessian(mw_hessian)[source]
Unweight a mass-weighted hessian.
- Parameters:
mw_hessian (np.array) -- Mass-weighted hessian to be unweighted.
- Returns:
hessian -- 2d array containing the hessian.
- Return type:
np.array
- property vdw_radii
- pysisyphus.Geometry.get_trans_rot_vectors(cart_coords, masses, rot_thresh=1e-06)[source]
Vectors describing translation and rotation.
These vectors are used for the Eckart projection by constructing a projector from them.
See Martin J. Field - A Pratcial Introduction to the simulation of Molecular Systems, 2007, Cambridge University Press, Eq. (8.23), (8.24) and (8.26) for the actual projection.
See also https://chemistry.stackexchange.com/a/74923.
- Parameters:
cart_coords (np.array, 1d, shape (3 * atoms.size, )) -- Atomic masses in amu.
masses (iterable, 1d, shape (atoms.size, )) -- Atomic masses in amu.
- Returns:
ortho_vecs -- 2d array containing row vectors describing translations and rotations.
- Return type:
np.array(6, 3*atoms.size)
- pysisyphus.Geometry.inertia_tensor(coords3d, masses)[source]
Inertita tensor.
x² xy xz |- (x y z)^T . (x y z) = | xy y² yz |
- xz yz z² |
Basic infrastructure to work with internal coordinates is provided by RedundantCoords.
- class pysisyphus.intcoords.RedundantCoords.RedundantCoords(atoms, coords3d, masses=None, bond_factor=1.3, typed_prims=None, define_prims=None, constrain_prims=None, freeze_atoms=None, freeze_atoms_exclude=False, internals_with_frozen=False, define_for=None, bonds_only=False, check_bends=True, rebuild=True, bend_min_deg=15, dihed_max_deg=175, lb_min_deg=175, weighted=False, min_weight=0.3, svd_inv_thresh=0.000316, recalc_B=False, tric=False, hybrid=False, hbond_angles=False, rm_for_frag=None)[source]
- property B
Wilson B-Matrix
- property B_inv
Generalized inverse of the Wilson B-Matrix.
- property B_inv_prim
Generalized inverse of the primitive Wilson B-Matrix.
- property B_prim
Wilson B-Matrix
- property Bt_inv
Transposed generalized inverse of the Wilson B-Matrix.
- property Bt_inv_prim
Transposed generalized inverse of the primitive Wilson B-Matrix.
- property C
Diagonal matrix. Entries for constraints are set to one.
- property P
Projection matrix onto B. See [1] Eq. (4).
- backtransform_hessian(redund_hessian, int_gradient=None)[source]
Transform Hessian in internal coordinates to Cartesians.
- property bend_atom_indices
- property bend_indices
- property bond_atom_indices
- property bond_indices
- property bond_typed_prims
- property cartesian_indices
- property constrained_indices
- property coords
- property coords3d
- property dihedral_atom_indices
- property dihedral_indices
- property linear_bend_indices
- property outofplane_indices
- property prim_coords
- property prim_indices_set
- property prim_internals
- property primitives
- project_hessian(H, shift=1000)[source]
Expects a hessian in internal coordinates. See Eq. (11) in [1].
- property rotation_indices
- transform_hessian(cart_hessian, int_gradient=None)[source]
Transform Cartesian Hessian to internal coordinates.
- property translation_indices
- property typed_prims
Calculators
Exploring potential energy surfaces (PESs) requires calculation of energies and its derivatives (gradients, Hessian matrices).
For testing purposes and method development, pysisyphus implements various analytical 2d potentials, as they allow fast evaluations of the aforementioned quantities. Actual (production) calculations are carried out by wrapping existing quantum chemistry codes (ORCA, TURBOMOLE, Gaussian etc.) and delegating the required calculations to them. Pysisyphus generates all necessary inputs, executes the QC code and parses their output for the requested quantities.
Furthermore pysisyphus provides several "meta"-calculators which wrap other (actual) calculators, to modify calculated energies and forces. Examples for this are the Dimer calculator, used for carrying out transition state searches or the ONIOM calculator, allowing multi-level calculations comprising different levels of theory.
External forces, e.g. a restraining spherical potential or harmonic restraints on primitive internal coordinates (stretches, bends, torsion) can be applied with ExternalPotential.
YAML input
Possible keywords for the YAML input can be derived from inspecting the possible arguments of the Calculator base-class (see below) and the possible arguments of the respective calculator, e.g. ORCA or XTB.
The most commonly used keywords, derived from the Calculator baseclass are mem, handling the requested memory per core in MB, pal, handling the number of requested CPU cores, charge, the total charge of the system and mult, the systems multiplicity.
For (excited state, ES) calculations carried out with calculators derived from OverlapCalculator additional keywords are possible. The most common keywords controlling ES calculations are track, activating ES tracking, ovlp_type, selecting the tracking algorithm and ovlp_with, handling the selection of the reference cycle.
An example input highlighting the most important keywords is shown below.
geom:
[... omitted ...]
calc:
type: orca # Calculator type, e.g. g09/g16/openmolcas/
# orca/pyscf/turbomole/dftb+/mopac/psi4/xtb
pal: 1 # Number of CPU cores
mem: 1000 # Memory per core
charge: 0 # Charge
mult: 1 # Multiplicity
# Keywords for ES calculations
track: False # Activate ES tracking
ovlp_type: tden # Tracking algorithm
ovlp_with: previous # Reference cycle selection
# Additional calculator specific keywords
[... omitted ...]
opt:
[... omitted ...]
Calculator base classes
- class pysisyphus.calculators.Calculator.Calculator(calc_number=0, charge=0, mult=1, base_name='calculator', pal=1, mem=1000, keep_kind='all', check_mem=True, retry_calc=0, last_calc_cycle=None, clean_after=True, out_dir='qm_calcs', force_num_hess=False, num_hess_kwargs=None)[source]
- __init__(calc_number=0, charge=0, mult=1, base_name='calculator', pal=1, mem=1000, keep_kind='all', check_mem=True, retry_calc=0, last_calc_cycle=None, clean_after=True, out_dir='qm_calcs', force_num_hess=False, num_hess_kwargs=None)[source]
Base-class of all calculators.
Meant to be extended.
- Parameters:
calc_number (int, default=0) -- Identifier of the Calculator. Used in distinguishing it from other Calculators, e.g. in ChainOfStates calculations. Also used in the creation of filenames.
charge (int, default=0) -- Molecular charge.
mult (int, default=1) -- Molecular multiplicity (1 = singlet, 2 = doublet, ...)
base_name (str, default=calculator) -- Generated filenames will start with this string.
pal (int, default=1) -- Positive integer that gives the number of physical cores to use on 1 node.
mem (int, default=1000) -- Mememory per core in MB. The total amount of memory is given as mem*pal.
check_mem (bool, default=True) -- Whether to adjust the requested memory if too much is requested.
retry_calc (int, default=0) -- Number of additional retries when calculation failed.
last_calc_cycle (int) -- Internal variable used in restarts.
clean_after (bool) -- Delete temporary directory were calculations were executed after a calculation.
out_dir (str) -- Path that is prepended to generated filenames.
force_hess_kwargs (bool, default False) -- Force numerical Hessians.
num_hess_kwargs (dict) -- Keyword arguments for finite difference Hessian calculation.
- clean(path)[source]
Delete the temporary directory.
- Parameters:
path (Path) -- Directory to delete.
- conf_key = None
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- get_restart_info()[source]
Return a dict containing chkfiles.
- Returns:
restart_info -- Dictionary holding the calculator state. Used for restoring calculaters in restarted calculations.
- Return type:
dict
- keep(path)[source]
Backup calculation results.
- Parameters:
path (Path) -- Temporary directory of the calculation.
- Returns:
kept_fns -- Dictonary holding the filenames that were backed up. The keys correspond to the type of file.
- Return type:
dict
- log(message='')[source]
Write a log message.
Wraps the logger variable.
- Parameters:
message (str) -- Message to be logged.
- make_fn(name, counter=None, return_str=False)[source]
Make a full filename.
Return a full filename including the calculator name and the current counter given a suffix.
- Parameters:
name (str) -- Suffix of the filename.
counter (int, optional) -- If not given use the current calc_counter.
return_str (int, optional) -- Return a string instead of a Path when True.
- Returns:
fn -- Filename.
- Return type:
str
- property name
- prepare(inp)[source]
Prepare a temporary directory and write input.
Similar to prepare_path, but the input is also written into the prepared directory.
Paramters
- inpstr
Input to be written into the file
self.inp_fn
in the prepared directory.
- returns:
- path: Path
Prepared directory.
- prepare_coords(atoms, coords)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
- prepare_path(use_in_run=False)[source]
Get a temporary directory handle.
Create a temporary directory that can later be used in a calculation.
- Parameters:
use_in_run (bool, option) -- Sets the internal variable
self.path_already_prepared
that is later read byself.run()
. No new temporary directory will be created inself.run()
.- Returns:
- path: Path
Prepared directory.
- prepare_pattern(raw_pat)[source]
Prepare globs.
Transforms an entry of
self.to_keep
into a glob and a key suitable for the use inself.keep()
.- Parameters:
raw_pat (str) -- Entry of
self.to_keep
- Returns:
pattern (str) -- Glob that can be used in Path.glob()
multi (bool) -- Flag if glob may match multiple files.
key (str) -- A key to be used in the
kept_fns
dict.
- prepare_turbo_coords(atoms, coords)[source]
Get a Turbomole coords string.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- String holding coordinates in Turbomole coords format.
- Return type:
str
- prepare_xyz_string(atoms, coords)[source]
Returns a xyz string in Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
xyz_str -- Coordinates in .xyz format.
- Return type:
string
- print_out_fn(path)[source]
Print calculation output.
Prints the output of a calculator after a calculation.
- Parameters:
path (Path) -- Temporary directory of the calculation.
- restore_org_hessian()[source]
Restore original 'get_hessian' method, which may also fallback to numerical Hessians, if not implemented.
- run(inp, calc, add_args=None, env=None, shell=False, hold=False, keep=True, cmd=None, inc_counter=True, run_after=True, parser_kwargs=None, symlink=True)[source]
Run a calculation.
The bread-and-butter method to actually run an external quantum chemistry code.
- Parameters:
inp (str) -- Input for the external program that is written to the temp-dir.
calc (str, hashable) -- Key (and more or less type of calculation) to select the right parsing function from
self.parser_funcs
.add_args (iterable, optional) -- Additional arguments that will be appended to the program call.
env (Environment, optional) -- A potentially modified environment for the subprocess call.
shell (bool, optional) -- Use a shell to execute the program call. Need for Turbomole were we chain program calls like dscf; escf.
hold (bool, optional) -- Wether to remove the temporary directory after the calculation.
keep (bool, optional) -- Wether to backup files as specified in
self.to_keep()
. Usually you want this.cmd (str or iterable, optional) -- Overwrites
self.base_cmd
.inc_counter (bool, optional) -- Wether to increment the counter after a calculation.
- Returns:
results -- Dictionary holding all applicable results of the calculations like the energy, a forces vector and/or excited state energies from TDDFT.
- Return type:
dict
- run_after(path)[source]
Meant to be extended.
This method is called after a calculation was done, but before entering
self.keep()
andself.clean()
. Can be used to call tools like formchk or ricctools.
- set_restart_info(restart_info)[source]
Sets restart information (chkfiles etc.) on the calculator.
- Parameters:
restart_info (dict) -- Dictionary holding the calculator state. Used for restoring calculaters in restarted calculations.
- verify_chkfiles(chkfiles)[source]
Checks if given chkfiles exist and return them as Paths
- Parameters:
chkfiles (dict) -- Dictionary holding the chkfiles. The keys correspond to the attribute names, the values are strs holding the (potentially full) filename (path).
- Returns:
paths -- Dictionary of Paths.
- Return type:
dict
OverlapCalculator base class
- class pysisyphus.calculators.OverlapCalculator.NTOs(ntos, lambdas)
Bases:
tuple
- lambdas
Alias for field number 1
- ntos
Alias for field number 0
- class pysisyphus.calculators.OverlapCalculator.OverlapCalculator(*args, track=False, ovlp_type='tden', double_mol=False, ovlp_with='previous', adapt_args=(0.5, 0.3, 0.6), cdds=None, orient='', dump_fn='overlap_data.h5', h5_dump=False, conf_thresh=0.001, mos_ref='cur', mos_renorm=True, **kwargs)[source]
Bases:
Calculator
- H5_MAP = {'Ca': 'Ca_list', 'Cb': 'Cb_list', 'Xa': 'Xa_list', 'Xb': 'Xb_list', 'Ya': 'Ya_list', 'Yb': 'Yb_list', 'all_energies': 'all_energies_list', 'coords': 'coords_list', 'ref_roots': 'reference_roots', 'roots': 'roots_list'}
- OVLP_TYPE_VERBOSE = {'nto': 'natural transition orbital overlap', 'nto_org': 'original natural transition orbital overlap', 'tden': 'transition density matrix overlap', 'top': 'transition orbital pair overlap', 'wf': 'wavefunction overlap'}
- VALID_CDDS = (None, 'calc', 'render')
- VALID_KEYS = ['wf', 'tden', 'nto', 'nto_org', 'top']
- VALID_XY = ('X', 'X+Y', 'X-Y')
- conf_thresh
self.dyn_roots = int(dyn_roots) if self.dyn_roots != 0:
self.dyn_roots = 0 self.log("dyn_roots = 0 is hardcoded right now")
- property data_model
- get_indices(indices=None)[source]
A new root is determined by selecting the overlap matrix row corresponding to the reference root and checking for the root with the highest overlap (at the current geometry).
The overlap matrix is usually formed by a double loop like:
overlap_matrix = np.empty((ref_states, cur_states)) for i, ref_state in enumerate(ref_states):
- for j, cur_state in enumerate(cur_states):
overlap_matrix[i, j] = make_overlap(ref_state, cur_state)
So the reference states run along the rows. Thats why the ref_state index comes first in the 'indices' tuple.
- get_orbital_matrices(indices=None, S_AO=None)[source]
Return MO coefficents and AO overlaps for the given indices.
If not provided, a AO overlap matrix is constructed from one of the MO coefficient matrices (controlled by self.mos_ref). Also, if requested one of the two MO coefficient matrices is re-normalized.
- static get_sao_from_mo_coeffs(C)[source]
Recover AO overlaps from given MO coefficients.
For MOs in the columns of mo_coeffs:
S_AO = C⁻¹^T C⁻¹ S_AO C = C⁻¹^T (S_AO C)^T = C⁻¹ C^T S_AO^T = C⁻¹ C^T S_AO C = I
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- property stored_calculations
Calculators with Excited state capabilities
Gaussian09
Gaussian16
- class pysisyphus.calculators.Gaussian16.Gaussian16(route, gbs='', gen='', keep_chk=False, stable='', fchk=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'gaussian16'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- parse_log(*args, **kwargs)
- prepare_input(atoms, coords, calc_type, did_stable=False, point_charges=None)[source]
Meant to be extended.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
OpenMolcas
Pysisyphus currently supports energy and gradient calculations utilizing the &rasscf and/or the &mcpdft sections. Neither analytical nor numerical Hessians are yet implemented for the OpenMolcas-calculator.
Two keywords are always required: inporb and basis, with the former pointing to a .RasOrb file and the latter containing the selected atomic orbital basis, e.g., ano-rcc-vdzp. Additional input for the &gateway, &rasscf and &mcpdft sections can be given via the respective keyword(s).
Due to restrictions of the current design, simple keywords that don't take further arguments as cmsi in &rasscf or grad and mspdft in &mcpdft still must be given with a trailing colon. See below for an example.
geom:
type: redund
fn: |
4
C -1.0398336639 0.0 0.0
S 0.6002429216 0.0 0.0
H -1.6321592382 -0.94139864 0.0
H -1.6321592382 0.94139864 0.0
calc:
type: openmolcas
basis: cc-pvdz
charge: 0
mult: 1
inporb: /home/johannes/tmp/359_cmspdft/359_cmspdft.RasOrb
rasscf:
ciroot: 3 3 1
mdrlxroot: 2
cmsi:
mcpdft:
ksdft: t:pbe
grad:
mspdft:
opt:
thresh: gau
- class pysisyphus.calculators.OpenMolcas.OpenMolcas(basis, inporb, rasscf=None, gateway=None, mcpdft=None, track=True, **kwargs)[source]
Bases:
Calculator
- conf_key = 'openmolcas'
- prepare_coords(atoms, coords)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
ORCA 4.2.1 / 5.0.1
- class pysisyphus.calculators.ORCA.ORCA(keywords, blocks='', gbw=None, do_stable=False, numfreq=False, json_dump=True, **kwargs)[source]
Bases:
OverlapCalculator
- __init__(keywords, blocks='', gbw=None, do_stable=False, numfreq=False, json_dump=True, **kwargs)[source]
ORCA calculator.
Wrapper for creating ORCA input files for energy, gradient and Hessian calculations. The PAL and memory inputs must not be given in the keywords and/or blocks, as they are handled by the 'pal' and 'memory' arguments.
- Parameters:
keywords (str) -- Keyword line, as normally given in ORCA, excluding the leading "!".
blocks (str, optional) -- ORCA block input(s), e.g. for TD-DFT calculations (%tddft ... end). As the blocks start with a leading "%", wrapping the input in quotes ("") is required, otherwise the parsing will fail.
gbw (str, optional) -- Path to an input gbw file, which will be used as initial guess for the first calculation. Will be overriden later, with the path to the gbw file of a previous calculation.
do_stable (bool, optional) -- Run stability analysis until a stable wavefunction is obtained, before every calculation.
numfreq (bool, optional) -- Use numerical frequencies instead of analytical ones.
json_dump (bool, optional) -- Whether to dump the wavefunction to JSON via orca_2json. The JSON can become very large in calculations comprising many basis functions.
- check_termination(*args, **kwargs)
- conf_key = 'orca'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- static parse_atoms_coords(inp, *args, **kwargs)
- static parse_cis(cis)[source]
Simple wrapper of external function.
Currently, only returns Xα and Yα.
- static parse_engrad_info(inp, *args, **kwargs)
- static parse_hess_file(inp, *args, **kwargs)
- prepare_input(atoms, coords, calc_type, point_charges=None, do_stable=False)[source]
Meant to be extended.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- run_after(path)[source]
Meant to be extended.
This method is called after a calculation was done, but before entering
self.keep()
andself.clean()
. Can be used to call tools like formchk or ricctools.
- pysisyphus.calculators.ORCA.get_name(text)[source]
Return string that comes before first character & offset.
- pysisyphus.calculators.ORCA.parse_orca_cis(cis_fn)[source]
- Read binary CI vector file from ORCA.
Loosly based on TheoDORE 1.7.1, Authors: S. Mai, F. Plasser https://sourceforge.net/p/theodore-qc
- pysisyphus.calculators.ORCA.parse_orca_gbw(gbw_fn)[source]
Adapted from https://orcaforum.kofo.mpg.de/viewtopic.php?f=8&t=3299
The first 5 long int values represent pointers into the file:
Pointer @+0: Internal ORCA data structures Pointer @+8: Geometry Pointer @+16: BasisSet Pointer @+24: Orbitals Pointer @+32: ECP data
PySCF 1.7.6
Turbomole 7.x
Pysisyphus does not implement a wrapper for define, so the user has to manually prepare a directory containing a valid control file. An automated define wrapper, restricted to ground state functionality, is available via the QCEngine project, to which I contributed the Turbomole harness.
Care should be taken to include only the minimum amount of necessary files in the control_path directory, e.g., (auxbasis, basis, control, coord, mos) for a closed-shell calculation using RI. A gradient file must not be present in control_path, as well as other subdirectories and files with .out extension. The coord file, while not strictly required, should be kept too, to facilitate testing of the setup with standalone Turbomole.
It may be a good idea to pre-converge the calculation in control_path, to see if the setup is correct and actually works. Resulting files like energy, statistics can be deleted; mos should be kept, as the converged MOs are reused in pysisyphus.
If an excited-state optimization is desired, care has to be taken, to include $exopt [n] for TD-DFT/TDA or the geoopt state=([n]) (ricc2)! Tracking of excited states is currently possible for closed shell egrad and ricc2 calculations.
The current implementation was tested against Turbomole 7.4.1 and QCEngine 0.19.0. Please see examples/complex/11_turbomole_gs_tsopt for a full example where Turbmole is utilized in a growing string calculation. The same example, using QCEngine, is found in examples/complex/12_qcengine_turbomole_gs_tsopt. MOs are not reused with the QCEngine calculator, so the native pysisyphus calculator is probably faster.
- class pysisyphus.calculators.Turbomole.Turbomole(control_path=None, simple_input=None, root=None, double_mol_path=None, cosmo_kwargs=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'turbomole'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- parse_double_mol(path)[source]
Parse a double molecule overlap matrix from Turbomole output to be used with WFOWrapper.
- parse_gs_energy()[source]
Several places are possible: $subenergy from control file total energy from turbomole.out Final MP2 energy from turbomole.out with ADC(2) Final CC2 energy from turbomole.out with CC(2)
- parse_td_vectors(text)[source]
For TDA calculations only the X vector is present in the ciss_a/etc. file. In TDDFT calculations there are twise as much items compared with TDA. The first half corresponds to (X+Y) and the second half to (X-Y). X can be calculated as X = ((X+Y)+(X-Y))/2. Y is then given as Y = (X+Y)-X. The normalization can then by checked as
np.concatenate((X, Y)).dot(np.concatenate((X, -Y)))
and should be 1.
- static parse_tddft_tden(inp, *args, **kwargs)
- prepare_input(atoms, coords, calc_type, point_charges=None)[source]
To rectify this we have to construct the basecmd dynamically and construct it ad hoc. We could set a RI flag in the beginning and select the correct scf binary here from it. Then we select the following binary on demand, e.g. aoforce or rdgrad or egrad etc.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- pysisyphus.calculators.Turbomole.control_from_simple_input(simple_inp, charge, mult, cosmo_kwargs=None)[source]
Create control file from 'simple input'.
See examples/opt/26_turbomole_simple_input/ for an example.
DFTB+ 20.x
- class pysisyphus.calculators.DFTBp.DFTBp(parameter, *args, slakos=None, root=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'dftbp'
- hubbard_derivs = {'3ob': {'Br': -0.0573, 'C': -0.1492, 'Ca': -0.034, 'Cl': -0.0697, 'F': -0.1623, 'H': -0.1857, 'I': -0.0433, 'K': -0.0339, 'Mg': -0.02, 'N': -0.1535, 'Na': -0.0454, 'O': -0.1575, 'P': -0.14, 'S': -0.11, 'Zn': -0.03}}
- max_ang_moms = {'3ob': {'Br': 'd', 'C': 'p', 'Ca': 'p', 'Cl': 'd', 'F': 'p', 'H': 's', 'I': 'd', 'K': 'p', 'Mg': 'p', 'N': 'p', 'Na': 'p', 'O': 'p', 'P': 'd', 'S': 'd', 'Zn': 'd'}, 'mio-ext': {'C': 'p', 'H': 's', 'N': 'p', 'O': 'p'}}
Calculators with Ground state capabilities
MOPAC 2016
- class pysisyphus.calculators.MOPAC.MOPAC(method='PM7', **kwargs)[source]
Bases:
Calculator
- CALC_TYPES = {'energy': '1SCF', 'gradient': '1SCF GRADIENTS', 'hessian': 'DFORCE FORCE LET'}
- METHODS = ['am1', 'pm3', 'pm6', 'pm6-dh2', 'pm6-d3', 'pm6-dh+', 'pm6-dh2', 'pm6-dh2x', 'pm6-d3h4', 'pm6-d3h4x', 'pm7', 'pm7-ts']
- MULT_STRS = {1: 'SINGLET', 2: 'DOUBLET', 3: 'TRIPLET', 4: 'QUARTET', 5: 'QUINTET', 6: 'SEXTET', 7: 'SEPTET', 8: 'OCTET'}
- base_cmd
Do only SCF AUX: Creates a checkpoint file NOREO: Dont reorient geometry
- Type:
1SCF
- conf_key = 'mopac'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- static parse_energy_from_aux(inp, *args, **kwargs)
- static parse_hessian_from_aux(inp, *args, **kwargs)
- prepare_coords(atoms, coords, opt=False)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
Psi4
- class pysisyphus.calculators.Psi4.Psi4(method, basis, to_set=None, to_import=None, pcm='iefpcm', solvent=None, write_fchk=False, **kwargs)[source]
Bases:
Calculator
- conf_key = 'psi4'
QCEngine
XTB 6.x
- class pysisyphus.calculators.XTB.OptResult(opt_geom, opt_log)
Bases:
tuple
- opt_geom
Alias for field number 0
- opt_log
Alias for field number 1
- class pysisyphus.calculators.XTB.XTB(gbsa='', alpb='', gfn=2, acc=1.0, iterations=250, etemp=None, retry_etemp=None, restart=False, topo=None, topo_update=None, quiet=False, **kwargs)[source]
Bases:
Calculator
- __init__(gbsa='', alpb='', gfn=2, acc=1.0, iterations=250, etemp=None, retry_etemp=None, restart=False, topo=None, topo_update=None, quiet=False, **kwargs)[source]
XTB calculator.
Wrapper for running energy, gradient and Hessian calculations by XTB.
- Parameters:
gbsa (str, optional) -- Solvent for GBSA calculation, by default no solvent model is used.
alpb (str, optional) -- Solvent for ALPB calculation, by default no solvent model is used.
gfn (int or str, must be (0, 1, 2, or "ff")) -- Hamiltonian for the XTB calculation (GFN0, GFN1, GFN2, or GFNFF).
acc (float, optional) -- Accuracy control of the calculation, the lower the tighter several numerical thresholds are chosen.
iterations (int, optional) -- The number of iterations in SCC calculation.
topo (str, optional) -- Path the a GFNFF-topolgy file. As setting up the topology may take some time for sizable systems, it may be desired to reuse the file.
topo_update (int) -- Integer controlling the update interval of the GFNFF topology update. If supplied, the topolgy will be recreated every N-th calculation.
mem (int) -- Mememory per core in MB.
quiet (bool, optional) -- Suppress creation of log files.
- static check_termination(inp, *args, **kwargs)
- conf_key = 'xtb'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- prepare_coords(atoms, coords)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
Dalton
- class pysisyphus.calculators.Dalton.Dalton(basis, method='hf', **kwargs)[source]
Bases:
Calculator
- conf_key = 'dalton'
OpenBabel
- class pysisyphus.calculators.OBabel.OBabel(ff='gaff', mol=None, **kwargs)[source]
Bases:
Calculator
- conv_dict = {'kcal/mol': 627.5094740630558, 'kj/mol': 2625.4996394798254}
CFOUR
- class pysisyphus.calculators.CFOUR.CFOUR(cfour_input, wavefunction_dump=True, initden_file=None, **kwargs)[source]
Bases:
Calculator
- __init__(cfour_input, wavefunction_dump=True, initden_file=None, **kwargs)[source]
CFOUR calculator.
Wrapper handling CFOUR ground state energy and gradient calculations.
- Parameters:
cfour_input (dict) -- CFOUR keywords and values. Note: "on" must be encapsulated in quotes to avoid being translated to True by YAML.
wavefunction_dump (bool, optional) -- Whether or not to keep ground state SCF orbitals for each geometry step.
initden_file (str, optional) -- Path to an input initden file for use as a guess SCF density.
- conf_key = 'cfour'
- keep(path)[source]
Backup calculation results.
- Parameters:
path (Path) -- Temporary directory of the calculation.
- Returns:
kept_fns -- Dictonary holding the filenames that were backed up. The keys correspond to the type of file.
- Return type:
dict
- prepare(inp)[source]
Prepare a temporary directory and write input.
Similar to prepare_path, but the input is also written into the prepared directory.
Paramters
- inpstr
Input to be written into the file
self.inp_fn
in the prepared directory.
- returns:
- path: Path
Prepared directory.
- prepare_coords(atoms, coords)[source]
Get 3d coords in Bohr
Reshape internal 1d coords to 3d.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Bohr.
- Return type:
np.array, 3d
Meta (wrapping) Calculators
ExternalPotential
Restraint
# General input structure for restraints
calc:
type: ext
# Multiple potentials could be specified here as a list
potentials:
# Primitive internal coordinate restraint
- type: restraint
# List of restraints; could also be multiple restraints. Each restraint is given as
# list of 2 or 3 items.
#
# The first item always specifies an internal coordinate,
# whereas the second argument is a force constant (in atomic units; actual units
# depend on the coordinate). Optionally a reference value (third argument) can be
# given. If omitted, the initial coordinate value is used as reference value.
restraints: [[[BOND, 0, 1], 10, 3.0]]
# The commented out input below would restrain the bond at its initial value.
#restraints: [[[BOND, 0, 1], 10]]
# Multiple restraints are specified as given below.
#restraints: [[[BOND, 0, 1], 10], [[BEND, 0, 1, 2], 1.0]]
calc:
type: [actual calculator that is wrapped by ExternalPotential]
HarmonicSphere
LogFermi
RMSD
DFT-D3
Method to add DFT-D3 dispersion corrections as an external potential via the program developed by the Grimme group <https://www.chemie.uni-bonn.de/grimme/de/software/dft-d3/get_dft-d3>.
This is for use with calculators that do not natively provide D3 corrections (e.g. OpenMolcas). Usage mirrors that of other external potentials, with an example given below.
# General input structure for restraints
calc:
type: ext
# Multiple potentials could be specified here as a list
potentials:
# Add atom-pairwise D3 dispersion correction as a differentiable, external potential
- type: d3
# Functional is specified in TURBOMOLE format, all lower case.
functional: pbe
# Optional Becke-Johnson damping, default false, recommended true
bjdamping: true
calc:
type: [actual calculator that is wrapped by ExternalPotential]
AFIR
- class pysisyphus.calculators.AFIR.AFIR(calculator, fragment_indices, gamma, rho=1, p=6, ignore_hydrogen=False, zero_hydrogen=True, complete_fragments=True, dump=True, h5_fn='afir.h5', h5_group_name='afir', **kwargs)[source]
Bases:
Calculator
- __init__(calculator, fragment_indices, gamma, rho=1, p=6, ignore_hydrogen=False, zero_hydrogen=True, complete_fragments=True, dump=True, h5_fn='afir.h5', h5_group_name='afir', **kwargs)[source]
Artifical Force Induced Reaction calculator.
Currently, there are no automated drivers to run large-scale AFIR calculations with many different initial orientations and/or increasing collision energy parameter γ. Nontheless, selected AFIR calculations can be carried out by hand. After convergence, artificial potential & forces, as well as real energies and forces can be plotted with 'pysisplot --afir'. The highest energy point along the AFIR path can then be selected for a subsequent TS-optimization, e.g. via 'pysistrj --get [index] optimzation.trj'.
Future versions of pysisyphus may provide drivers for more automatted AFIR calculations.
- Parameters:
calculator (
Calculator
) -- Actual QC calculator that provides energies and its derivatives, that are modified by the AFIR calculator, e.g., ORCA or Psi4.fragment_indices (
List
[List
[int
]]) -- List of lists of integers, specifying the separate fragments. If the indices in theses lists don't comprise all atoms in the molecule, the reamining indices will be added as a separate fragment. If a AFIR calculation is carried out with 2 fragments and 'complete_fragments' is True (see below) it is enough to specify only the indices of one fragment, e.g., for a system of 10 atoms 'fragment_indices=[[0,1,2,3]]' is enough. The second system will be set up automatically with indices [4,5,6,7,8,9].gamma (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]) -- Collision energy parameter γ in au. For 2 fragments it can be a single integer, while for > 2 fragments a list of gammas must be given, specifying the pair-wise collision energy parameters. For 3 fragments 3 gammas must be given [γ_01, γ_02, γ_12], for 4 fragments 6 gammas would be required [γ_01, γ_02, γ_03, γ_12, γ_13, γ_23] and so on.rho (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]], default:1
) -- Direction of the artificial force, either 1 or -1. The same comments as for gamma apply. For 2 fragments a single integer is enough, for > 2 fragments a list of rhos must be given (see above). For rho=1 fragments are pushed together, for rho=-1 fragments are pulled apart.p (
int
, default:6
) -- Exponent p used in the calculation of the weight function ω. Defaults to 6 and probably does not have to be changed.ignore_hydrogen (
bool
, default:False
) -- Whether hydrogens are ignored in the calculation of the artificial force. All weights between atom pairs containing hydrogen will be set to 0.zero_hydrogen (
bool
, default:True
) -- Whether to use 0.0 as covalent radius for hydrogen in the weight function. Compared to 'ignore_hydrogen', which results in zero weights for all atom pairs involving hydrogen, 'zero_hydrogen' may be non-zero, depending on the covalent radius of the second atom in the pair.complete_fragments (
bool
, default:True
) -- Whether an incomplete specification in 'fragment_indices' is automatically completed.dump (
bool
, default:True
) -- Whether an HDF5 file is created.h5_fn (
str
, default:'afir.h5'
) -- Filename of the HDF5 file used for dumping.h5_group_name (
str
, default:'afir'
) -- HDF5 group name used for dumping.**kwargs -- Keyword arguments passed to the Calculator baseclass.
- property charge
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property mult
- set_atoms_and_funcs(atoms, coords)[source]
Initially atoms was also an argument to the constructor of AFIR. I removed it so creation becomes easier. The first time a calculation is requested with a proper atom set everything is set up (cov. radii, afir function and corresponding gradient). Afterwards there is only a check if atoms != None and it is expected that all functions are properly set.
fragment_indices can also be incomplete w.r.t. to the number of atoms. If the sum of the specified fragment atoms is less than the number of atoms present then all remaining unspecified atoms will be gathered in one fragment.
ONIOM
- class pysisyphus.calculators.ONIOMv2.LayerCalc(models, total_size, parent_layer_calc=None)[source]
Bases:
object
- property charge
- property mult
- class pysisyphus.calculators.ONIOMv2.Link(ind, parent_ind, atom, g)
Bases:
tuple
- atom
Alias for field number 2
- g
Alias for field number 3
- ind
Alias for field number 0
- parent_ind
Alias for field number 1
- class pysisyphus.calculators.ONIOMv2.Model(name, calc_level, calc, parent_name, parent_calc_level, parent_calc, atom_inds, parent_atom_inds, use_link_atoms=True)[source]
Bases:
object
- class pysisyphus.calculators.ONIOMv2.ONIOM(calcs, models, geom, layers=None, embedding='', real_key='real', use_link_atoms=True, *args, **kwargs)[source]
Bases:
Calculator
- __init__(calcs, models, geom, layers=None, embedding='', real_key='real', use_link_atoms=True, *args, **kwargs)[source]
- layer: list of models
len(layer) == 1: normal ONIOM, len(layer) >= 1: multicenter ONIOM.
- model:
(sub)set of all atoms that resides in a certain layer and has a certain calculator.
- atom_inds_in_layer(index, exclude_inner=False)[source]
Returns list of atom indices in layer at index.
Atoms that also appear in inner layer can be excluded on request.
- Parameters:
index (int) -- pasd
exclude_inner (bool, default=False, optional) -- Whether to exclude atom indices that also appear in inner layers.
- Returns:
atom_indices -- List containing the atom indices in the selected layer.
- Return type:
list
- property charge
- embeddings = {'': '', 'electronic': 'Electronic embedding', 'electronic_rc': 'Electronic embedding with redistributed charges', 'electronic_rcd': 'Electronic embedding with redistributed charges and dipoles'}
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property model_iter
- property mult
- pysisyphus.calculators.ONIOMv2.cap_fragment(atoms, coords, fragment, link_atom='H', g=None)[source]
Dimer
- class pysisyphus.calculators.Dimer.Dimer(calculator, *args, N_raw=None, length=0.0189, rotation_max_cycles=15, rotation_method='fourier', rotation_thresh=0.0001, rotation_tol=1, rotation_max_element=0.001, rotation_interpolate=True, rotation_disable=False, rotation_disable_pos_curv=True, rotation_remove_trans=True, trans_force_f_perp=True, bonds=None, N_hessian=None, bias_rotation=False, bias_translation=False, bias_gaussian_dot=0.1, seed=None, write_orientations=True, forward_hessian=True, **kwargs)[source]
Bases:
Calculator
- property C
Shortcut for the curvature.
- property N
- property can_bias_f0
- property can_bias_f1
- property coords0
- property coords1
- property energy0
- property f0
- property f1
- property f1_bias
- property f2
Never calculated explicitly, but estimated from f0 and f1.
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property rot_force
- property should_bias_f0
May lead to calculation of f0 and/or f1 if present!
- property should_bias_f1
May lead to calculation of f0 and/or f1 if present!
Pure Python calculators
Sympy 2D Potentials
- class pysisyphus.calculators.AnaPotBase.AnaPotBase(V_str, scale=1.0, xlim=(-1, 1), ylim=(-1, 1), levels=None, use_sympify=True, minima=None, saddles=None)[source]
Bases:
Calculator
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
Lennard-Jones
FakeASE
TIP3P
- class pysisyphus.calculators.TIP3P.TIP3P(rc=9.44863062728914)[source]
Bases:
Calculator
Transferable Intermolecular Potential 3 Point
- aHOH = 104.52
- charges
- coulomb_energy = (multiple of elem. charge * multiple of elem. charge)
/ (distance in bohr) * 1 / (4 * pi * vacuum permittivity)
coulomb_prefactor converts everything to atomic units and it is ... drum roll ... 1. from scipy.constants import value as pcval self.coulomb_prefactor = (1 / (4 * np.pi) * pcval("elementary charge")**2
/ pcval("Hartree energy") / pcval("Bohr radius") / pcval("vacuum electric permittivity")
)
- epsilon = 0.0002423919586315716
- qH = 0.417
- qO = -0.834
- rOH = 1.8088458464917874
- sigma = 5.953790025507198
Minimization
Searching for minimum energy geometries of molecules is preferably done using second order methods that employ hessian information. Using the plain hessian \(H\) for step prediction through \(p=-H^{-1}g\), with \(g\) being the gradient vector, may yield erroneous uphill steps when \(H\) has negative eigenvalues.
This can be understood by calculating the step in the basis of the hessian eigenvectors \(V\).
\(\tilde{H}, \tilde{g}\) and \(\tilde{p}\) are transformed into the eigenvector basis and the subscript \(i\) indicates the component belongs to the \(i\)-th eigenvalue (-vector) of \(H\). As the gradient always points into the direction of greater function values dividing it by a negative eigenvalues \(\tilde{H}_{ii}\) will lead to a step in uphill direction along the \(i\)-th eigenvector. The step in the original basis is obtained by a simple back-transformation:
A step in downhill direction can be ensured by introducing an appropriate shift parameter \(\lambda\) that must be smaller than the smallest eigenvalue of \(H\):
In pysisyphus the shift parameter \(\lambda\) is obtained by the Rational Function Optimization approach.
When the root-mean-square of the predicted step \(p\) drops below a certain threshold (default is 0.0025 au or rad) controlled GDIIS is tried. If GDIIS fails or is not yet possible a polynomial line-search is conducted. Using the latest two energies and the projection of the latest two gradients onto the last step the coefficients of a cubic polynomial are defined unambiguously. By requiring \(\mathrm{d}^2 f(x)/\mathrm{d}x^2 >= 0\) and the equality holding at exactly one point also a quartic polynomial can be determined.
For now line-searches using a cubic polynomial are disabled as they seem to degrade the optimizer performance, so only the constrained quartic polynomial is tried. By also using projected hessian information the coefficients of a quintic polynomial can be determined, but this also seems to be inferior compared to the constrained quartic polynomial.
Convergence is indicated when the root-mean-square and the maximum value of the gradient and step drop below a certain threshold. It is not uncommon that the gradient convergence is achieved before step convergence. By using overachieve_factor: [n, float > 1] in the YAML input convergence will be signalled, when gradient convergence is overachieved by factor n.
YAML Example
Below you can find an example YAML-input including the most important options that the user may want to modify when using the RFOptimizer.
opt:
type: rfo # Optimization algorithm
max_cycles: 50 # Maximum number of optimization cycles
overachieve_factor: 2 # Indicate convergence, regardless of the
# proposed step when max(grad) and rms(grad)
# are overachieved by factor [n]
do_hess: True # Calculate the hessian at the final geometry
# after the optimization.
#hessian_recalc: None # Recalculate exact hessian every n-th cylce
#hessian_recalc_adapt: None # Expects a float. Recalculate exact hessian
# whenever the gradient norms drops below
# 1/[n] of the gradient norm at the last hessian
# recalculation.
#hessian_init: fischer # Type of model hessian. Other options are: 'calc,
# simple, xtb, lindh, swart, unit'
#hessian_update: bfgs # Hessian-update. Other options are: 'flowchart,
# damped_bfgs, bofill'. bofill is not recommended
# for minimum searches.
#small_eigval_thresh: 1e-8 # Neglect eigenvalues and corresponding eigenvectors
# below this threshold.
#max_micro_cycles: 50 # No. of micro cycles for the RS-variants. Does not apply
# to TRIM.
#trust_radius: 0.3 # Initial trust radius.
#trust_max: 1.0 # Max. trust radius
#trust_min: 0.1 # Min. trust radius
#line_search: True # Do line search
#gdiis_thresh: 0.0025 # May do GDIIS if rms(step) falls below this threshold
#gediis_thresh: 0.01 # May do GEDIIS if rms(grad) falls below this threshold
#gdiis: True # Do controlled GDIIS after 'gdiis_thresh' is reached
#gediis: False # Do GEDIIS after 'gediis_thresh' is reached
calc:
type: turbomole
control_path: control_path_pbe0_def2svp_s1 # Path to the prepared calculation
track: True # Activate excited state tracking
ovlp_type: tden # Track with transition density matrix overlaps
charge: 0
mult: 1
pal: 4
mem: 2000
geom:
type: redund
fn: cytosin.xyz
Further examples for optimizations from .yaml input can be found here.
Convergence Thresholds
Optimization convergence is indicated when four critera are met. Each cycle the root-mean-square and the absolute maximum of force and proposed step vectors are checked. The default criteria in pysisyphus correspond to the opt=loose in Gaussian. Different thresholds can easily be requested by supplying the respective keyword in the YAML input.
Convergence is also indicated, when max(force) and rms(force) are overachieved, by a certain factor (overachieve_factor, default=3), similar to ORCAs optimizer. Further keywords, controlling the convergence check are found below.
opt:
...
thresh: gau_loose # See table below for different thresholds.
overachieve_factor: 3
rms_force: null # Derive four critera from this value
rms_force_only: False # Only check rms(force)
max_force_only: False # Only check max(force)
# Chain-of-States specific
coord_diff_thresh: 0.01 # Terminate on insignificant coordinate change
reparam_thresh: 0.001 # Terminate on insignificant coordinate change upon reparametrization
...
Threshold |
max(force) |
rms(forces) |
max(step) |
rms(step) |
Comment |
---|---|---|---|---|---|
gau_loose |
2.5e-3 |
1.7e-3 |
1.0e-2 |
6.7e-3 |
default |
gau |
4.5e-4 |
3.0e-4 |
1.8e-3 |
1.2e-3 |
|
gau_tight |
1.5e-5 |
1.0e-5 |
6.0e-5 |
4.0e-5 |
|
gau_vtight |
2.0e-6 |
1.0e-6 |
6.0e-6 |
4.0e-6 |
|
baker |
3.0e-4 |
2.0e-4 |
3.0e-4 |
2.0e-4 |
energy difference and step are also checked |
never |
2.0e-6 |
1.0e-6 |
6.0e-6 |
4.0e-6 |
dummy thresholds; never converges |
Available Optimizers
Base class for optimizers that utilize Hessian information.
- class pysisyphus.optimizers.Optimizer.ConvInfo(cur_cycle, energy_converged, max_force_converged, rms_force_converged, max_step_converged, rms_step_converged, desired_eigval_structure)[source]
Bases:
object
-
cur_cycle:
int
-
desired_eigval_structure:
bool
-
energy_converged:
bool
-
max_force_converged:
bool
-
max_step_converged:
bool
-
rms_force_converged:
bool
-
rms_step_converged:
bool
-
cur_cycle:
- class pysisyphus.optimizers.Optimizer.Optimizer(geometry, thresh='gau_loose', max_step=0.04, max_cycles=150, min_step_norm=1e-08, assert_min_step=True, rms_force=None, rms_force_only=False, max_force_only=False, force_only=False, converge_to_geom_rms_thresh=0.05, align=False, align_factor=1.0, dump=False, dump_restart=False, print_every=1, prefix='', reparam_thresh=0.001, reparam_check_rms=True, reparam_when='after', overachieve_factor=0.0, check_eigval_structure=False, restart_info=None, check_coord_diffs=True, coord_diff_thresh=0.01, fragments=None, monitor_frag_dists=0, out_dir='.', h5_fn='optimization.h5', h5_group_name='opt')[source]
Bases:
object
- __init__(geometry, thresh='gau_loose', max_step=0.04, max_cycles=150, min_step_norm=1e-08, assert_min_step=True, rms_force=None, rms_force_only=False, max_force_only=False, force_only=False, converge_to_geom_rms_thresh=0.05, align=False, align_factor=1.0, dump=False, dump_restart=False, print_every=1, prefix='', reparam_thresh=0.001, reparam_check_rms=True, reparam_when='after', overachieve_factor=0.0, check_eigval_structure=False, restart_info=None, check_coord_diffs=True, coord_diff_thresh=0.01, fragments=None, monitor_frag_dists=0, out_dir='.', h5_fn='optimization.h5', h5_group_name='opt')[source]
Optimizer baseclass. Meant to be subclassed.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.thresh (
Literal
['gau_loose'
,'gau'
,'gau_tight'
,'gau_vtight'
,'baker'
,'never'
], default:'gau_loose'
) -- Convergence threshold.max_step (
float
, default:0.04
) -- Maximum absolute component of the allowed step vector. Utilized in optimizers that don't support a trust region or line search.max_cycles (
int
, default:150
) -- Maximum number of allowed optimization cycles.min_step_norm (
float
, default:1e-08
) -- Minimum norm of an allowed step. If the step norm drops below this value a ZeroStepLength-exception is raised. The unit depends on the coordinate system of the supplied geometry.assert_min_step (
bool
, default:True
) -- Flag that controls whether the norm of the proposed step is check for being too small.rms_force (
Optional
[float
], default:None
) -- Root-mean-square of the force from which user-defined thresholds are derived. When 'rms_force' is given 'thresh' is ignored.rms_force_only (
bool
, default:False
) -- When set, convergence is signalled only based on rms(forces).max_force_only (
bool
, default:False
) -- When set, convergence is signalled only based on max(|forces|).force_only (
bool
, default:False
) -- When set, convergence is signalled only based on max(|forces|) and rms(forces).converge_to_geom_rms_thresh (
float
, default:0.05
) -- Threshold for the RMSD with another geometry. When the RMSD drops below this threshold convergence is signalled. Only used with Growing Newton trajectories.align (
bool
, default:False
) -- Flag that controls whether the geometry is aligned in every step onto the coordinates of the previous step. Must not be used with internal coordinates.align_factor (
float
, default:1.0
) -- Factor that controls the strength of the alignment. 1.0 means full alignment, 0.0 means no alignment. The factor mixes the rotation matrix of the alignment with the identity matrix.dump (
bool
, default:False
) -- Flag to control dumping/writing of optimization progress to the filesystemdump_restart (
bool
, default:False
) -- Flag to control whether restart information is dumped to the filesystem.print_every (
int
, default:1
) -- Report optimization progress every nth cycle.prefix (
str
, default:''
) -- Short string that is prepended to several files created by the optimizer. Allows distinguishing several optimizations carried out in the same directory.reparam_thresh (
float
, default:0.001
) -- Controls the minimal allowed similarity between coordinates after two successive reparametrizations. Convergence is signalled if the coordinates did not change significantly.reparam_check_rms (
bool
, default:True
) -- Whether to check for (too) similar coordinates after reparametrization.reparam_when (
Optional
[Literal
['before'
,'after'
]], default:'after'
) -- Reparametrize before or after calculating the step. Can also be turned off by setting it to None.overachieve_factor (
float
, default:0.0
) -- Signal convergence when max(forces) and rms(forces) fall below the chosen threshold, divided by this factor. Convergence of max(step) and rms(step) is ignored.check_eigval_structure (
bool
, default:False
) -- Check the eigenvalues of the modes we maximize along. Convergence requires them to be negative. Useful if TS searches are started from geometries close to a minimum.restart_info (default:
None
) -- Restart information. Undocumented.check_coord_diffs (
bool
, default:True
) -- Whether coordinates of chain-of-sates images are checked for being too similar.coord_diff_thresh (
float
, default:0.01
) -- Unitless threshold for similary checking of COS image coordinates. The first image is assigned 0, the last image is assigned to 1.fragments (
Optional
[Tuple
], default:None
) -- Tuple of lists containing atom indices, defining two fragments.monitor_frag_dists (
int
, default:0
) -- Monitor fragment distances for N cycles. The optimization is terminated when the interfragment distances falls below the initial value after N cycles.out_dir (
str
, default:'.'
) -- String poiting to a directory where optimization progress is dumped.h5_fn (
str
, default:'optimization.h5'
) -- Basename of the HDF5 file used for dumping.h5_group_name (
str
, default:'opt'
) -- Groupname used for dumping of this optimization.
- check_convergence(step=None, multiple=1.0, overachieve_factor=None)[source]
Check if the current convergence of the optimization is equal to or below the required thresholds, or a multiple thereof. The latter may be used in initiating the climbing image.
- class pysisyphus.optimizers.HessianOptimizer.HessianOptimizer(geometry, trust_radius=0.5, trust_update=True, trust_min=0.1, trust_max=1, max_energy_incr=None, hessian_update='bfgs', hessian_init='fischer', hessian_recalc=None, hessian_recalc_adapt=None, hessian_xtb=False, hessian_recalc_reset=False, small_eigval_thresh=1e-08, line_search=False, alpha0=1.0, max_micro_cycles=25, rfo_overlaps=False, **kwargs)[source]
Bases:
Optimizer
- __init__(geometry, trust_radius=0.5, trust_update=True, trust_min=0.1, trust_max=1, max_energy_incr=None, hessian_update='bfgs', hessian_init='fischer', hessian_recalc=None, hessian_recalc_adapt=None, hessian_xtb=False, hessian_recalc_reset=False, small_eigval_thresh=1e-08, line_search=False, alpha0=1.0, max_micro_cycles=25, rfo_overlaps=False, **kwargs)[source]
Baseclass for optimizers utilizing Hessian information.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.trust_radius (
float
, default:0.5
) -- Initial trust radius in whatever unit the optimization is carried out.trust_update (
bool
, default:True
) -- Whether to update the trust radius throughout the optimization.trust_min (
float
, default:0.1
) -- Minimum trust radius.trust_max (
float
, default:1
) -- Maximum trust radius.max_energy_incr (
Optional
[float
], default:None
) -- Maximum allowed energy increased after a faulty step. Optimization is aborted when the threshold is exceeded.hessian_update (
Literal
['none'
,None
,False
,'bfgs'
,'damped_bfgs'
,'flowchart'
,'bofill'
,'ts_bfgs'
,'ts_bfgs_org'
,'ts_bfgs_rev'
], default:'bfgs'
) -- Type of Hessian update. Defaults to BFGS for minimizations and Bofill for saddle point searches.hessian_init (
Literal
['calc'
,'unit'
,'fischer'
,'lindh'
,'simple'
,'swart'
,'xtb'
,'xtb1'
,'xtbff'
], default:'fischer'
) -- Type of initial model Hessian.hessian_recalc (
Optional
[int
], default:None
) -- Recalculate exact Hessian every n-th cycle instead of updating it.hessian_recalc_adapt (
Optional
[float
], default:None
) -- Use a more flexible scheme to determine Hessian recalculation. Undocumented.hessian_xtb (
bool
, default:False
) -- Recalculate the Hessian at the GFN2-XTB level of theory.hessian_recalc_reset (
bool
, default:False
) -- Whether to skip Hessian recalculation after reset. Undocumented.small_eigval_thresh (
float
, default:1e-08
) -- Threshold for small eigenvalues. Eigenvectors belonging to eigenvalues below this threshold are discardewd.line_search (
bool
, default:False
) -- Whether to carry out a line search. Not implemented by a subclassing optimizers.alpha0 (
float
, default:1.0
) -- Initial alpha for restricted-step (RS) procedure.max_micro_cycles (
int
, default:25
) -- Maximum number of RS iterations.rfo_overlaps (
bool
, default:False
) -- Enable mode-following in RS procedure.**kwargs -- Keyword arguments passed to the Optimizer baseclass.
- get_newton_step_on_trust(eigvals, eigvecs, gradient, transform=True)[source]
Step on trust-radius.
See Nocedal 4.3 Iterative solutions of the subproblem
- housekeeping()[source]
Calculate gradient and energy. Update trust radius and hessian if needed. Return energy, gradient and hessian for the current cycle.
- property prev_eigvec_max
- property prev_eigvec_min
- rfo_dict = {'max': (-1, 'max'), 'min': (0, 'min')}
- class pysisyphus.optimizers.RFOptimizer.RFOptimizer(geometry, line_search=True, gediis=False, gdiis=True, gdiis_thresh=0.0025, gediis_thresh=0.01, gdiis_test_direction=True, max_micro_cycles=25, adapt_step_func=False, **kwargs)[source]
Bases:
HessianOptimizer
- __init__(geometry, line_search=True, gediis=False, gdiis=True, gdiis_thresh=0.0025, gediis_thresh=0.01, gdiis_test_direction=True, max_micro_cycles=25, adapt_step_func=False, **kwargs)[source]
Rational function Optimizer.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.line_search (
bool
, default:True
) -- Whether to carry out implicit line searches.gediis (
bool
, default:False
) -- Whether to enable GEDIIS.gdiis (
bool
, default:True
) -- Whether to enable GDIIS.gdiis_thresh (
float
, default:0.0025
) -- Threshold for rms(forces) to enable GDIIS.gediis_thresh (
float
, default:0.01
) -- Threshold for rms(step) to enable GEDIIS.gdiis_test_direction (
bool
, default:True
) -- Whether to the overlap of the RFO step and the GDIIS step.max_micro_cycles (
int
, default:25
) -- Number of restricted-step microcycles. Disabled by default.adapt_step_func (
bool
, default:False
) -- Whether to switch between shifted Newton and RFO-steps.**kwargs -- Keyword arguments passed to the Optimizer/HessianOptimizer baseclass.
Minimization with Microiterations
Pysisyphus allows layered optimizations using microiterations via the LayerOpt class. Required energies and its derivatives (gradients, Hessians) can either be calculated with pysisyphus' own ONIOM implementation or supplied through Unix sockets via the i-PI protocol.
In ONIOM calculations a small (model) system is treated using a high level of theory, while its surroundings (real system) are described at a lower, more economic level of theory. There may also be several (optional) intermediate layers. Please see the figure below.
General structure of a n-layer ONIOM calculation in pysisyphus. Every box corresponds to a layer. Indices of the respective layers are given as red numbers in the top right corner of each layer.
Searching stationary points of such systems using classical optimization approaches with simultanous relaxation of model and real system can be computationally quite costly. In cases where the model system converges before the real system, many unnecessary model system energy and gradients evaluations may be required to fully relax the total system, as one step requires gradient evaluations in all layers. Also, it may be prohibitively expensive to optimize the whole system using internal coordinates, so it would be desireable to treat only the model system using internal coordinates.
Optimization with microiterations offers a way to potentially reduce the number of costly calculations in the innermost layer. By fully relaxing the outer layers before taking a step in the innermost layer, superfluous gradient evaluations can be avoided. As the overall calculation time of an ONIOM energy/gradient is usually dominated by the innermost layer, great compuational saving can by realized by decreasing the required number of such calculations.
In the present approach, outer layers are optimized in Cartesian coordinates with an economic optimizer like (preconditioned) limited memory BFGS (L-BFGS) or conjugate gradient (CG). As L-BFGS avoids operations with steep scaling costs like matrix diagonalization, relaxation of large system comprising thousands of atoms becomes possible with negligible computational overhead. In contrast to the outer layers, the inner layer is usually optimized using internal coordinates and an optimizer that utilizes an explicit Hessian matrix, as this often allows for the most efficient optimizations.
As energy and gradient evaluations in the outer layers should be cheap the inferior performance of optimizations in Cartesian coordinates should not lead to an overall runtime increase.
YAML input
When pysisyphus' native ONIOM calculator is to be used, appropriate input has to be
given in the calc:
section, that is, layer composition and the respective calculators.
If energies & gradients are sent via sockets and the i-PI-protocol calc:
can be
left empty but the appropriate socket addresses have to specified later in the opt:
section (see below). A separate socket/address is required for each layer.
Independent of the actual layer, pysisyphus always expects vectorial quantities with
appropriate shapes of the total system. The expected size of a force vector for a
system comprising N
atoms is 3N
. Vector components not belonging to frozen
atoms not belonging to a given layer are ignored and may be zero. It is expected,
that the full valid ONIOM forces for the total system are sent with the innermost layer.
These forces are then also used to check for optimization convergence.
A layered optimization is requested via type: layer
in the opt:
section. If
no further input is given, appropriate defaults will be used.
Micoiterations for the outer layers 0 to n-2
will be carried out using Cartesian
coordinates and regularized L-BFGS, while the innermost layer is optimized in internal
coordinates (type: tric
) using rational function optimization (type: rfo
).
If a more fine grained control is desired each layer can be controlled independently
by further keywords in the layers:
list.
When layers:
is present in the input all
layers must be specified, but empty list entries are possible (see the lines
only containing a comment in the example below).
One must start with the outmost layer; the last list item
corresponds to the innermost layer.
Geometry and/or optimizer setup of each layer is controlled by the geom:
and opt:
sections in the list of layers with the usual keywords.
The usual keywords to control the optimization are supported, e.g., max_cycles
,
thresh
etc.
geom:
type:
cartesian
fn: [filename of initial geometry]
calc:
type:
oniom:
...
opt:
type:
layer:
[layers:
- # dummy for layer 0 (real system)
- # dummy for layer 1 layer
- # ...
# - # dummy for layer n-1 (model system)
- geom:
type:
cartesian:
opt:
type:
lbfgs:
]
# thresh: gau_loose
# max_cycles: 150
Below you can find a full example for the ONIOM2-optimization of Hexaphenylethane using pysisyphus' ONIOM implementation.
Example using pysisyphus' ONIOM
# 2-layer ONIOM optimization of Hexaphenylethan. The model
# system comprises the two carbons of the central ethan moiety.
# The model system is described GFN2-XTB while the real system is
# treated using GFN-FF.
geom:
type: cart
fn: |
68
C 1.2639 0.6380 0.4785
C 2.1638 1.9009 0.1349
C 2.4167 2.3403 -1.2006
C 3.2096 3.4576 -1.4755
C 2.7467 2.7036 1.1595
C 3.5368 3.8191 0.8739
C 3.7741 4.1922 -0.4416
H 2.0100 1.8572 -2.0700
H 3.3815 3.7580 -2.5014
H 2.5944 2.5089 2.1979
H 3.9618 4.4009 1.6820
H 4.3848 5.0587 -0.6598
C 0.7891 0.0052 -0.8980
C -1.0360 -0.5225 -2.5243
C -0.0432 -1.1375 -3.4197
C 1.2448 -1.1452 -3.0690
C -0.6577 0.0144 -1.3528
H -1.4492 0.4671 -0.7765
H -2.0793 -0.4955 -2.8238
H -0.3570 -1.5703 -4.3642
C 1.6732 -0.5526 -1.7810
H 1.9838 -1.5872 -3.7297
H 2.7287 -0.5813 -1.6050
C -0.0387 1.1726 1.2081
C -0.2929 2.5599 1.4341
C -1.0635 0.2863 1.6524
C -2.2174 0.7426 2.2933
C -2.4082 2.0998 2.5118
C -1.4505 3.0060 2.0772
H 0.3724 3.3423 1.1178
H -1.0153 -0.7691 1.5014
H -2.9711 0.0356 2.6161
H -1.6065 4.0659 2.2335
H -3.3046 2.4506 3.0066
C 2.1016 -0.4883 1.4312
C 3.4003 -1.0269 0.6933
C 4.4239 -0.1425 0.2420
C 5.5730 -0.6012 -0.4056
C 3.6509 -2.4147 0.4669
C 4.8038 -2.8631 -0.1829
C 5.7602 -1.9589 -0.6243
H 4.3778 0.9134 0.3928
H 6.3259 0.1044 -0.7337
H 2.9864 -3.1958 0.7882
H 4.9572 -3.9235 -0.3393
H 6.6530 -2.3115 -1.1243
C 2.5704 0.1468 2.8077
C 4.3159 0.7126 4.4630
C 3.3714 1.2844 5.3047
C 2.0334 1.2840 4.9354
C 3.9303 0.1495 3.2436
H 4.7333 -0.2864 2.6778
H 5.3575 0.6988 4.7582
H 3.6749 1.7164 6.2495
C 1.6376 0.7248 3.7185
H 1.2932 1.7141 5.5981
H 0.5868 0.7426 3.5290
C 1.2016 -1.7498 1.7785
C 0.9537 -2.1874 3.1154
C 0.6140 -2.5534 0.7571
C -0.1758 -3.6680 1.0474
C -0.4081 -4.0392 2.3643
C 0.1611 -3.3038 3.3950
H 1.3648 -1.7032 3.9822
H 0.7614 -2.3600 -0.2822
H -0.6047 -4.2504 0.2418
H -0.0069 -3.6027 4.4220
H -1.0186 -4.9050 2.5861
calc:
type: oniom
calcs:
real:
type: xtb
gfn: ff
pal: 6
high:
type: xtb
pal: 6
models:
# The "real" does not have to be described, only the "real" system.
high:
# Use ethan-carbons for the model system
inds: [0,34]
# Use appropriate calculator for model system.
calc: high
opt:
# Use LayerOpt
type: layers
thresh: gau
# When the 'layer' key is present, the user has to provide one
# entry per layer in the optimization. When the layer is empty default
# values are used. The layers are given from the outmost to the innermost
# layer.
# In the example above no other arguments for the outmost layer (# real dummy),
# while redundant internal coordinates are used for the innermost layer.
#
# When pysisyphus own ONIOM implementation is used no additional atom indices
# must be given here.
layers:
- # real dummy
- geom:
type: redund
do_hess: True
Example with sockets & i-PI-protocol
Whereas pysisyphus can figure out the layer composition for the microcycles when its own
ONIOM calculator is used, the user has to specify it when using sockets and the i-PI-protocol.
When covalent bonds between layers exist link atoms (LAs) must be introduced. Given a
layer with index n
, atoms in layer n-1
that are replaced by LAs in the given layer
are called link atom hosts (LAH). A given layer and its LAHs in higher layers must
be optimized together.
Layer structure of a ONIOM2 optimization using microiterations with link atoms. A given layer as well as connected link atom hosts in higher layers must be optimized simultaneously.
A simple example for a ONIOM2 optimization with microiterations is found below. Here, ethanal is optimized, with the model system comprising the carbonyl group (atoms 4, 5 and 6). This introduces a link atom between the two carbons 4 and 0, with carbon 0 becoming a LAH.
ONIOM2 optimization of ethanal. All atoms surrounded by the dashed blue line are optimized in the innermost layer. Hydrogens are shown white, carbons grey and oxygen red.
In contrast to the first example using the native ONIOM implementation the user
can omit any input in the calc:
section. Now the socket addresses have to given
for every layer, starting with the total system. For the total system the atom indices can
be omitted, as it is assumed that it comprises all atoms. For the remaining layers,
the indices of all moving atmos including LAHs in higher layers have to be given.
geom:
type: cartesian
fn: lib:acetaldehyd_oniom.xyz
calc:
opt:
type: layers
layers:
# Atom indices of the total system / (first layer) don't have to be
# specified.
- address: ./layer0sock
# Optimize atoms of the model system [4, 5, 6] and the link atom host 0.
- indices: [0,4,5,6]
address: ./layer1sock
thresh: gau
# The assert: section can be left out in actual inputs,
# it is here for testing purposes.
assert:
opt_geom.energy: -115.53522653
Another sensible choice for optimizing outer layers besides (regularized) L-BFGS may be preconditioned L-BFGS (type: plbfgs).
- class pysisyphus.optimizers.LayerOpt.LayerOpt(geometry, layers=None, **kwargs)[source]
Bases:
Optimizer
- check_convergence(*args, **kwargs)[source]
Check if we must use the model optimizer to signal convergence.
- property layer_num: int
- property model_opt
Return the persistent optimizer belonging to the model system. We don't have to supply any coordinates to the optimizer of the most expensive layer, as it is persistent, as well as the associated geometry.
- class pysisyphus.optimizers.LayerOpt.Layers(geometry, opt_thresh, layers=None)[source]
Bases:
object
- class pysisyphus.optimizers.LBFGS.LBFGS(geometry, keep_last=7, beta=1, max_step=0.2, double_damp=True, gamma_mult=False, line_search=False, mu_reg=None, max_mu_reg_adaptions=10, control_step=True, **kwargs)[source]
Bases:
Optimizer
- __init__(geometry, keep_last=7, beta=1, max_step=0.2, double_damp=True, gamma_mult=False, line_search=False, mu_reg=None, max_mu_reg_adaptions=10, control_step=True, **kwargs)[source]
Limited-memory BFGS optimizer.
See [1] Nocedal, Wright - Numerical Optimization, 2006 for a general discussion of LBFGS. See pysisyphus.optimizers.hessian_updates for the references related to double damping and pysisyphus.optimizers.closures for references related to regularized LBFGS.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.keep_last (
int
, default:7
) -- History size. Keep last 'keep_last' steps and gradient differences.beta (
float
, default:1
) -- Force constant β in -(H + βI)⁻¹g.max_step (
float
, default:0.2
) -- Upper limit for the absolute component of the step vector in whatever unit the optimization is carried out.double_damp (
bool
, default:True
) -- Use double damping procedure to modify steps s and gradient differences y to ensure sy > 0.gamma_mult (
bool
, default:False
) -- Estimate β from previous cycle. Eq. (7.20) in [1]. See 'beta' argument.line_search (
bool
, default:False
) -- Enable implicit linesearches.mu_reg (
Optional
[float
], default:None
) -- Initial guess for regularization constant in regularized LBFGS.max_mu_reg_adaptions (
int
, default:10
) -- Maximum number of trial steps in regularized LBFGS.control_step (
bool
, default:True
) -- Wheter to scale down the proposed step its biggest absolute component is equal to or below 'max_step'**kwargs -- Keyword arguments passed to the Optimizer baseclass.
- class pysisyphus.optimizers.PreconLBFGS.PreconLBFGS(geometry, alpha_init=1.0, history=7, precon=True, precon_update=1, precon_getter_update=None, precon_kind='full', max_step_element=None, line_search='armijo', c_stab=None, **kwargs)[source]
Bases:
Optimizer
- __init__(geometry, alpha_init=1.0, history=7, precon=True, precon_update=1, precon_getter_update=None, precon_kind='full', max_step_element=None, line_search='armijo', c_stab=None, **kwargs)[source]
Preconditioned limited-memory BFGS optimizer.
See pysisyphus.optimizers.precon for related references.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.alpha_init (
float
, default:1.0
) -- Initial scaling factor for the first trial step in the excplicit line search.history (
int
, default:7
) -- History size. Keep last 'history' steps and gradient differences.precon (
bool
, default:True
) -- Wheter to use preconditioning or not.precon_update (
int
, default:1
) -- Recalculate preconditioner P in every n-th cycle with the same topology.precon_getter_update (
Optional
[int
], default:None
) -- Recalculate topology for preconditioner P in every n-th cycle. It is usually sufficient to only determine the topology once at the beginning.precon_kind (
Literal
['full'
,'full_fast'
,'bonds'
,'bonds_bends'
], default:'full'
) -- What types of primitive internal coordinates to consider in the preconditioner.max_step_element (
Optional
[float
], default:None
) -- Maximum component of the absolute step vector when no line search is carried out.line_search (
Literal
['armijo'
,'armijo_fg'
,'strong_wolfe'
,'hz'
,None
,False
], default:'armijo'
) -- Whether to use explicit line searches and if so, which kind of line search.c_stab (
Optional
[float
], default:None
) -- Regularization constant c in (H + cI)⁻¹ in atomic units.**kwargs -- Keyword arguments passed to the Optimizer baseclass.
Relaxed Scans
Pysisyphus currently supports 1d-relaxed scans, where one internal coordinate is kept frozen, while the remaining ones are relaxed. A sample input is given below.
geom:
type: redund
fn: lib:h2o2_hf_321g_opt.xyz
calc:
type: pyscf
basis: 321g
pal: 4
scan:
type: BOND
indices: [2, 3]
# start is optional; if not specified the initial value of the primitive
# internal coordinate is used.
start: 3.0
end: 5.0
# steps is optional and can be omitted, but then step_size must be given
steps: 5
# step_size: 0.4
# Enable symmetric scan in both directions, starting from the initial coordinates
# symmetric: False
#
# By specifying an 'opt' block, the default optimization values, e.g.
# convergence thresholds can be altered.
# opt:
# thresh: gau
If no start value is specified in the scan: block, then the initial value is used. Specification of steps is mandatory, as it determines the number of optimizations to carry out. If not directly given (step_size), a suitable step size is derived from an end value. Either end or step_size must be given.
The values step_size, start, end have to be provided in atomic units or radians. When the appropriate YAML constructor is used, inputs can still be in Ångström or degrees. The constructor !angstrom converts input in Ångström to Bohr and !deg converts input from degrees to radians. See below for an example.
[...]
scan:
type: DIHEDRAL
indices: [0, 1, 2, 3]
steps: 5
step_size: !deg 10.
[...]
In the example above, a relaxed scan around a torsion is carried out. In total, 5 steps of 10 degree each will be taken. By using the YAML constructor !deg, the input can be given in degrees, instead of radians. Internally, the degrees input is then converted to the appropriate unit, in this case radians.
Naive relaxed scan around the equilibrium value of a primitive internal may be affected by hysteresis, if the system under study is sufficiently complicated.
Relaxed scans are always carried out in redundant internal coordinates. Please see Optimization of Minima for the available optimization options. Supported primitive internals (type) are found in: Types of Primitive Coordinates.
All geometries, including the initial one are written to relaxed_scan.trj in the current working directory.
Excited State Optimization
pysisyphus offers excited state (ES) tracking, to follow diadiabatic states along an optimization. ES tracking is enabled by putting track: True in the calc section of your YAML input. In ES optimizations pysisyphus may use additional programs (wfoverlap, Multiwfn, jmol) if requested. Please see the installation instructions for information on how to set them up.
Please consider reading the relevant sections (2 and 3; 4 discusses examples) of
the pysisyphus paper.
Additionally the user should think about the relevance between equilibrium/non-equilibrium
solvation when calculating ES-gradients with implicit solvation. Serveral programs,
e.g., Gaussian use equilibrium solvation when doing ES-optimization. It is in the
responsibility of the user to add the relevant keywords when using pysisyphus, e.g.,
EqSolv
for Gaussian.
YAML Example
A bare-bone input for the S1 optimization of the 1H-amino-keto tautomer of cytosin at the TD-DFT/PBE0/def2-SVP level of theory using ORCA is shown below. The full example is found here.
opt:
calc:
type: orca
keywords: pbe0 def2-svp rijcosx def2/J def2-svp/C
# Calculate 2 ES by TD-DFT, follow the first one
blocks: "%tddft nroots 2 iroot 1 tda false end"
charge: 0
mult: 1
pal: 4
mem: 2000
# ES-tracking related keywords follow from here
# Enable ES-tracking, this is important.
track: True
# Track ES by transition density overlaps
ovlp_type: tden
geom:
type: redund
fn: cytosin.xyz
Additional keywords are possible in the calc section. The default values are shown below.
calc:
# Controls calculation of charge-density-differences cubes and rendering
# Cubes are calcualted by Multiwfn, rendering is handled by jmol.
#
# Possible values are: (None, calc, render).
# None: No cube calculation/rendering
# calc: Cube calculation by Multiwfn.
# render: Same as 'calc' and cubes are then rendered by jmol.
cdds: None
# Overlap type. Using 'wf' requires the external wfoverlap binary. The remaining
# options are implemented directly in pysisyphus.
#
# Possible values are (wf, tden, nto, nto_org).
# wf: Wavefunction overlaps using the external wfoverlap program.
# tden: Transition density matrix overlaps.
# nto: Natural transition orbital overlaps.
# nto_org: Natural transition orbital overlaps as described by García.
# top: Transition orbital projection
ovlp_type: wf
# Controls the reference cycle that is used in the overlap calculation. The default
# 'adapt' is recommended.
#
# Possible values are (first, previous, adapt)
# first: Keep first calculation as reference cycle. Reliable when only minor
# geometrical changes are expected.
# previous: Use previous cycle as reference.
# adapat: Use adaptive algorithm. Please see the pysisyphus paper for a discussion
# at the end of section 3.
ovlp_with: adapt
# Thresholds controlling the update of the reference cycle.
# The first number specifies the minimum overlap that must be exceeded, for an update
# of the reference cycle. Assuming a value of 0.5 (50 %), the reference cycle update
# is skipped, if the overlaps between the current states and the reference state don't
# exceed 50 %.
# The last two numbers define an interval for the ratio between the second highest
# overlap, and the highest overlap. If the ratio is small, e.g., below 0.3, then both
# states are sufficiently different, and no reference cycle update is needed. If the ratio
# is bigger (> 0.6), then the states are quite similar, and an update is currently not
# advised.
# Possible values [three positive floats between 0. and 1.]
adapt_args: [0.5, 0.3, 0.6]
# Explicitly calculate the AO-overlap matrix in a double molecule calculation. Only
# supported by Turbomole and Gaussian calculators. If False, the approximate AO
# overlap matrix is reconstructed from inverting the MO-coefficient matrix.
#
# Possible values: (True, False)
double_mol: False
# Absolute CI-coefficients below this threshold are ignored in the overlap calculation.
#
# Possible values: positive float
conf_thresh: 0.0001
#
# nto/natural transition orbital specific
#
# Number of NTOs to consider in the overlap calculation. Only relevant for 'nto'
# and 'nto_org' ovlp_types.
#
# Possible values: positive integer
use_ntos: 4
# Dynamically decide on number of NTOs according to their participation ratio. Only
# relevant for 'nto_org'
#
# Possible values: boolean
pr_nto: False
#
# wfoverlap/wavefunction overlaps specific
#
# Number of core orbitals to neglect in a wfoverlap calculation. Only relevant
# for the 'wf' ovlp_type. Must be >= 0.
#
# Possible values: positive integer
ncore: 0
#
# tden/transition density matrix specific
#
# Controls which set of MO coefficients (at current cycle, or the reference cycle)
# is used to recover the AO overlap matrix.
#
# Possible values: (ref, cur)
mos_ref: cur
# Controls whether the set of MO coefficents that was NOT used for recovering the AO
# overlap matrix is re-normalized, using the recovered AO overlap matrix. If set to
# True and mos_ref = cur, then the MO coefficients at the reference cycle will be re-
# normalized, and vice versa.
#
# Possible values: (True, False)
mos_renorm: True
By brief reasoning it would seem that mos_ref: ref
and mos_renorm: True
are
more sensible choices, which is possibly true. Right now the present defaults are kept for
legacy reasons, and I'll update them after testing out the alternatives.
Please also see Example - Excited State Tracking for possible visualizations when optimizing ES.
Optimization of Conical Intersections
pysisyphus implements the projected gradient method using an updated branching plane, as developed by Maede, Ohno and Morokuma. Currently, CI-optimization is not enabled for YAML input. An illustrative example is found in tests/test_conic_intersect.
Chain Of States Methods
A chain of states (COS) comprises a set of distinct states (images) and is usually spanned between two minima on a potential energy surface (PES).
When properly relaxed, a COS coincides with a minimum energy path (MEP), or is a good approximation to it. Tangents can be defined for every COS image and together they make up a discretized path that describes the reaction/chemical transformation. The tangents are also used to divide the COS gradient into perpendicular and parallel components, w.r.t the tangents. Relaxation (optimization) of the COS is achieved by minimizing the perpendicular component of the gradient, so only the parallel component remains.
pysisyphus offers different COS implementations, namely Nudged Elasic Band (NEB), including its Adaptive and Free-End (and Free-End-Adaptive) modificiations and different flavors of String methods (Growing String Method, GSM, and Simple Zero Temperature String, SZTS). The GSM implementation is also available for with internal coordinates.
String method
(When discussing String methods the COS 'images' are usually called 'nodes'.)
In the string method the whole COS is periodically (every n-th cycle) reparametrized by fitting a spline through all nodes and redistributing the nodes them along the spline, according to a predefined parametrization. By choosing between different parametrizations equal node spacing or higher resolution around the highest energy image (HEI) can be achieved. The tangents needed for the gradient projection are obtained as first derivatives of the spline.
Reparametrization every \(n\)-th cycle impedes efficient string optimization, and prevents the use of optimizers with some kind of history Conjugate Gradient (CG). The optimizer history is reset after each reparametrization and a simple Steepest Descent (SD) step is done after reparametrization.
Nudged Elastic Band
No reparametrization takes place in the NEB method. The parallel gradient component along the tangent is projected out and replaced by an artificial spring force. In principle, optimizing NEBs should be easier as there is no reparametrization and more sophisticated optimizers beyond SD can and should be employed.
General remarks
Converged COS produce good guesses for subsequent TS searches, when the (splined) HEI is determined. In pysisyphus subsequent TS searches are easily started by including tsopt: in the YAML input. Knowledge of the initial and final images of the COS is used to construct a more complete set of internal coordinates for the TS guess and it is less likely that important coordinates are missed. The initial imaginary mode to follow uphill is selected as the one featuring the highest overlap with HEI tangent.
YAML example(s)
Below you can find an example YAML-input including the most important options that the user may want to modify when running a GSM optimization.
precontr: # Preconditioning of translation & rotation
preopt: # Preoptimize inital and final geometry
cos:
type: gs # Do a growing string
max_nodes: 9 # Total string will have 9 + 2 == 11 images
climb: False # Enable climbing image (CI), usually a good idea.
climb_rms: 0.005 # rms(forces) threshold for enabling CI
climb_lanczos: False # Use tangent obtained from Lanczos algorithm for CI.
climb_lanczos_rms: 0.005 # rms(forces) threshold for enabling Lanczos algorithm.
reparam_check: rms # Criterian for growing new frontier nodes (rms/norm).
perp_thresh: 0.05 # Threshold for growing new frontier nodes.
reparam_every: 2 # Reparametrize every n-th cycle when NOT fully grown.
reparam_every_full: 3 # Reparametrize every n-th cycle when fully grown.
opt:
type: string # Optimizer for GrowingString
stop_in_when_full: -1 # Stop string optimization N cycles after fully grown
# Disabled by -1. Usually it's a better idea to
# further converge the string, after is fully grown.
align: False # Disable Kabsch algorithm. Should be True with
# type: cart
scale_step: global # Scale down step as whole (global) or per image
# (per_image)
tsopt:
type: rsprfo # Continue with TS-optimization of highest energy images
# (HEI) using the RS-P-RFO algorithm
do_hess: True # Calculate hessian at optimized TS geometry
trust_max: 0.3
thresh: gau_loose
calc:
type: orca
keywords: "b3lyp 6-31G* rijcosx"
pal: 4
charge: 0
mult: 1
geom:
type: dlc
fn: [first_preopt.xyz, last_preopt.xyz] # Run GrowingString in delocalized internal coordinates
# (preferred).
For NEB optimizations a different optimizer (not type: string
) should be used, e.g.,
QuickMin type: qm
in the beginning, and type: lbfgs
later on. It is not
yet possible to specify two different optimizers that are used in stages, so if is
desired it must be done manually.
# Taken from examples/complex/06_diels_alder...
geom:
type: cart
fn: diels_alder.trj
calc:
type: xtb
charge: 0
mult: 1
pal: 4
preopt:
max_cycles: 5
interpol: # In NEBs the whole path is interpolated beforehand.
type: redund # Possible values: redund|idpp|lst|linear
between: 10 # Interpolate n-geometries between every pair of supplied
# geometries. For two this yields 1 + 10 + 1 == 12 images,
# for three geometries this yields 1 + 10 + 1 + 10 + 1 == 23
# geometries.
cos:
type: neb
climb: False
align_fixed: True # Align the fixed atoms of the initial and final images along the path.
opt:
type: lbfgs
align: True # Align the image of the current step with the image of the previous step
align_factor: 0.9 # If full alignment is not desired, a factor between 0 and 1
# can be specified.
rms_force: 0.01
max_step: 0.04
tsopt:
type: rsirfo
do_hess: True
max_cycles: 75
thresh: gau_tight
hessian_recalc: 7
irc:
type: eulerpc
rms_grad_thresh: 0.0005
endopt:
Further examples for COS optimizations from .yaml input can be found here.
General advice for COS optimizations
Start from optimized geometries or use the preopt: key in the YAML input.
Consider fixing the initial and final images fix_ends: True
Always use align: True when optimizing a COS in cartesian coordinates to remove translation and rotation. align: True must not be used when running a COS with DLC.
Don't over-converge a COS. It is usually a better idea to converge a COS loosely and use the highest energy image (HEI) as a guess for a subsequent transition state (TS) search.
If possible use a climbing image (CI) climb: True
When running a growing string calculation (type: gs) use stop_in_when_full: [n] in the opt: section with a small integer [n] to stop the COS relaxation after the string is fully grown
Chain Of States base class
Base class for chain of state methods
- class pysisyphus.cos.ChainOfStates.ChainOfStates(images, fix_first=True, fix_last=True, align_fixed=True, climb=False, climb_rms=0.005, climb_lanczos=False, climb_lanczos_rms=0.005, climb_fixed=True, energy_min_mix=False, scheduler=None, progress=False)[source]
-
- property atoms
- property calculator
- property cart_coords
Return a flat 1d array containing the cartesian coordinates of all images.
- property coords
Return a flat 1d array containing the coordinates of all images.
- property coords3d
- property energy
- property forces
- get_tangent(i, kind='upwinding', lanczos_guess=None, disable_lanczos=False)[source]
[1] Equations (8) - (11)
- property gradient
- property image_coords
- property image_inds
- property last_index
- logger = <Logger cos (DEBUG)>
- property masses_rep
- property max_image_num
- property moving_images
- property moving_indices
Returns the indices of the images that aren't fixed and can be optimized.
- property perpendicular_forces
- prepare_opt_cycle(last_coords, last_energies, last_forces)[source]
Implements additional logic in preparation of the next optimization cycle.
Should be called by the optimizer at the beginning of a new optimization cycle. Can be used to implement additional logic as needed for AdaptiveNEB etc.
- property results
- rms(arr)[source]
Root mean square
Returns the root mean square of the given array.
- Parameters:
arr (iterable of numbers)
- Returns:
rms -- Root mean square of the given array.
- Return type:
float
- set_coords_at(i, coords)[source]
Called from helpers.procrustes with cartesian coordinates. Then tries to set cartesian coordinate as self.images[i].coords which will raise an error when coord_type != "cart".
- set_zero_forces_for_fixed_images()[source]
This is always done in cartesian coordinates, independent of the actual coord_type of the images as setting forces only work with cartesian forces.
- valid_coord_types = ('cart', 'cartesian', 'dlc')
Chain Of State Methods
Nudged Elastic Band (NEB)
- class pysisyphus.cos.NEB.NEB(images, variable_springs=False, k_max=0.3, k_min=0.1, perp_spring_forces=None, bandwidth=None, **kwargs)[source]
Bases:
ChainOfStates
- property forces
- property parallel_forces
Adaptive NEB
- class pysisyphus.cos.AdaptiveNEB.AdaptiveNEB(images, adapt=True, adapt_fact=0.25, adapt_between=1, scale_fact=False, keep_hei=True, free_ends=True, **kwargs)[source]
Bases:
NEB
- __init__(images, adapt=True, adapt_fact=0.25, adapt_between=1, scale_fact=False, keep_hei=True, free_ends=True, **kwargs)[source]
(Free-End) Adaptive Nudged Elastic Band.
- Parameters:
images (list of Geometry objects) -- Images of the band.
adapt (bool, default True) -- Whether to adapt the image number or not. This switch is included to support the FreeEndNEB class, that is just a thin wrapper around this class.
adapt_fact (positive float) -- Factor that is used to decide wether to adapt. The inital threshold is calculated by multiplying the RMS force of the band with this factor. When the RMS of the force falls below this threshold adaption takes place.
adapat_between (positive integer) -- Number of images to interpolate between the highest energy image and its neighbours. The number of starting images must be higher or equal then 2*adapt_between+3, as we reuse/transfer the calculators from the starting images onto the new ones.
scale_fact (bool, default False) -- Whether to increase adapt_fact in deeper levels. This may lead to earlier adapation.
keep_hei (bool, optional) -- Whether to keep the highest energy image (usually a very good idea) or to interpolate only between the neighbouring images.
free_ends (bool, default True) -- Whether to use modified forces on the end images.
- adapt_this_cycle(forces)[source]
Decide wether to adapt.
- Parameters:
forces (np.array) -- Forces of the previous optimization cycle.
- Returns:
adapt -- Flag that indicates if adaption should take place in this cycle.
- Return type:
bool
- property forces
See Eq. (7) in [2].
Free-End NEB
- class pysisyphus.cos.FreeEndNEB.FreeEndNEB(*args, fix_first=False, fix_last=False, **kwargs)[source]
Bases:
AdaptiveNEB
- __init__(*args, fix_first=False, fix_last=False, **kwargs)[source]
Simple Free-End-NEB method.
Derived from AdaptiveNEB with disabled adaptation. Only implements Eq. (7) from [2]. For other implementations please see the commit 01bc8812ca6f1cd3645d43e0337d9e3c5fb0ba55. There the other variants are present but I think Eq. (7) in [2] is the simplest & best bet.
Simple Zero-Temperature String
- class pysisyphus.cos.SimpleZTS.SimpleZTS(images, param='equal', **kwargs)[source]
Bases:
ChainOfStates
Growing Chain Of States base class
Base class for growing chain of state methods
- class pysisyphus.cos.GrowingChainOfStates.GrowingChainOfStates(images, calc_getter, max_nodes=10, **kwargs)[source]
- property arc_dims
- property max_image_num
Growing Chain Of State Methods
Growing String Method
- class pysisyphus.cos.GrowingString.GrowingString(images, calc_getter, perp_thresh=0.05, param='equi', reparam_every=2, reparam_every_full=3, reparam_tol=None, reparam_check='rms', max_micro_cycles=5, reset_dlc=True, climb=False, **kwargs)[source]
Bases:
GrowingChainOfStates
- property forces
- property full_string_image_inds
- property fully_grown
Returns wether the string is fully grown. Don't count the first and last node.
- get_new_image(ref_index)[source]
Get new image by taking a step from self.images[ref_index] towards the center of the string.
- property image_inds
- property left_size
- property lf_ind
Index of the left frontier node in self.images.
- property nodes_missing
Returns the number of nodes to be grown.
- property rf_ind
Index of the right frontier node in self.images.
- property right_size
- property string_size
Transition State Optimization
To cite Frank Jensen: "Locating transition states (TSs) is black magic, especially in internal coordinates" and I can say this is true. The most promising TS optimizers in pysisyphus employ second derivative information (hessian) but locating TS is also possible using only first derivatives by means of the dimer method (DM).
TS optimizations should preferably be carried out in internal coordinates (type: redund|dlc). Before starting the actual TS search, one should always check the internal coordinates that pysisyphus sets up, by executing pysistrj [xyz] --internals, with [xyz] corresponding to the geometry you plan to use for the optimization. Check carefully if all supposed reaction coordinates are present. If they are missing define them manually with the add_prims key in the YAML input.
Calculation of the exact hessian can be avoided by using the DM by using rx_coords: [list of primitives] in combination with hessian_init: fischer|lindh|swart|simple. By using both options, a diagonal model hessian is calcualted and modified for use in a TS optimization.
The DM can be used with a powerful preconditioned LBFGS optimizer (type: lbfgs
).
Hessian Based TS Optimization
YAML example
Below you can find an example YAML-input including the most important options that the user may want to modify for the Hessian-based optimizers (RS-I-RFO, RS-P-RFO, TRIM).
tsopt:
type: rsirfo|rsprfo|trim # Optimization algorithm
do_hess: True # Calculate the hessian at the final geometry
# after the optimization.
hessian_recalc: 1 # Recalculate the exact hessian every n-th cylce
# Very costly but a small number like 5 may be a good
# idea.
prim_coord: [BOND, 3, 18] # Select the mode to follow uphill by overlap with
# this primitive internal coordinate. Expects exactly
# one typed primitive.
rx_modes: [[[[BOND, 3, 18], 1]]] # Select initial mode based on overlaps with a
# constructed mode(s). Can be seen as generalization of
# prim_coord. Expects a a list of (lists of pairs, with each
# pair comprising a typed primitive and a phase factor).
#
# See examples/tsopt/{05..,06..} for examples.
#rx_coords: [[BOND, 3, 18],] # Obtain initial mode by modifying a model Hessian. Has
# to be used with 'hess_init: swart|fischer|lindh|xtb'
# to avoid calculation of exact hessian.
# Also requires 'redund' or 'dlc' to work.
#root: 0 # Follow the n-th imaginary mode uphill, minimize
# along the others.
#hessian_init: calc # Initial hessian is calculated exactly.
#hessian_update: bofill # Bofill hessian-update. Should not be modified for
# TS optimizations.
#hessian_ref: [path] # Expects a path to a precalculated hessian at any
# level of theory. The emode to maximize along is selected
# by highest overlap with imaginary mode from the reference
# hessian.
#max_micro_cycles: 50 # No. of micro cycles for the RS-variants. Does not apply
# to TRIM.
#trust_radius: 0.3 # Initial trust radius.
#trust_max: 1.0 # Max. trust radius
#trust_min: 0.1 # Min. trust radius
calc:
type: xtb
pal: 4
charge: 0
mult: 1
geom:
type: redund
fn: shaked.geom_000.xyz
add_prims: [[24, 20], ] # If using internal coordinates ALWAYS check the coordinates
# that pysisyphus generates (pysistrj [xyz] --internals). If
# some important (reaction) coordinates appears to be missing
# define them manually. In this example
# we add a bond. If additional internal coordinates can
# derived from the added primitives pysisyphus will do
# it.
Second-derivative-free TS optimization can be done using the Dimer method. Attached you can find a sample input.
Further examples for TS optimizations from .yaml input can be found here.
Dimer Method
pysisyphus implements the dimer method (DM) as calculator, wrapping another calculator
for the actual energy and gradient calculations. All DM configurations have to be done
in the calc:
section. The best results are obtained by optimizing the DM with
LBFGS in connection with a preconditioner (PLBFGS), estimated from the Lindh model Hessian.
in constrast to the TS optimizers mentioned above, PBLFGS is configured in the opt
section of the YAML input. DM related information is logged to dimer.log. The current
DM orientation is saved in files with extension .N. Animated .trj files of the DM
orientation are saved to .N.trj.
YAML example
Below you can find an example for the DM, applied to the isomerization of HCN. Default values are commented out. See examples/tsopt/02_hcn_tsopt_dimer for the full example.
opt:
type: plbfgs # Preconditioned LBFGS
thresh: baker # Baker threshold, comparable to the Gaussian defaults
do_hess: True # Calculate Hessian at the end. May not be applicable to systems
# where Hessian calculation is infeasible.
calc:
type: dimer # Dimer calculator wrapping PySCF at HF/3-21G level of theory
calc:
type: pyscf
basis: 321g
pal: 2
charge: 0
mult: 1
#N_raw: [file] # Path to a file containing an initial dimer orientation
#length: 0.0189 # Separation of dimer images from common midpoint
#rotation_max_cycles: 15 # Maximum number of rotations
#rotation_method: fourier
#rotation_thresh: 1e-4 # rms(rotationa force) threshold
#rotation_tol: 1 # Rotation tolerance in degree. If a proposed trial
# rotation angle is below the tolerance the rotation
# will be skipped.
#rotation_max_element: 0.001 # Max. step element for "rotation_method: direct"
#rotation_interpolate: True # Interpolate force on image after rotation
#rotation_remove_trans: True # Remove overall translation from N-vector
#seed: 20182503 # Seed for the RNG for reproducability reasons.
geom:
type: cart
fn: 01_hcn.xyz
General advice for TS optimizations
Use as many exact hessians as your computational budget allows (hessian_recalc: [n])
Use tight convergence settings for your SCF. In contrast to codes like ORCA pysisyphus does not enforces this automatically
Grid-based methods (DFT, some RI-types) may need finer grids to reduce numerical noise
Try to preoptimize the TS using a cheap method (xtb) that allows hessian_recalc: 1
Decrease current & allowed trust radius (trust_radius: 0.1 and trust_max: 0.3|0.5)
Check for orrect coordinate setup
TSHessianOptimizer base class
Base class for TS optimizers that empoly a hessian.
- class pysisyphus.tsoptimizers.TSHessianOptimizer.TSHessianOptimizer(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
HessianOptimizer
Optimizer to find first-order saddle points.
- __init__(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Baseclass for transition state optimizers utilizing Hessian information.
Several arguments expect a typed primitive or an iterable of typed primitives. A typed primitive is specified as (PrimType, int, int, ...), e.g., for a bond between atoms 0 and 1: (BOND, 0, 1) or for a bend between the atom triple 0, 1, 2 as (BEND, 0, 1, 2).
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.roots (
Optional
[List
[int
]], default:None
) -- Indices of modes to maximize along, e.g., to optimize saddle points of 2nd order. Overrides 'root'.root (
int
, default:0
) -- Index of imaginary mode to maximize along. Shortcut for 'roots' with only one root.hessian_ref (
Optional
[str
], default:None
) -- Filename pointing to a pysisyphus HDF5 Hessian.rx_modes (iterable of (iterable of (typed_prim, phase_factor))) -- Select initial root(s) by overlap with a modes constructed from the given typed primitives with respective phase factors.
prim_coord (typed_prim) -- Select initial root/imaginary mode by overlap with this internal coordinate. Shortcut for 'rx_modes' with only one internal coordinate.
rx_coords (iterable of (typed_prim)) -- Construct imaginary mode comprising the given typed prims by modifying a model Hessian.
hessian_init (
Literal
['calc'
,'unit'
,'fischer'
,'lindh'
,'simple'
,'swart'
,'xtb'
,'xtb1'
,'xtbff'
], default:'calc'
) -- Type of initial model Hessian.hessian_update (
Literal
['none'
,None
,False
,'bfgs'
,'damped_bfgs'
,'flowchart'
,'bofill'
,'ts_bfgs'
,'ts_bfgs_org'
,'ts_bfgs_rev'
], default:'bofill'
) -- Type of Hessian update. Defaults to BFGS for minimizations and Bofill for saddle point searches.hessian_recalc_reset (
bool
, default:True
) -- Whether to skip Hessian recalculation after reset. Undocumented.max_micro_cycles (
int
, default:50
) -- Maximum number of RS iterations.trust_radius (
float
, default:0.3
) -- Initial trust radius in whatever unit the optimization is carried out.trust_max (
float
, default:0.5
) -- Maximum trust radius.augment_bonds (
bool
, default:False
) -- Try to derive additional streching coordinates from the imaginary mode.min_line_search (
bool
, default:False
) -- Carry out line search along the imaginary mode.max_line_search (
bool
, default:False
) -- Carry out line search in the subspace that is minimized.assert_neg_eigval (
bool
, default:False
) -- Check for the existences for at least one significant negative eigenvalue. If enabled and no negative eigenvalue is present the optimization will be aborted.**kwargs -- Keyword arguments passed to the HessianOptimizer/Optimizer baseclass.
- property root
- property roots
- valid_updates = ('bofill', 'ts_bfgs', 'ts_bfgs_org', 'ts_bfgs_rev')
TS-Optimizer using hessian information
Restricted-Step Partitioned-RFO
- class pysisyphus.tsoptimizers.RSPRFOptimizer.RSPRFOptimizer(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
Restricted-Step Image-Function-RFO
- class pysisyphus.tsoptimizers.RSIRFOptimizer.RSIRFOptimizer(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
Trust-Region Image-Function Method
- class pysisyphus.tsoptimizers.TRIM.TRIM(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
TS-Optimization without hessian information
Dimer method
- class pysisyphus.calculators.Dimer.Dimer(calculator, *args, N_raw=None, length=0.0189, rotation_max_cycles=15, rotation_method='fourier', rotation_thresh=0.0001, rotation_tol=1, rotation_max_element=0.001, rotation_interpolate=True, rotation_disable=False, rotation_disable_pos_curv=True, rotation_remove_trans=True, trans_force_f_perp=True, bonds=None, N_hessian=None, bias_rotation=False, bias_translation=False, bias_gaussian_dot=0.1, seed=None, write_orientations=True, forward_hessian=True, **kwargs)[source]
- property C
Shortcut for the curvature.
- property N
- property can_bias_f0
- property can_bias_f1
- property coords0
- property coords1
- property energy0
- property f0
- property f1
- property f1_bias
- property f2
Never calculated explicitly, but estimated from f0 and f1.
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property rot_force
- property should_bias_f0
May lead to calculation of f0 and/or f1 if present!
- property should_bias_f1
May lead to calculation of f0 and/or f1 if present!
Intrinsic Reaction Coordinate (IRC)
By default two paths are integrated in plus- and minus-direction of the imaginary mode (transition vector, TV) at the transition state (TS). If the IRC is started from a non-stationary point with non-vanishing gradient the downhill: True argument can be set to integrate only one path and skip the initial hessian calculation.
IRCs are integrated in mass-weighted coordinates and the default integrator is EulerPC.
The initial displacement from the TS is done by requiring a certain energy lowering \(\mathrm{d}E\) from moving along the TV and calculating the corresponding step length from a quadratic potential: \(\mathrm{d}E = \frac{1}{2} (k \cdot \mathrm{d}q^2)\), with \(k\) being the eigenvalue of the TV (imaginary mode) and \(\mathrm{d}q\) the required step length. The default required energy lowering is \(0.0005 ~ \mathrm{au}\). Alternatively the initial can be done by a prescribed length: displ: length and displ_length: [desired step] (default is \(0.1 \sqrt{\mathrm{amu}} \cdot \mathrm{bohr}\)).
The resulting endpoints of the IRC integration can be further optimized to stationary poins by adding the endopt: section (vide infra). By setting fragments: True in endopt separate fragments will be detected and optimized individually. This may be useful if the molecules are only weakly bound. By setting fragments: total the total system, as well as the separate fragments will be optimized.
By default IRC path data is dumped to dump_fn: irc_data.h5 every dump_every: 5 cycles. IRC paths can be plotted with pysisplot --irc.
YAML example(s)
Below you can find an example YAML-input including the most important options that the user may want to modify.
geom:
fn: hfabstraction_ts_opt_xtb.xyz # Input coordinates
calc:
type: xtb # extended tight-binding calculator
pal: 4
charge: 0
mult: 1
irc:
type: eulerpc # Similar to EulerPC from Gaussian
#rms_grad_thresh: 0.001 # Convergence threshold
#displ: energy|length|energy_cubic # How to do the initial displacement
#displ_energy: 0.001 # Energy lowering in au (Hartree)
#displ_length: 0.1 # Step length along the TV
#forward: True
#backward: True
#downhill: False # Only integrate downhill, disables forward/backward
#hessian_init: null # Path to HDF5 Hessian file
#displ_third_h5: null # Path to HDF5 file containing third derivative data
endopt:
#fragments: False|True|total # Detect & optimize fragments separately. Default is
# False. When set to 'total' the total system as well
# as the fragments are optimized.
do_hess: False # Frequency calculation at the end
Further examples for IRC calculations from .yaml input can be found here.
IRC base class
Base class for IRC integrators from which actual IRC integrators are derived.
- class pysisyphus.irc.IRC.IRC(geometry, step_length=0.1, max_cycles=125, downhill=False, forward=True, backward=True, root=0, hessian_init=None, displ='energy', displ_energy=0.001, displ_length=0.1, displ_third_h5=None, rms_grad_thresh=0.001, hard_rms_grad_thresh=None, energy_thresh=1e-06, imag_below=0.0, force_inflection=True, check_bonds=True, out_dir='.', prefix='', dump_fn='irc_data.h5', dump_every=5)[source]
- __init__(geometry, step_length=0.1, max_cycles=125, downhill=False, forward=True, backward=True, root=0, hessian_init=None, displ='energy', displ_energy=0.001, displ_length=0.1, displ_third_h5=None, rms_grad_thresh=0.001, hard_rms_grad_thresh=None, energy_thresh=1e-06, imag_below=0.0, force_inflection=True, check_bonds=True, out_dir='.', prefix='', dump_fn='irc_data.h5', dump_every=5)[source]
Base class for IRC calculations.
- Parameters:
geometry (Geometry) -- Transtion state geometry, or initial geometry for downhill run.
step_length (float, optional) -- Step length in unweighted coordinates.
max_cycles (int, optional) -- Positive integer, controlloing the maximum number of IRC steps taken in a direction (forward/backward/downhill).
downhill (bool, default=False) -- Downhill run from a non-stationary point with non-vanishing gradient. Disables forward and backward runs.
forward (bool, default=True) -- Integrate IRC in positive s direction.
backward (bool, default=True) -- Integrate IRC in negative s direction.
root (int, default=0) -- Use n-th root for initial displacement from TS.
hessian_init (str, default=None) -- Path to Hessian HDF5 file, e.g., from a previous TS calculation.
displ (str, one of ("energy", "length", "energy_cubic")) -- Controlls initial displacement from the TS. 'energy' assumes a quadratic model, from which a step length for a given energy lowering (see 'displ_energy') is determined. 'length' corresponds to a displacement along the transition vector. 'energy_cubic' considers 3rd derivatives of the energy along the transition vector.
displ_energy (float, default=1e-3) -- Required energy lowering from the TS in au (Hartree). Used with 'displ: energy|energy_cubic'.
displ_length (float, default=0.1) -- Step length along the transition vector. Used only with 'displ: length'.
displ_third_h5 (str, optional) -- Path to HDF5 file containing 3rd derivative information. Used with 'displ: energy_cubic'.
rms_grad_thresh (float, default=1e-3,) -- Convergence is signalled when to root mean square of the unweighted gradient is less than or equal to this value
energy_thresh (float, default=1e-6,) -- Signal convergence when the energy difference between two points is equal to or less than 'energy_thresh'.
imag_below (float, default=0.0) -- Require the wavenumber of the imaginary mode to be below the given threshold. If given, it should be a negative number.
force_inflection (bool, optional) -- Don't indicate convergence before passing an inflection point.
check_bonds (bool, optional, default=True) -- Report whether bonds are formed/broken along the IRC, w.r.t the TS.
out_dir (str, optional) -- Dump everything into 'out_dir' directory instead of the CWD.
prefix (str, optional) -- Short string that is prepended to all files that are created by this class, e.g., trajectories and HDF5 dumps.
dump_fn (str, optional) -- Base name for the HDF5 files.
dump_every (int, optional) -- Dump to HDF5 every n-th cycle.
- property coords
- property energy
- property gradient
- initial_displacement()[source]
Returns non-mass-weighted steps in +s and -s direction for initial displacement from the TS. Earlier version only returned one step, that was later multiplied by either 1 or -1, depending on the desired IRC direction (forward/backward). The current implementation directly returns two steps for forward and backward direction. Whereas for plus and minus steps for displ 'length' and displ 'energy'
step_plus = -step_minus
is valid, it is not valid for dipsl 'energy_cubic' anymore. The latter step is formed as
x(ds) = ds * v0 + ds**2 * v1
- so
x(ds) != -x(ds)
- as
ds * v0 + ds**2 * v1 != -ds * v0 - ds**2 * v1 .
So, all required step are formed directly and later used as appropriate.
- property m_sqrt
- property mw_coords
- property mw_gradient
- valid_displs = ('energy', 'length', 'energy_cubic')
IRC Integrators
Damped-Velocity-Verlet integrator
- class pysisyphus.irc.DampedVelocityVerlet.DampedVelocityVerlet(geometry, v0=0.04, dt0=0.5, error_tol=0.003, max_cycles=150, **kwargs)[source]
Bases:
IRC
Euler integrator
Not recommended as it only produces reasonable results with very small step sizes.
Euler-Predictor-Corrector integrator
Recommended IRC integrator and default choice.
- class pysisyphus.irc.EulerPC.EulerPC(*args, hessian_recalc=None, hessian_update='bofill', hessian_init='calc', max_pred_steps=500, loose_cycles=3, dump_dwi=False, scipy_method=None, corr_func='mbs', **kwargs)[source]
Bases:
IRC
Gonzales-Schlegel-2 integrator
Local-Quadratic-Approximation integrator
Modified-Ishida-Morokuma-Komornicki integrator
Similar to the algorithm implemented by ORCA 4.
Runge-Kutta-4 integrator
Not recommended, as it is very slow.
- class pysisyphus.irc.RK4.RK4(geometry, step_length=0.1, max_cycles=125, downhill=False, forward=True, backward=True, root=0, hessian_init=None, displ='energy', displ_energy=0.001, displ_length=0.1, displ_third_h5=None, rms_grad_thresh=0.001, hard_rms_grad_thresh=None, energy_thresh=1e-06, imag_below=0.0, force_inflection=True, check_bonds=True, out_dir='.', prefix='', dump_fn='irc_data.h5', dump_every=5)[source]
Bases:
IRC
Diabatiziation
Adiabatic states can be diabatized with a suitable rotation matrix, which in turn can be determined by maximizing a cost funtion that depends on the rotation matrix and some selected adiabatic properties (see below). Pysisyphus implements property-based direct diabatizion, as outlined by Subotnik [1] and Truhlar et al. [2]
Currently, dipole moments, the trace of the primitive quadrupole tensor and the electrostatic potential can be utilized for diabatization.
General Algorithm
Diabatic states \(\{\Xi_A\}\) can be obtained via unitary transformation of adiabatic states \(\{\Psi_I\}\).
which is equivalent to
with rotation matrix \(\mathbf{U}\), as well as adiabatic and diabatic state vectors \(\mathbf{\Psi}\) and \(\mathbf{\Xi}\). Given two adiabatic states \(\Psi_1\) and \(\Psi_2\) \(\mathbf{U}\) is defined as
The related diabatic states \(\Xi_A\) and \(\Xi_B\) are
Similarly, diabatic expectation values are calculated as linear combination of adiabatic expectation values:
or in matrix notation
By maximizing a cost function that depends on diabatic properties \(\mathbf{O}_\mathrm{dia}\), a rotation matrix \(\mathbf{U}\) suitable for diabatization can be determined.
With a known rotation matrix \(\mathbf{U}\), the diagonal adiabatic electronic energy matrix \(\mathbf{V}\) can be transformed to its diabatic equivalent \(\mathbf{D}\), e.g, to determine diabatic couplings \(|D_{12}|\).
Depending on the employed properties, different cost functions \(f(\mathbf{U})\) are used. Subotnik [1] proposed to maximize the magnitude of the diabatic dipole moments:
This is the same cost function as in classical Boys localization of molecular orbitals. By also considering the trace of the primitive quadrupole tensor, \(f_D(\mathbf{U})\) is extended to \(f_{DQ}(\mathbf{U})\):
The contribution of the quadrupole moments to \(f(\mathbf{U})\) is controlled by the scaling factor \(\alpha_j\). Here, subscript \(j\) refers to the j-th expansion center. Currently, only one expansion center (\(N_Q = 1\)) can be used in pysisyphus. By default \(\alpha_j\) is set to \(10 ~ a_0^{-2}\).
In some cases, considering only the dipole moments is not enough to discriminate different adiabatic states and quadrupole moments have to be taken into account. Several examples are outlined by Truhlar et al. [2]
Slight improvements may be possible by incorporating the electronic component of the electrostatic potential (ESP) \(\Phi\).
Here again, \(N_\Phi\) denotes the number of expansion centers where the ESP is calculated. Similar to the quadrupole moments, only one expansion center is currently supported in pysisyphus. \(\beta_k\) is a scaling factor that controls the contribution of the electrostatic potential to the overall cost function \(f_{DQ\Phi}(\mathbf{U})\).
Maximization of cost function \(f\) is achieved via repeated 2 x 2 rotations (Jacobi sweeps) of diabatic state pairs. The formulas to calculate the required rotation angle are given by Kleier [3] and Pulay et al. [4] The maximization is started with a unit-matrix guess for \(\mathbf{U}\) and usually converges quite rapidly.
A different approach based on unitary optimization is outlined by Lehtola, [5] but is not available in pysisyphus.
Diabatization is carried out via the pysisdia entry hook. See below for an example.
Example
Diabatization of 3 adiabatic states using dipole moments requires the 3 adiabatic permanent dipole moments (0,0; 1,1; 2,2), as well as the respective transition dipole moments (0,1; 0,2; 1,2).
# Guanine-Indole cation, wB97X-D/6-31G*, TDA, 3 states.
# Values are taken from the Table S2 in the SI of
# https://doi.org/10.1063/5.0035593
adiabatic_energies: [0.0, 0.717, 0.905]
adiabatic_labels: [GS, LE, CT]
dipoles:
- [0, 0, -1.253, 0.270, -1.876]
- [1, 1, -1.691, -0.653, -2.083]
- [2, 2, 0.948, 0.733, -1.327]
- [0, 1, -1.224, -0.279, -0.325]
- [0, 2, 2.227, 0.866, 0.735]
- [1, 2, -1.574, -1.029, -0.517]
Executing pysisdia guanine_indole_dia.yaml produces the following output:
###################
# D-DIABATIZATION #
###################
Dipole moments
--------------
[[[-1.253 -1.224 2.227]
[-1.224 -1.691 -1.574]
[ 2.227 -1.574 0.948]]
[[ 0.27 -0.279 0.866]
[-0.279 -0.653 -1.029]
[ 0.866 -1.029 0.733]]
[[-1.876 -0.325 0.735]
[-0.325 -2.083 -0.517]
[ 0.735 -0.517 -1.327]]]
Starting Jacobi sweeps.
000: P=169.63193103 dP=169.63193103
001: P=172.49529007 dP= 2.86335904
002: P=172.49529008 dP= 0.00000000
Jacobi sweeps converged in 3 cycles.
All energies are given in eV.
Adiabatic energy matrix V
-------------------------
[[0. 0. 0. ]
[0. 0.717 0. ]
[0. 0. 0.905]]
Rotation matrix U
-----------------
[[ 0.16289082 0.84920213 0.50231695]
[-0.84058556 0.38601857 -0.38000734]
[-0.51660672 -0.36034067 0.77670593]]
det(U)=1.0000
Diabatic energy matrix D = UᵀVU
-------------------------------
[[ 0.74814945 -0.06418359 -0.13410224]
[-0.06418359 0.2243505 -0.35846691]
[-0.13410224 -0.35846691 0.64950005]]
Diabatic states Ξᵢ sorted by energy
--------------------------------
0: Ξ₁, 0.2244 eV
1: Ξ₂, 0.6495 eV
2: Ξ₀, 0.7481 eV
Composition of diabatic states Ξᵢ
---------------------------------
Ξ₀ = + 0.1629·Φ₀(GS) - 0.8406·Φ₁(LE) - 0.5166·Φ₂(CT)
Ξ₁ = + 0.8492·Φ₀(GS) + 0.3860·Φ₁(LE) - 0.3603·Φ₂(CT)
Ξ₂ = + 0.5023·Φ₀(GS) - 0.3800·Φ₁(LE) + 0.7767·Φ₂(CT)
Weights U²
----------
[[0.02653342 0.72114427 0.25232232]
[0.70658408 0.14901034 0.14440558]
[0.2668825 0.1298454 0.6032721 ]]
Absolute diabatic couplings
---------------------------
|D₀₁| = 0.0642 eV
|D₀₂| = 0.1341 eV
|D₁₂| = 0.3585 eV
YAML input
All possible input options are outlined below. The numbers are just dummy values.
# Adiabatic energies, of the states to diabatize.
#
# List of floats.
# [V0, V1, ...]
# May be absolute or relative energies.
adiabatic_energies: [0.0, 0.6541, 0.7351]
# Dipole moments.
#
# List of lists of length 5, each containing 2 integers followed by 3 floats.
# [state0, state1, dpm_x, dpm_y, dpm_z]
# The integers are adiabatic state indices, the 3 floats are the X, Y and Z
# components of a dipole moment vector.
# If both integers are the same, the 3 floats correspond to the permanent dipole moment
# of a state. Otherwise, they correspond to a transition dipole moment
# between two states.
dipoles: [
[0, 0, -1.0, -2.0, -3.0],
[1, 1, -2.0, -1.0, -3.0],
[0, 1, -2.0, -1.0, -3.0],
]
#
# Optional input below
#
# Adiabatic state labels.
#
# List of strings.
# [label1, label2, ...]
# Must be of same length as adiabatic energies.
adiabiatc_labels: [GS, LE, CT]
# Energy unit.
#
# Literal["eV", "Eh"]
unit: eV
# Trace of primitive quadrupole moment tensor.
#
# List of lists of length 3, each containing 2 integers followed by 1 float.
# [state0, state1, tr_qpm] = [state0, state1, (qpm_xx + qpm_yy + qpm_zz)
# The same comments as for the dipole moments apply.
quadrupoles: [
[0, 0, 1.0],
[1, 1, -14.0],
[0, 1, 33.0],
]
# Quadrupole moment scaling factor alpha in 1/a₀².
#
# Float
alpha: 10.0
# Electronic component of electrostatic potential in au
epots: [
[0, 0.48],
[1, 0.12],
]
# Electrostatic potential scaling factor beta in a₀.
#
# Float
beta: 1.0
Plotting
pysisyphus offers extensive visualization capabilities via the pysisplot command. All relevant information produced by pysisyphus and the interfaced quantum chemistry programs is dumped to HDF5 files, namely:
Filename |
Description |
---|---|
optimization.h5 |
Produced by all optimizers when dump: True (default). |
afir.h5 |
Contains true and modified energies & forces in AFIR calculations. |
forward_irc_data.h5 |
IRC data from forward run. |
backward_irc_data.h5 |
IRC data from backward run. |
finished_irc_data.h5 |
IRC data from forward & backward run. |
overlap_data.h5 |
From excited state calculations by OverlapCalculator classes. |
A help message that shows possible usages of pysisplot is displayed by
pysisplot --help
If needed, results from multiple optimizations are written to different HD5-groups of the same HDF5-file. Available groups can be listed either by the HDF5-tool h5ls or pysisplot --h5_list [hd55 file]. The desired group for visualization is then selected by the --h5_group [group name] argument.
Example - Diels-Alder reaction
The plotting capabilities of pysisplot are demonstrated for the example of a Diels-Alder reaction between ethene and 1-4-butadiene (see examples/06_diels_alder_xtb_preopt_neb_tsopt_irc) at xtb-GFN2 level of theory. Educts and product of the reaction are preoptimized for 5 cycles, then interpolated in internal coordinates. A chain of states (COS) is optimized loosely via a LBFGS optimizer. The highest energy image (HEI) is employed for a subsequent transition state (TS) optimization. Finally the intrinsic reaction coordinate (IRC) is obtained by means of an Euler-Predictor-Corrector integrator.

Educts, TS and products of the Diels-Alder reaction between ethene and 1-4-butadiene.
Plotting optimization progress
The progress of an optimization can be plotted via
pysisplot --opt [--h5_fn optimization.h5] [--h5_group opt]
Arguments given in parantheses are the assumed defaults. The result is shown below for the preoptimizations of educts and product.

Preoptimization of the Diels-Alader reaction educts ethene + 1,4-butadiene. The upper panel shows the energy change along the optimization. Middle and lower panel show the max and rms of the force. The HDF5 filename and group are noted in the image title.

Preoptimization of the Diels-Alader reaction product. Compared to the educts the optimization already converged after 4 cycles.
For COS optimizations all image energies of one optimization cycle are summed into a total energy, which is then plotted in the first panel. pysisplot --opt may not be the best choice in these cases. Use pysisplot --cosens and pysisplot --cosforces instead (see below).
Plotting COS optimization progress
Compared to simple surface-walking optimizations of single molecules, COSs consist of multiple images, each with its own energy and force vector. In this case a simple plot as shown above is not suitable. Instead of pysisplot --opt a better visualization is offered by pysisplot --cosens and pysisplot --cosforces. The latter two commands are compatible with all COS methods available in pysisphus.
pysisplot --cosens [--h5_fn optimization.h5] [--h5_group opt]
This produces three plots.
Animated. COS image energies along the optimization.
Static. Energies of last optimization cycle.
Static. Energies of all cycles with earlier cycles given in a lighter shade and more recent cycles in a darker shade. The last cycle is splined and the position of the splined HEI is indicated.
Please note that equidistant image spacing is assumed for the latter two plots. Here only the two latter plots are shown.

COS image energies of the last (most recent) optimization cycle.

COS image energies of all optimization cycles. Not that the acutal difference between image geometries are not taken into account. Equidistance is assumed. Later (more recent) cycles are given in a darker shade.
The forces acting on the respective COS images can also be plotted.
pysisplot --coforces [--h5_fn optimization.h5] [--h5_group opt]

Maximum component and root-mean-square (rms) of the perpendicular component of the force, acting on the COS images.
Please note that nothing is plotted for images 0 and 11, as they remained fixed in the optimization.
Plotting TS-optimization progress
The TS-optimization progress is plotted with pysisplot --opt --h5_group tsopt. Here we explicitly selected a different HDF5 group by --h5_group.

Progress of the TS optimization, started from the HEI.
Plotting the Intrinsic Reaction Coordinate
IRC profiles are easily plotted by
pysisplot --irc
Multiple plots may appear, depending on the progress of the IRC. The IRC coordinate is given in mass-weighted cartesian coordinates, whereas gradients are given in non-mass-weighted units.

IRC for the Diels-Alder reaction between ethene and 1,4-butadiene.
Evidently the IRC integration failed at the end, as can be seen from the the bunched up points, but unless you want to do some kind of transition-state-theory (TST; not supported by pysisyphus) calculations this should not be a problem.
Example - AFIR
pysisplot is able to visualize AFIR calculations and to highlight intersting geometries along the optimization. Shown below is an example taken from the AFIR-Paper . By using AFIR the SN2 between OH- and fluoromethylene can be forced, yielding methanol and the fluorine anion. The corresponding unit test can be found in the tests/test_afir directory of the repository.

Formation of methanol by means of a SN2 reaction.

Energy profile and force norms along the SN2 reaction.
Example - Excited State Tracking
pysisyphus is aware of excited states (ES) and can track them using various approaches over the course of an optimization or an IRC. By calculating the overlap matrices between ESs at given geometry and a reference geometry pysisyphus can track the desired ES. All relevant data is stored in overlap_data.h5.
Optimizing an ES is demonstrated for the S1 of the 1H-amino-keto tautomer of Cytosin at the PBE0/def-SVP level of theory. A corresponding test can be found under (tests/test_cytosin_opt). Right after the first optimization cycle a root flip occurs and the S1 and S2 switch. The potential energy curves along the optimization are plotted by:
pysisplot --all_energies
pysisplot -a

Potential energy curves along the S1 optimization of the 1H-amino-keto tautomer of Cytosin at the PBE0/def2-SVP level of theory. The root actually followed is indicated by a dashed line.
The calculated overlap matrices can be plotted by:
pysisplot --overlaps
pysisplot -o
If the calculation was set up to calculate charge-density-differences (CDDs) via MultiWFN and to render them via Jmol then the CDD images displayed beside the overlap matrices.

Cytosin S1 optimization. Overlaps between first and second cycle. No root flips occured. All ES are in the same order as in the reference geometry at cycle 0.

Cytosin S1 optimization. Overlaps between second and third cycle with root flip. The S1 and S2 switch their order.
Working with Geometries
TBD
Pleas see pysistrj --help for a list of possible invocations.
usage: Utility to transform .xyz and .trj files. [-h]
(--between BETWEEN | --align | --split | --reverse | --cleantrj | --spline | --first FIRST | --every EVERY | --center | --centerm | --translate TRANSLATE TRANSLATE TRANSLATE | --append | --join | --match | --std | --shake | --internals | --get GET | --origin | --fragsort)
[--scale SCALE] [--seed SEED]
[--idpp | --lst | --redund]
[--noipalign] [--bohr]
[--noxyz]
[--atoms ATOMS [ATOMS ...]]
[--add_prims ADD_PRIMS]
fns [fns ...]
positional arguments:
fns Filenames of .xyz and/or .trj files (xyz and trj can
be mixed).
optional arguments:
-h, --help show this help message and exit
--between BETWEEN Interpolate additional images.
--align Align geometries onto the first geometry.
--split Split a supplied geometries in multiple .xyz files.
--reverse Reverse a .trj file.
--cleantrj Keep only the first four columns of xyz/trj files.
--spline Evenly redistribute geometries along a splined path.
--first FIRST Copy the first N geometries to a new .trj file.
--every EVERY Create new .trj with every N-th geometry. Always
includes the first and last point.
--center Move the molecules centroid into the origin.
--centerm Move the molecules center of mass into the origin.
--translate TRANSLATE TRANSLATE TRANSLATE
Translate the molecule by the given vector given in
Ångström.
--append Combine the given .xyz files into one .xyz file.
--join Combine the given .xyz/.trj files into one .trj file.
--match Resort the second .xyz file so the atom order matches
the first .xyz file. Uses the hungarian method.
--std Move supplied geometry to its standard orientation.
--shake Shake (randomly displace) coordiantes.
--internals Print automatically generated internals.
--get GET Get n-th geometry. Expects 0-based index input.
--origin Translate geometry, so that min(X/Y/Z) == 0.
--fragsort Resort atoms by fragments.
--idpp Interpolate using Image Dependent Pair Potential.
--lst Interpolate by linear synchronous transit.
--redund Interpolate in internal coordinates.
--noipalign Don't align geometries when interpolating.
--bohr Input geometries are in Bohr instead of Angstrom.
--noxyz Disable dumping of single .xyz files.
--atoms ATOMS [ATOMS ...]
Used with --internals. Only print primitives including
the given atoms.
--add_prims ADD_PRIMS
Used with --internals. Define additional primitives.
Expects a string representation of a nested list that
can be parsed as YAML e.g.
[[10,30],[1,2,3],[4,5,6,7]].
--scale SCALE Scales the displacement in --shake.
--seed SEED Initialize the RNG for reproducible results.
pysisyphus
pysisyphus package
Subpackages
pysisyphus.benchmarks package
Submodules
pysisyphus.benchmarks.Benchmark module
- class pysisyphus.benchmarks.Benchmark.Benchmark(name, exclude=None, inv_exclude=False, only=None, coord_type='cart', calc_getter=None)[source]
Bases:
object
- data_funcs = {'baker': <function get_baker_data>, 'baker_ts': <function get_baker_ts_data>, 'birkholz_rx': <function get_birkholz_rx_data>, 'precon_pos_rot': <function get_precon_pos_rot_data>, 's22': <function get_s22_data>, 'xtb_rx': <function get_xtb_rx_data>, 'zimmerman': <function get_zimmerman_data>, 'zimmerman_xtb': <function get_zimmerman_xtb_data>}
- property geom_iter
- property geoms
pysisyphus.benchmarks.data module
- pysisyphus.benchmarks.data.get_baker_ts_data()[source]
10.1002/(SICI)1096-987X(199605)17:7<888::AID-JCC12>3.0.CO;2-7
HF/3-21G
Module contents
pysisyphus.calculators package
Submodules
pysisyphus.calculators.AFIR module
- class pysisyphus.calculators.AFIR.AFIR(calculator, fragment_indices, gamma, rho=1, p=6, ignore_hydrogen=False, zero_hydrogen=True, complete_fragments=True, dump=True, h5_fn='afir.h5', h5_group_name='afir', **kwargs)[source]
Bases:
Calculator
- __init__(calculator, fragment_indices, gamma, rho=1, p=6, ignore_hydrogen=False, zero_hydrogen=True, complete_fragments=True, dump=True, h5_fn='afir.h5', h5_group_name='afir', **kwargs)[source]
Artifical Force Induced Reaction calculator.
Currently, there are no automated drivers to run large-scale AFIR calculations with many different initial orientations and/or increasing collision energy parameter γ. Nontheless, selected AFIR calculations can be carried out by hand. After convergence, artificial potential & forces, as well as real energies and forces can be plotted with 'pysisplot --afir'. The highest energy point along the AFIR path can then be selected for a subsequent TS-optimization, e.g. via 'pysistrj --get [index] optimzation.trj'.
Future versions of pysisyphus may provide drivers for more automatted AFIR calculations.
- Parameters:
calculator (
Calculator
) -- Actual QC calculator that provides energies and its derivatives, that are modified by the AFIR calculator, e.g., ORCA or Psi4.fragment_indices (
List
[List
[int
]]) -- List of lists of integers, specifying the separate fragments. If the indices in theses lists don't comprise all atoms in the molecule, the reamining indices will be added as a separate fragment. If a AFIR calculation is carried out with 2 fragments and 'complete_fragments' is True (see below) it is enough to specify only the indices of one fragment, e.g., for a system of 10 atoms 'fragment_indices=[[0,1,2,3]]' is enough. The second system will be set up automatically with indices [4,5,6,7,8,9].gamma (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]) -- Collision energy parameter γ in au. For 2 fragments it can be a single integer, while for > 2 fragments a list of gammas must be given, specifying the pair-wise collision energy parameters. For 3 fragments 3 gammas must be given [γ_01, γ_02, γ_12], for 4 fragments 6 gammas would be required [γ_01, γ_02, γ_03, γ_12, γ_13, γ_23] and so on.rho (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]], default:1
) -- Direction of the artificial force, either 1 or -1. The same comments as for gamma apply. For 2 fragments a single integer is enough, for > 2 fragments a list of rhos must be given (see above). For rho=1 fragments are pushed together, for rho=-1 fragments are pulled apart.p (
int
, default:6
) -- Exponent p used in the calculation of the weight function ω. Defaults to 6 and probably does not have to be changed.ignore_hydrogen (
bool
, default:False
) -- Whether hydrogens are ignored in the calculation of the artificial force. All weights between atom pairs containing hydrogen will be set to 0.zero_hydrogen (
bool
, default:True
) -- Whether to use 0.0 as covalent radius for hydrogen in the weight function. Compared to 'ignore_hydrogen', which results in zero weights for all atom pairs involving hydrogen, 'zero_hydrogen' may be non-zero, depending on the covalent radius of the second atom in the pair.complete_fragments (
bool
, default:True
) -- Whether an incomplete specification in 'fragment_indices' is automatically completed.dump (
bool
, default:True
) -- Whether an HDF5 file is created.h5_fn (
str
, default:'afir.h5'
) -- Filename of the HDF5 file used for dumping.h5_group_name (
str
, default:'afir'
) -- HDF5 group name used for dumping.**kwargs -- Keyword arguments passed to the Calculator baseclass.
- property charge
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property mult
- set_atoms_and_funcs(atoms, coords)[source]
Initially atoms was also an argument to the constructor of AFIR. I removed it so creation becomes easier. The first time a calculation is requested with a proper atom set everything is set up (cov. radii, afir function and corresponding gradient). Afterwards there is only a check if atoms != None and it is expected that all functions are properly set.
fragment_indices can also be incomplete w.r.t. to the number of atoms. If the sum of the specified fragment atoms is less than the number of atoms present then all remaining unspecified atoms will be gathered in one fragment.
pysisyphus.calculators.AnaPot module
- class pysisyphus.calculators.AnaPot.AnaPot(**kwargs)[source]
Bases:
AnaPotBase
pysisyphus.calculators.AnaPot2 module
- class pysisyphus.calculators.AnaPot2.AnaPot2[source]
Bases:
AnaPotBase
We can't use sympify as it replaces 1/tan by cot and this isn't supported by numpy when we call lambdify.
- class pysisyphus.calculators.AnaPot2.AnaPot2_[source]
Bases:
Calculator
pysisyphus.calculators.AnaPot3 module
- class pysisyphus.calculators.AnaPot3.AnaPot3[source]
Bases:
AnaPotBase
pysisyphus.calculators.AnaPot4 module
- class pysisyphus.calculators.AnaPot4.AnaPot4[source]
Bases:
AnaPotBase
pysisyphus.calculators.AnaPotBase module
- class pysisyphus.calculators.AnaPotBase.AnaPotBase(V_str, scale=1.0, xlim=(-1, 1), ylim=(-1, 1), levels=None, use_sympify=True, minima=None, saddles=None)[source]
Bases:
Calculator
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
pysisyphus.calculators.AnaPotCBM module
- class pysisyphus.calculators.AnaPotCBM.AnaPotCBM[source]
Bases:
AnaPotBase
pysisyphus.calculators.AtomAtomTransTorque module
pysisyphus.calculators.Calculator module
- class pysisyphus.calculators.Calculator.Calculator(calc_number=0, charge=0, mult=1, base_name='calculator', pal=1, mem=1000, keep_kind='all', check_mem=True, retry_calc=0, last_calc_cycle=None, clean_after=True, out_dir='qm_calcs', force_num_hess=False, num_hess_kwargs=None)[source]
Bases:
object
- __init__(calc_number=0, charge=0, mult=1, base_name='calculator', pal=1, mem=1000, keep_kind='all', check_mem=True, retry_calc=0, last_calc_cycle=None, clean_after=True, out_dir='qm_calcs', force_num_hess=False, num_hess_kwargs=None)[source]
Base-class of all calculators.
Meant to be extended.
- Parameters:
calc_number (int, default=0) -- Identifier of the Calculator. Used in distinguishing it from other Calculators, e.g. in ChainOfStates calculations. Also used in the creation of filenames.
charge (int, default=0) -- Molecular charge.
mult (int, default=1) -- Molecular multiplicity (1 = singlet, 2 = doublet, ...)
base_name (str, default=calculator) -- Generated filenames will start with this string.
pal (int, default=1) -- Positive integer that gives the number of physical cores to use on 1 node.
mem (int, default=1000) -- Mememory per core in MB. The total amount of memory is given as mem*pal.
check_mem (bool, default=True) -- Whether to adjust the requested memory if too much is requested.
retry_calc (int, default=0) -- Number of additional retries when calculation failed.
last_calc_cycle (int) -- Internal variable used in restarts.
clean_after (bool) -- Delete temporary directory were calculations were executed after a calculation.
out_dir (str) -- Path that is prepended to generated filenames.
force_hess_kwargs (bool, default False) -- Force numerical Hessians.
num_hess_kwargs (dict) -- Keyword arguments for finite difference Hessian calculation.
- clean(path)[source]
Delete the temporary directory.
- Parameters:
path (Path) -- Directory to delete.
- conf_key = None
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- get_restart_info()[source]
Return a dict containing chkfiles.
- Returns:
restart_info -- Dictionary holding the calculator state. Used for restoring calculaters in restarted calculations.
- Return type:
dict
- keep(path)[source]
Backup calculation results.
- Parameters:
path (Path) -- Temporary directory of the calculation.
- Returns:
kept_fns -- Dictonary holding the filenames that were backed up. The keys correspond to the type of file.
- Return type:
dict
- log(message='')[source]
Write a log message.
Wraps the logger variable.
- Parameters:
message (str) -- Message to be logged.
- make_fn(name, counter=None, return_str=False)[source]
Make a full filename.
Return a full filename including the calculator name and the current counter given a suffix.
- Parameters:
name (str) -- Suffix of the filename.
counter (int, optional) -- If not given use the current calc_counter.
return_str (int, optional) -- Return a string instead of a Path when True.
- Returns:
fn -- Filename.
- Return type:
str
- property name
- prepare(inp)[source]
Prepare a temporary directory and write input.
Similar to prepare_path, but the input is also written into the prepared directory.
Paramters
- inpstr
Input to be written into the file
self.inp_fn
in the prepared directory.
- returns:
- path: Path
Prepared directory.
- prepare_coords(atoms, coords)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
- prepare_path(use_in_run=False)[source]
Get a temporary directory handle.
Create a temporary directory that can later be used in a calculation.
- Parameters:
use_in_run (bool, option) -- Sets the internal variable
self.path_already_prepared
that is later read byself.run()
. No new temporary directory will be created inself.run()
.- Returns:
- path: Path
Prepared directory.
- prepare_pattern(raw_pat)[source]
Prepare globs.
Transforms an entry of
self.to_keep
into a glob and a key suitable for the use inself.keep()
.- Parameters:
raw_pat (str) -- Entry of
self.to_keep
- Returns:
pattern (str) -- Glob that can be used in Path.glob()
multi (bool) -- Flag if glob may match multiple files.
key (str) -- A key to be used in the
kept_fns
dict.
- prepare_turbo_coords(atoms, coords)[source]
Get a Turbomole coords string.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- String holding coordinates in Turbomole coords format.
- Return type:
str
- prepare_xyz_string(atoms, coords)[source]
Returns a xyz string in Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
xyz_str -- Coordinates in .xyz format.
- Return type:
string
- print_out_fn(path)[source]
Print calculation output.
Prints the output of a calculator after a calculation.
- Parameters:
path (Path) -- Temporary directory of the calculation.
- restore_org_hessian()[source]
Restore original 'get_hessian' method, which may also fallback to numerical Hessians, if not implemented.
- run(inp, calc, add_args=None, env=None, shell=False, hold=False, keep=True, cmd=None, inc_counter=True, run_after=True, parser_kwargs=None, symlink=True)[source]
Run a calculation.
The bread-and-butter method to actually run an external quantum chemistry code.
- Parameters:
inp (str) -- Input for the external program that is written to the temp-dir.
calc (str, hashable) -- Key (and more or less type of calculation) to select the right parsing function from
self.parser_funcs
.add_args (iterable, optional) -- Additional arguments that will be appended to the program call.
env (Environment, optional) -- A potentially modified environment for the subprocess call.
shell (bool, optional) -- Use a shell to execute the program call. Need for Turbomole were we chain program calls like dscf; escf.
hold (bool, optional) -- Wether to remove the temporary directory after the calculation.
keep (bool, optional) -- Wether to backup files as specified in
self.to_keep()
. Usually you want this.cmd (str or iterable, optional) -- Overwrites
self.base_cmd
.inc_counter (bool, optional) -- Wether to increment the counter after a calculation.
- Returns:
results -- Dictionary holding all applicable results of the calculations like the energy, a forces vector and/or excited state energies from TDDFT.
- Return type:
dict
- run_after(path)[source]
Meant to be extended.
This method is called after a calculation was done, but before entering
self.keep()
andself.clean()
. Can be used to call tools like formchk or ricctools.
- set_restart_info(restart_info)[source]
Sets restart information (chkfiles etc.) on the calculator.
- Parameters:
restart_info (dict) -- Dictionary holding the calculator state. Used for restoring calculaters in restarted calculations.
- verify_chkfiles(chkfiles)[source]
Checks if given chkfiles exist and return them as Paths
- Parameters:
chkfiles (dict) -- Dictionary holding the chkfiles. The keys correspond to the attribute names, the values are strs holding the (potentially full) filename (path).
- Returns:
paths -- Dictionary of Paths.
- Return type:
dict
- class pysisyphus.calculators.Calculator.HessKind(value)
Bases:
Enum
An enumeration.
- NUMERICAL = 2
- ORG = 1
pysisyphus.calculators.CerjanMiller module
- class pysisyphus.calculators.CerjanMiller.CerjanMiller(a=1, b=1, c=1)[source]
Bases:
AnaPotBase
pysisyphus.calculators.Composite module
- class pysisyphus.calculators.Composite.Composite(final, keys_calcs=None, calcs=None, remove_translation=False, **kwargs)[source]
Bases:
Calculator
pysisyphus.calculators.ConicalIntersection module
- class pysisyphus.calculators.ConicalIntersection.CIQuantities(energy1, gradient1, energy2, gradient2, energy_diff, gradient_diff, gradient_mean, P, x, y, energy, forces)[source]
Bases:
object
-
P:
ndarray
-
energy:
float
-
energy1:
float
-
energy2:
float
-
energy_diff:
float
-
forces:
ndarray
-
gradient1:
ndarray
-
gradient2:
ndarray
-
gradient_diff:
ndarray
-
gradient_mean:
ndarray
-
x:
ndarray
-
y:
ndarray
-
P:
- class pysisyphus.calculators.ConicalIntersection.ConicalIntersection(calculator1, calculator2, **kwargs)[source]
Bases:
Calculator
Calculator for conical intersection optimization.
Based on [1].
pysisyphus.calculators.DFTBp module
- class pysisyphus.calculators.DFTBp.DFTBp(parameter, *args, slakos=None, root=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'dftbp'
- hubbard_derivs = {'3ob': {'Br': -0.0573, 'C': -0.1492, 'Ca': -0.034, 'Cl': -0.0697, 'F': -0.1623, 'H': -0.1857, 'I': -0.0433, 'K': -0.0339, 'Mg': -0.02, 'N': -0.1535, 'Na': -0.0454, 'O': -0.1575, 'P': -0.14, 'S': -0.11, 'Zn': -0.03}}
- max_ang_moms = {'3ob': {'Br': 'd', 'C': 'p', 'Ca': 'p', 'Cl': 'd', 'F': 'p', 'H': 's', 'I': 'd', 'K': 'p', 'Mg': 'p', 'N': 'p', 'Na': 'p', 'O': 'p', 'P': 'd', 'S': 'd', 'Zn': 'd'}, 'mio-ext': {'C': 'p', 'H': 's', 'N': 'p', 'O': 'p'}}
pysisyphus.calculators.Dalton module
- class pysisyphus.calculators.Dalton.Dalton(basis, method='hf', **kwargs)[source]
Bases:
Calculator
- conf_key = 'dalton'
pysisyphus.calculators.Dimer module
- class pysisyphus.calculators.Dimer.Dimer(calculator, *args, N_raw=None, length=0.0189, rotation_max_cycles=15, rotation_method='fourier', rotation_thresh=0.0001, rotation_tol=1, rotation_max_element=0.001, rotation_interpolate=True, rotation_disable=False, rotation_disable_pos_curv=True, rotation_remove_trans=True, trans_force_f_perp=True, bonds=None, N_hessian=None, bias_rotation=False, bias_translation=False, bias_gaussian_dot=0.1, seed=None, write_orientations=True, forward_hessian=True, **kwargs)[source]
Bases:
Calculator
- property C
Shortcut for the curvature.
- property N
- property can_bias_f0
- property can_bias_f1
- property coords0
- property coords1
- property energy0
- property f0
- property f1
- property f1_bias
- property f2
Never calculated explicitly, but estimated from f0 and f1.
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property rot_force
- property should_bias_f0
May lead to calculation of f0 and/or f1 if present!
- property should_bias_f1
May lead to calculation of f0 and/or f1 if present!
pysisyphus.calculators.Dummy module
- class pysisyphus.calculators.Dummy.Dummy(calc_number=0, charge=0, mult=1, base_name='calculator', pal=1, mem=1000, keep_kind='all', check_mem=True, retry_calc=0, last_calc_cycle=None, clean_after=True, out_dir='qm_calcs', force_num_hess=False, num_hess_kwargs=None)[source]
Bases:
Calculator
pysisyphus.calculators.EGO module
- class pysisyphus.calculators.EGO.EGO(calculator, ref_geom, max_force=0.175, **kwargs)[source]
Bases:
Calculator
- property ref_hessian
- property s
pysisyphus.calculators.EnergyMin module
- class pysisyphus.calculators.EnergyMin.EnergyMin(calculator1, calculator2, mix=False, alpha=0.02, sigma=3.5, min_energy_diff=0.0, check_after=0, **kwargs)[source]
Bases:
Calculator
- __init__(calculator1, calculator2, mix=False, alpha=0.02, sigma=3.5, min_energy_diff=0.0, check_after=0, **kwargs)[source]
Use energy and derivatives of the calculator with lower energy.
This calculators carries out two calculations with different settings and returns the results of the lower energy one. This can be used to consider flips between a singlet and a triplet PES etc.
- Parameters:
calculator1 (
Calculator
) -- Wrapped QC calculator that provides energies and its derivatives.calculator2 (
Calculator
) -- Wrapped QC calculator that provides energies and its derivatives.mix (
bool
, default:False
) -- Enable mixing of both forces, according to the approach outlined in [2]. Can be used to optimize guesses for MECPs. Passalpha (
float
, default:0.02
) -- Smoothing parameter in Hartree. See [2] for a discussion.sigma (
float
, default:3.5
) -- Unitless gap size parameter. The final gap becomes smaller for bigga sigmas. Has to be adapted for each case. See [2] for a discussion (p. 407 right column and p. 408 left column.)min_energy_diff (
float
, default:0.0
) -- Energy difference in Hartree. When set to a value != 0 and the energy difference between both calculators drops below this value, execution of both calculations is diabled for 'check_after' cycles. In these cycles the calculator choice remains fixed. After 'check_after' cycles, both energies will be calculated and it is checked, if the previous calculator choice remains valid. In conjunction with 'check_after' both arguments can be used to save computational ressources.check_after (
int
, default:0
) -- Amount of cycles in which the calculator choice remains fixed.**kwargs -- Keyword arguments passed to the Calculator baseclass.
pysisyphus.calculators.ExternalPotential module
- class pysisyphus.calculators.ExternalPotential.ExternalPotential(calculator=None, potentials=None, geom=None, **kwargs)[source]
Bases:
Calculator
- available_potentials = {'d3': <class 'pysisyphus.calculators.DFTD3.DFTD3'>, 'harmonic_sphere': <class 'pysisyphus.calculators.ExternalPotential.HarmonicSphere'>, 'logfermi': <class 'pysisyphus.calculators.ExternalPotential.LogFermi'>, 'restraint': <class 'pysisyphus.calculators.ExternalPotential.Restraint'>, 'rmsd': <class 'pysisyphus.calculators.ExternalPotential.RMSD'>}
- class pysisyphus.calculators.ExternalPotential.HarmonicSphere(k, radius, origin=(0.0, 0.0, 0.0), geom=None)[source]
Bases:
object
- property surface_area
In Bohr**2
- class pysisyphus.calculators.ExternalPotential.LogFermi(beta, radius, T=300, origin=(0.0, 0.0, 0.0), geom=None)[source]
Bases:
object
- __init__(beta, radius, T=300, origin=(0.0, 0.0, 0.0), geom=None)[source]
As described in the XTB docs.
https://xtb-docs.readthedocs.io/en/latest/xcontrol.html#confining-in-a-cavity
- class pysisyphus.calculators.ExternalPotential.RMSD(geom, k, beta=0.5, atom_indices=None)[source]
Bases:
object
- __init__(geom, k, beta=0.5, atom_indices=None)[source]
Restrain based on RMSD with a reference geometry.
As described in https://doi.org/10.1021/acs.jctc.0c01306, Eq. (5).
- Parameters:
geom (
Geometry
) -- Reference geometry for RMSD calculation.k (
float
) -- Gaussian height in units of energy. Should be a negative number if the system under study should stay close to the reference geometry (pulling k). A positive Gaussian height k results in forces that push the system under study away from the reference geometry (pushing k).b -- Gaussian width in inverse units of lengths.
atom_indices (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]],None
], default:None
) -- Optional, numpy array or iterable of integer atom indices. Restricts the RMSD calculation to these atoms. If omitted, all atoms are used.
pysisyphus.calculators.FakeASE module
pysisyphus.calculators.FourWellAnaPot module
- class pysisyphus.calculators.FourWellAnaPot.FourWellAnaPot[source]
Bases:
AnaPotBase
pysisyphus.calculators.FreeEndNEBPot module
- class pysisyphus.calculators.FreeEndNEBPot.FreeEndNEBPot[source]
Bases:
AnaPotBase
pysisyphus.calculators.Gaussian09 module
- class pysisyphus.calculators.Gaussian09.Gaussian09(*args, **kwargs)[source]
Bases:
Gaussian16
- conf_key = 'gaussian09'
pysisyphus.calculators.Gaussian16 module
- class pysisyphus.calculators.Gaussian16.Gaussian16(route, gbs='', gen='', keep_chk=False, stable='', fchk=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'gaussian16'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- parse_log(*args, **kwargs)
- prepare_input(atoms, coords, calc_type, did_stable=False, point_charges=None)[source]
Meant to be extended.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
pysisyphus.calculators.HardSphere module
- class pysisyphus.calculators.HardSphere.HardSphere(geom, frags, kappa=1.0, permutations=False, frag_radii=None, radii_offset=0.9452)[source]
Bases:
object
- class pysisyphus.calculators.HardSphere.PWHardSphere(geom, frags, sub_frags, kappa=1.0)[source]
Bases:
object
pysisyphus.calculators.IDPPCalculator module
- class pysisyphus.calculators.IDPPCalculator.IDPPCalculator(target)[source]
Bases:
Calculator
pysisyphus.calculators.IPIClient module
pysisyphus.calculators.IPIServer module
- class pysisyphus.calculators.IPIServer.IPIServer(*args, address=None, host=None, port=None, unlink=True, hdrlen=12, max_retries=0, verbose=False, **kwargs)[source]
Bases:
Calculator
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- listen_kinds = ('coords', 'energy', 'forces', 'hessian')
pysisyphus.calculators.LEPSBase module
- class pysisyphus.calculators.LEPSBase.LEPSBase(pot_type='leps')[source]
Bases:
AnaPotBase
pysisyphus.calculators.LEPSExpr module
- class pysisyphus.calculators.LEPSExpr.LEPSExpr[source]
Bases:
object
- V_LEPS(x=None, y=None, abc=None)[source]
Equation (A.1) in [1]. Mimics reaction involving three atoms confined to motion along a line.
- V_dimer()[source]
III. Results Section A in [3]. Two additional saddle points from two added gaussians.
pysisyphus.calculators.LennardJones module
pysisyphus.calculators.MOPAC module
- class pysisyphus.calculators.MOPAC.MOPAC(method='PM7', **kwargs)[source]
Bases:
Calculator
- CALC_TYPES = {'energy': '1SCF', 'gradient': '1SCF GRADIENTS', 'hessian': 'DFORCE FORCE LET'}
- METHODS = ['am1', 'pm3', 'pm6', 'pm6-dh2', 'pm6-d3', 'pm6-dh+', 'pm6-dh2', 'pm6-dh2x', 'pm6-d3h4', 'pm6-d3h4x', 'pm7', 'pm7-ts']
- MULT_STRS = {1: 'SINGLET', 2: 'DOUBLET', 3: 'TRIPLET', 4: 'QUARTET', 5: 'QUINTET', 6: 'SEXTET', 7: 'SEPTET', 8: 'OCTET'}
- base_cmd
Do only SCF AUX: Creates a checkpoint file NOREO: Dont reorient geometry
- Type:
1SCF
- conf_key = 'mopac'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- static parse_energy_from_aux(inp, *args, **kwargs)
- static parse_hessian_from_aux(inp, *args, **kwargs)
- prepare_coords(atoms, coords, opt=False)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
pysisyphus.calculators.MullerBrownSympyPot module
- class pysisyphus.calculators.MullerBrownSympyPot.MullerBrownPot[source]
Bases:
AnaPotBase
pysisyphus.calculators.MultiCalc module
- class pysisyphus.calculators.MultiCalc.MultiCalc(calcs, **kwargs)[source]
Bases:
Calculator
pysisyphus.calculators.OBabel module
- class pysisyphus.calculators.OBabel.OBabel(ff='gaff', mol=None, **kwargs)[source]
Bases:
Calculator
- conv_dict = {'kcal/mol': 627.5094740630558, 'kj/mol': 2625.4996394798254}
pysisyphus.calculators.ONIOMv2 module
- class pysisyphus.calculators.ONIOMv2.LayerCalc(models, total_size, parent_layer_calc=None)[source]
Bases:
object
- property charge
- property mult
- class pysisyphus.calculators.ONIOMv2.Link(ind, parent_ind, atom, g)
Bases:
tuple
- atom
Alias for field number 2
- g
Alias for field number 3
- ind
Alias for field number 0
- parent_ind
Alias for field number 1
- class pysisyphus.calculators.ONIOMv2.Model(name, calc_level, calc, parent_name, parent_calc_level, parent_calc, atom_inds, parent_atom_inds, use_link_atoms=True)[source]
Bases:
object
- class pysisyphus.calculators.ONIOMv2.ONIOM(calcs, models, geom, layers=None, embedding='', real_key='real', use_link_atoms=True, *args, **kwargs)[source]
Bases:
Calculator
- __init__(calcs, models, geom, layers=None, embedding='', real_key='real', use_link_atoms=True, *args, **kwargs)[source]
- layer: list of models
len(layer) == 1: normal ONIOM, len(layer) >= 1: multicenter ONIOM.
- model:
(sub)set of all atoms that resides in a certain layer and has a certain calculator.
- atom_inds_in_layer(index, exclude_inner=False)[source]
Returns list of atom indices in layer at index.
Atoms that also appear in inner layer can be excluded on request.
- Parameters:
index (int) -- pasd
exclude_inner (bool, default=False, optional) -- Whether to exclude atom indices that also appear in inner layers.
- Returns:
atom_indices -- List containing the atom indices in the selected layer.
- Return type:
list
- property charge
- embeddings = {'': '', 'electronic': 'Electronic embedding', 'electronic_rc': 'Electronic embedding with redistributed charges', 'electronic_rcd': 'Electronic embedding with redistributed charges and dipoles'}
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property model_iter
- property mult
- pysisyphus.calculators.ONIOMv2.cap_fragment(atoms, coords, fragment, link_atom='H', g=None)[source]
pysisyphus.calculators.ORCA module
- class pysisyphus.calculators.ORCA.ORCA(keywords, blocks='', gbw=None, do_stable=False, numfreq=False, json_dump=True, **kwargs)[source]
Bases:
OverlapCalculator
- __init__(keywords, blocks='', gbw=None, do_stable=False, numfreq=False, json_dump=True, **kwargs)[source]
ORCA calculator.
Wrapper for creating ORCA input files for energy, gradient and Hessian calculations. The PAL and memory inputs must not be given in the keywords and/or blocks, as they are handled by the 'pal' and 'memory' arguments.
- Parameters:
keywords (str) -- Keyword line, as normally given in ORCA, excluding the leading "!".
blocks (str, optional) -- ORCA block input(s), e.g. for TD-DFT calculations (%tddft ... end). As the blocks start with a leading "%", wrapping the input in quotes ("") is required, otherwise the parsing will fail.
gbw (str, optional) -- Path to an input gbw file, which will be used as initial guess for the first calculation. Will be overriden later, with the path to the gbw file of a previous calculation.
do_stable (bool, optional) -- Run stability analysis until a stable wavefunction is obtained, before every calculation.
numfreq (bool, optional) -- Use numerical frequencies instead of analytical ones.
json_dump (bool, optional) -- Whether to dump the wavefunction to JSON via orca_2json. The JSON can become very large in calculations comprising many basis functions.
- check_termination(*args, **kwargs)
- conf_key = 'orca'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- static parse_atoms_coords(inp, *args, **kwargs)
- static parse_cis(cis)[source]
Simple wrapper of external function.
Currently, only returns Xα and Yα.
- static parse_engrad_info(inp, *args, **kwargs)
- static parse_hess_file(inp, *args, **kwargs)
- prepare_input(atoms, coords, calc_type, point_charges=None, do_stable=False)[source]
Meant to be extended.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- run_after(path)[source]
Meant to be extended.
This method is called after a calculation was done, but before entering
self.keep()
andself.clean()
. Can be used to call tools like formchk or ricctools.
- pysisyphus.calculators.ORCA.get_name(text)[source]
Return string that comes before first character & offset.
- pysisyphus.calculators.ORCA.parse_orca_cis(cis_fn)[source]
- Read binary CI vector file from ORCA.
Loosly based on TheoDORE 1.7.1, Authors: S. Mai, F. Plasser https://sourceforge.net/p/theodore-qc
- pysisyphus.calculators.ORCA.parse_orca_gbw(gbw_fn)[source]
Adapted from https://orcaforum.kofo.mpg.de/viewtopic.php?f=8&t=3299
The first 5 long int values represent pointers into the file:
Pointer @+0: Internal ORCA data structures Pointer @+8: Geometry Pointer @+16: BasisSet Pointer @+24: Orbitals Pointer @+32: ECP data
pysisyphus.calculators.ORCA5 module
pysisyphus.calculators.OpenMM module
- class pysisyphus.calculators.OpenMM.OpenMM(topology, params, **kwargs)[source]
Bases:
Calculator
pysisyphus.calculators.OpenMolcas module
- class pysisyphus.calculators.OpenMolcas.OpenMolcas(basis, inporb, rasscf=None, gateway=None, mcpdft=None, track=True, **kwargs)[source]
Bases:
Calculator
- conf_key = 'openmolcas'
- prepare_coords(atoms, coords)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
pysisyphus.calculators.OverlapCalculator module
- class pysisyphus.calculators.OverlapCalculator.NTOs(ntos, lambdas)
Bases:
tuple
- lambdas
Alias for field number 1
- ntos
Alias for field number 0
- class pysisyphus.calculators.OverlapCalculator.OverlapCalculator(*args, track=False, ovlp_type='tden', double_mol=False, ovlp_with='previous', adapt_args=(0.5, 0.3, 0.6), cdds=None, orient='', dump_fn='overlap_data.h5', h5_dump=False, conf_thresh=0.001, mos_ref='cur', mos_renorm=True, **kwargs)[source]
Bases:
Calculator
- H5_MAP = {'Ca': 'Ca_list', 'Cb': 'Cb_list', 'Xa': 'Xa_list', 'Xb': 'Xb_list', 'Ya': 'Ya_list', 'Yb': 'Yb_list', 'all_energies': 'all_energies_list', 'coords': 'coords_list', 'ref_roots': 'reference_roots', 'roots': 'roots_list'}
- OVLP_TYPE_VERBOSE = {'nto': 'natural transition orbital overlap', 'nto_org': 'original natural transition orbital overlap', 'tden': 'transition density matrix overlap', 'top': 'transition orbital pair overlap', 'wf': 'wavefunction overlap'}
- VALID_CDDS = (None, 'calc', 'render')
- VALID_KEYS = ['wf', 'tden', 'nto', 'nto_org', 'top']
- VALID_XY = ('X', 'X+Y', 'X-Y')
- conf_thresh
self.dyn_roots = int(dyn_roots) if self.dyn_roots != 0:
self.dyn_roots = 0 self.log("dyn_roots = 0 is hardcoded right now")
- property data_model
- get_indices(indices=None)[source]
A new root is determined by selecting the overlap matrix row corresponding to the reference root and checking for the root with the highest overlap (at the current geometry).
The overlap matrix is usually formed by a double loop like:
overlap_matrix = np.empty((ref_states, cur_states)) for i, ref_state in enumerate(ref_states):
- for j, cur_state in enumerate(cur_states):
overlap_matrix[i, j] = make_overlap(ref_state, cur_state)
So the reference states run along the rows. Thats why the ref_state index comes first in the 'indices' tuple.
- get_orbital_matrices(indices=None, S_AO=None)[source]
Return MO coefficents and AO overlaps for the given indices.
If not provided, a AO overlap matrix is constructed from one of the MO coefficient matrices (controlled by self.mos_ref). Also, if requested one of the two MO coefficient matrices is re-normalized.
- static get_sao_from_mo_coeffs(C)[source]
Recover AO overlaps from given MO coefficients.
For MOs in the columns of mo_coeffs:
S_AO = C⁻¹^T C⁻¹ S_AO C = C⁻¹^T (S_AO C)^T = C⁻¹ C^T S_AO^T = C⁻¹ C^T S_AO C = I
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- property stored_calculations
pysisyphus.calculators.Psi4 module
- class pysisyphus.calculators.Psi4.Psi4(method, basis, to_set=None, to_import=None, pcm='iefpcm', solvent=None, write_fchk=False, **kwargs)[source]
Bases:
Calculator
- conf_key = 'psi4'
pysisyphus.calculators.PyPsi4 module
- class pysisyphus.calculators.PyPsi4.PyPsi4(method, basis, **kwargs)[source]
Bases:
Calculator
pysisyphus.calculators.PySCF module
pysisyphus.calculators.PyXTB module
- class pysisyphus.calculators.PyXTB.PyXTB(*args, gfn=2, acc=None, verbosity=0, keep_calculator=False, **kwargs)[source]
Bases:
Calculator
pysisyphus.calculators.QCEngine module
pysisyphus.calculators.Rastrigin module
- class pysisyphus.calculators.Rastrigin.Rastrigin[source]
Bases:
AnaPotBase
pysisyphus.calculators.Remote module
- class pysisyphus.calculators.Remote.Remote(remote_calc, host, prefix='', **kwargs)[source]
Bases:
Calculator
pysisyphus.calculators.Rosenbrock module
- class pysisyphus.calculators.Rosenbrock.Rosenbrock[source]
Bases:
AnaPotBase
pysisyphus.calculators.SocketCalc module
- class pysisyphus.calculators.SocketCalc.SocketCalc(*args, host='localhost', port=8080, **kwargs)[source]
Bases:
Calculator
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- valid_requests = ('energy', 'forces', 'hessian')
pysisyphus.calculators.TIP3P module
- class pysisyphus.calculators.TIP3P.TIP3P(rc=9.44863062728914)[source]
Bases:
Calculator
Transferable Intermolecular Potential 3 Point
- aHOH = 104.52
- charges
- coulomb_energy = (multiple of elem. charge * multiple of elem. charge)
/ (distance in bohr) * 1 / (4 * pi * vacuum permittivity)
coulomb_prefactor converts everything to atomic units and it is ... drum roll ... 1. from scipy.constants import value as pcval self.coulomb_prefactor = (1 / (4 * np.pi) * pcval("elementary charge")**2
/ pcval("Hartree energy") / pcval("Bohr radius") / pcval("vacuum electric permittivity")
)
- epsilon = 0.0002423919586315716
- qH = 0.417
- qO = -0.834
- rOH = 1.8088458464917874
- sigma = 5.953790025507198
pysisyphus.calculators.TransTorque module
- class pysisyphus.calculators.TransTorque.TransTorque(frags, iter_frags, a_mats, b_mats, weight_func=None, skip=True, kappa=1.0, b_coords3d=None, do_trans=True)[source]
Bases:
object
pysisyphus.calculators.Turbomole module
- class pysisyphus.calculators.Turbomole.Turbomole(control_path=None, simple_input=None, root=None, double_mol_path=None, cosmo_kwargs=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'turbomole'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- parse_double_mol(path)[source]
Parse a double molecule overlap matrix from Turbomole output to be used with WFOWrapper.
- parse_gs_energy()[source]
Several places are possible: $subenergy from control file total energy from turbomole.out Final MP2 energy from turbomole.out with ADC(2) Final CC2 energy from turbomole.out with CC(2)
- parse_td_vectors(text)[source]
For TDA calculations only the X vector is present in the ciss_a/etc. file. In TDDFT calculations there are twise as much items compared with TDA. The first half corresponds to (X+Y) and the second half to (X-Y). X can be calculated as X = ((X+Y)+(X-Y))/2. Y is then given as Y = (X+Y)-X. The normalization can then by checked as
np.concatenate((X, Y)).dot(np.concatenate((X, -Y)))
and should be 1.
- static parse_tddft_tden(inp, *args, **kwargs)
- prepare_input(atoms, coords, calc_type, point_charges=None)[source]
To rectify this we have to construct the basecmd dynamically and construct it ad hoc. We could set a RI flag in the beginning and select the correct scf binary here from it. Then we select the following binary on demand, e.g. aoforce or rdgrad or egrad etc.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- pysisyphus.calculators.Turbomole.control_from_simple_input(simple_inp, charge, mult, cosmo_kwargs=None)[source]
Create control file from 'simple input'.
See examples/opt/26_turbomole_simple_input/ for an example.
pysisyphus.calculators.WFOWrapper module
- class pysisyphus.calculators.WFOWrapper.WFOWrapper(occ_mo_num, virt_mo_num, conf_thresh=0.001, calc_number=0, out_dir='./', wfow_mem=8000, ncore=0, debug=False)[source]
Bases:
object
- property conf_thresh
- fake_turbo_mos(mo_coeffs)[source]
Create a mos file suitable for TURBOMOLE input. All MO eigenvalues are set to 0.0. There is also a little deviation in the formatting (see turbo_fmt()) but it works ...
- generate_all_dets(occ_set1, virt_set1, occ_set2, virt_set2)[source]
Generate all possible single excitation determinant strings from union(occ_mos) to union(virt_mos).
- logger = <Logger wfoverlap (DEBUG)>
- matrix_types = {'ortho': 'Orthonormalized overlap matrix', 'ovlp': 'Overlap matrix', 'renorm': 'Renormalized overlap matrix'}
pysisyphus.calculators.WFOWrapper2 module
- class pysisyphus.calculators.WFOWrapper2.WFOWrapper2(overlap_data, calc_number=0, conf_thresh=0.0001, out_dir='./')[source]
Bases:
object
- static fake_turbo_mos(mo_coeffs)[source]
Create a mos file suitable for TURBOMOLE input. All MO eigenvalues are set to 0.0. There is also a little deviation in the formatting (see turbo_fmt()) but it works ...
- generate_all_dets(occ_set1, virt_set1, occ_set2, virt_set2)[source]
Generate all possible single excitation determinant strings from union(occ_mos) to union(virt_mos).
- property last_two_coords
- logger = <Logger wfoverlap (DEBUG)>
- matrix_types = {'ortho': 'Orthonormalized overlap matrix', 'ovlp': 'Overlap matrix', 'renorm': 'Renormalized overlap matrix'}
pysisyphus.calculators.XTB module
- class pysisyphus.calculators.XTB.OptResult(opt_geom, opt_log)
Bases:
tuple
- opt_geom
Alias for field number 0
- opt_log
Alias for field number 1
- class pysisyphus.calculators.XTB.XTB(gbsa='', alpb='', gfn=2, acc=1.0, iterations=250, etemp=None, retry_etemp=None, restart=False, topo=None, topo_update=None, quiet=False, **kwargs)[source]
Bases:
Calculator
- __init__(gbsa='', alpb='', gfn=2, acc=1.0, iterations=250, etemp=None, retry_etemp=None, restart=False, topo=None, topo_update=None, quiet=False, **kwargs)[source]
XTB calculator.
Wrapper for running energy, gradient and Hessian calculations by XTB.
- Parameters:
gbsa (str, optional) -- Solvent for GBSA calculation, by default no solvent model is used.
alpb (str, optional) -- Solvent for ALPB calculation, by default no solvent model is used.
gfn (int or str, must be (0, 1, 2, or "ff")) -- Hamiltonian for the XTB calculation (GFN0, GFN1, GFN2, or GFNFF).
acc (float, optional) -- Accuracy control of the calculation, the lower the tighter several numerical thresholds are chosen.
iterations (int, optional) -- The number of iterations in SCC calculation.
topo (str, optional) -- Path the a GFNFF-topolgy file. As setting up the topology may take some time for sizable systems, it may be desired to reuse the file.
topo_update (int) -- Integer controlling the update interval of the GFNFF topology update. If supplied, the topolgy will be recreated every N-th calculation.
mem (int) -- Mememory per core in MB.
quiet (bool, optional) -- Suppress creation of log files.
- static check_termination(inp, *args, **kwargs)
- conf_key = 'xtb'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- prepare_coords(atoms, coords)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
pysisyphus.calculators.parser module
Module contents
- class pysisyphus.calculators.AFIR(calculator, fragment_indices, gamma, rho=1, p=6, ignore_hydrogen=False, zero_hydrogen=True, complete_fragments=True, dump=True, h5_fn='afir.h5', h5_group_name='afir', **kwargs)[source]
Bases:
Calculator
- __init__(calculator, fragment_indices, gamma, rho=1, p=6, ignore_hydrogen=False, zero_hydrogen=True, complete_fragments=True, dump=True, h5_fn='afir.h5', h5_group_name='afir', **kwargs)[source]
Artifical Force Induced Reaction calculator.
Currently, there are no automated drivers to run large-scale AFIR calculations with many different initial orientations and/or increasing collision energy parameter γ. Nontheless, selected AFIR calculations can be carried out by hand. After convergence, artificial potential & forces, as well as real energies and forces can be plotted with 'pysisplot --afir'. The highest energy point along the AFIR path can then be selected for a subsequent TS-optimization, e.g. via 'pysistrj --get [index] optimzation.trj'.
Future versions of pysisyphus may provide drivers for more automatted AFIR calculations.
- Parameters:
calculator (
Calculator
) -- Actual QC calculator that provides energies and its derivatives, that are modified by the AFIR calculator, e.g., ORCA or Psi4.fragment_indices (
List
[List
[int
]]) -- List of lists of integers, specifying the separate fragments. If the indices in theses lists don't comprise all atoms in the molecule, the reamining indices will be added as a separate fragment. If a AFIR calculation is carried out with 2 fragments and 'complete_fragments' is True (see below) it is enough to specify only the indices of one fragment, e.g., for a system of 10 atoms 'fragment_indices=[[0,1,2,3]]' is enough. The second system will be set up automatically with indices [4,5,6,7,8,9].gamma (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]) -- Collision energy parameter γ in au. For 2 fragments it can be a single integer, while for > 2 fragments a list of gammas must be given, specifying the pair-wise collision energy parameters. For 3 fragments 3 gammas must be given [γ_01, γ_02, γ_12], for 4 fragments 6 gammas would be required [γ_01, γ_02, γ_03, γ_12, γ_13, γ_23] and so on.rho (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]], default:1
) -- Direction of the artificial force, either 1 or -1. The same comments as for gamma apply. For 2 fragments a single integer is enough, for > 2 fragments a list of rhos must be given (see above). For rho=1 fragments are pushed together, for rho=-1 fragments are pulled apart.p (
int
, default:6
) -- Exponent p used in the calculation of the weight function ω. Defaults to 6 and probably does not have to be changed.ignore_hydrogen (
bool
, default:False
) -- Whether hydrogens are ignored in the calculation of the artificial force. All weights between atom pairs containing hydrogen will be set to 0.zero_hydrogen (
bool
, default:True
) -- Whether to use 0.0 as covalent radius for hydrogen in the weight function. Compared to 'ignore_hydrogen', which results in zero weights for all atom pairs involving hydrogen, 'zero_hydrogen' may be non-zero, depending on the covalent radius of the second atom in the pair.complete_fragments (
bool
, default:True
) -- Whether an incomplete specification in 'fragment_indices' is automatically completed.dump (
bool
, default:True
) -- Whether an HDF5 file is created.h5_fn (
str
, default:'afir.h5'
) -- Filename of the HDF5 file used for dumping.h5_group_name (
str
, default:'afir'
) -- HDF5 group name used for dumping.**kwargs -- Keyword arguments passed to the Calculator baseclass.
- property charge
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property mult
- set_atoms_and_funcs(atoms, coords)[source]
Initially atoms was also an argument to the constructor of AFIR. I removed it so creation becomes easier. The first time a calculation is requested with a proper atom set everything is set up (cov. radii, afir function and corresponding gradient). Afterwards there is only a check if atoms != None and it is expected that all functions are properly set.
fragment_indices can also be incomplete w.r.t. to the number of atoms. If the sum of the specified fragment atoms is less than the number of atoms present then all remaining unspecified atoms will be gathered in one fragment.
- class pysisyphus.calculators.AtomAtomTransTorque(geom, frags, A_mats, kappa=2.0)[source]
Bases:
object
- class pysisyphus.calculators.CFOUR(cfour_input, wavefunction_dump=True, initden_file=None, **kwargs)[source]
Bases:
Calculator
- __init__(cfour_input, wavefunction_dump=True, initden_file=None, **kwargs)[source]
CFOUR calculator.
Wrapper handling CFOUR ground state energy and gradient calculations.
- Parameters:
cfour_input (dict) -- CFOUR keywords and values. Note: "on" must be encapsulated in quotes to avoid being translated to True by YAML.
wavefunction_dump (bool, optional) -- Whether or not to keep ground state SCF orbitals for each geometry step.
initden_file (str, optional) -- Path to an input initden file for use as a guess SCF density.
- conf_key = 'cfour'
- keep(path)[source]
Backup calculation results.
- Parameters:
path (Path) -- Temporary directory of the calculation.
- Returns:
kept_fns -- Dictonary holding the filenames that were backed up. The keys correspond to the type of file.
- Return type:
dict
- prepare(inp)[source]
Prepare a temporary directory and write input.
Similar to prepare_path, but the input is also written into the prepared directory.
Paramters
- inpstr
Input to be written into the file
self.inp_fn
in the prepared directory.
- returns:
- path: Path
Prepared directory.
- prepare_coords(atoms, coords)[source]
Get 3d coords in Bohr
Reshape internal 1d coords to 3d.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Bohr.
- Return type:
np.array, 3d
- class pysisyphus.calculators.Composite(final, keys_calcs=None, calcs=None, remove_translation=False, **kwargs)[source]
Bases:
Calculator
- class pysisyphus.calculators.ConicalIntersection(calculator1, calculator2, **kwargs)[source]
Bases:
Calculator
Calculator for conical intersection optimization.
Based on [1].
- class pysisyphus.calculators.DFTBp(parameter, *args, slakos=None, root=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'dftbp'
- hubbard_derivs = {'3ob': {'Br': -0.0573, 'C': -0.1492, 'Ca': -0.034, 'Cl': -0.0697, 'F': -0.1623, 'H': -0.1857, 'I': -0.0433, 'K': -0.0339, 'Mg': -0.02, 'N': -0.1535, 'Na': -0.0454, 'O': -0.1575, 'P': -0.14, 'S': -0.11, 'Zn': -0.03}}
- max_ang_moms = {'3ob': {'Br': 'd', 'C': 'p', 'Ca': 'p', 'Cl': 'd', 'F': 'p', 'H': 's', 'I': 'd', 'K': 'p', 'Mg': 'p', 'N': 'p', 'Na': 'p', 'O': 'p', 'P': 'd', 'S': 'd', 'Zn': 'd'}, 'mio-ext': {'C': 'p', 'H': 's', 'N': 'p', 'O': 'p'}}
- class pysisyphus.calculators.DFTD4(method=None, damp_params=None, model_params=None, **kwargs)[source]
Bases:
Calculator
- class pysisyphus.calculators.Dimer(calculator, *args, N_raw=None, length=0.0189, rotation_max_cycles=15, rotation_method='fourier', rotation_thresh=0.0001, rotation_tol=1, rotation_max_element=0.001, rotation_interpolate=True, rotation_disable=False, rotation_disable_pos_curv=True, rotation_remove_trans=True, trans_force_f_perp=True, bonds=None, N_hessian=None, bias_rotation=False, bias_translation=False, bias_gaussian_dot=0.1, seed=None, write_orientations=True, forward_hessian=True, **kwargs)[source]
Bases:
Calculator
- property C
Shortcut for the curvature.
- property N
- property can_bias_f0
- property can_bias_f1
- property coords0
- property coords1
- property energy0
- property f0
- property f1
- property f1_bias
- property f2
Never calculated explicitly, but estimated from f0 and f1.
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property rot_force
- property should_bias_f0
May lead to calculation of f0 and/or f1 if present!
- property should_bias_f1
May lead to calculation of f0 and/or f1 if present!
- class pysisyphus.calculators.Dummy(calc_number=0, charge=0, mult=1, base_name='calculator', pal=1, mem=1000, keep_kind='all', check_mem=True, retry_calc=0, last_calc_cycle=None, clean_after=True, out_dir='qm_calcs', force_num_hess=False, num_hess_kwargs=None)[source]
Bases:
Calculator
- class pysisyphus.calculators.EGO(calculator, ref_geom, max_force=0.175, **kwargs)[source]
Bases:
Calculator
- property ref_hessian
- property s
- class pysisyphus.calculators.EnergyMin(calculator1, calculator2, mix=False, alpha=0.02, sigma=3.5, min_energy_diff=0.0, check_after=0, **kwargs)[source]
Bases:
Calculator
- __init__(calculator1, calculator2, mix=False, alpha=0.02, sigma=3.5, min_energy_diff=0.0, check_after=0, **kwargs)[source]
Use energy and derivatives of the calculator with lower energy.
This calculators carries out two calculations with different settings and returns the results of the lower energy one. This can be used to consider flips between a singlet and a triplet PES etc.
- Parameters:
calculator1 (
Calculator
) -- Wrapped QC calculator that provides energies and its derivatives.calculator2 (
Calculator
) -- Wrapped QC calculator that provides energies and its derivatives.mix (
bool
, default:False
) -- Enable mixing of both forces, according to the approach outlined in [2]. Can be used to optimize guesses for MECPs. Passalpha (
float
, default:0.02
) -- Smoothing parameter in Hartree. See [2] for a discussion.sigma (
float
, default:3.5
) -- Unitless gap size parameter. The final gap becomes smaller for bigga sigmas. Has to be adapted for each case. See [2] for a discussion (p. 407 right column and p. 408 left column.)min_energy_diff (
float
, default:0.0
) -- Energy difference in Hartree. When set to a value != 0 and the energy difference between both calculators drops below this value, execution of both calculations is diabled for 'check_after' cycles. In these cycles the calculator choice remains fixed. After 'check_after' cycles, both energies will be calculated and it is checked, if the previous calculator choice remains valid. In conjunction with 'check_after' both arguments can be used to save computational ressources.check_after (
int
, default:0
) -- Amount of cycles in which the calculator choice remains fixed.**kwargs -- Keyword arguments passed to the Calculator baseclass.
- class pysisyphus.calculators.ExternalPotential(calculator=None, potentials=None, geom=None, **kwargs)[source]
Bases:
Calculator
- available_potentials = {'d3': <class 'pysisyphus.calculators.DFTD3.DFTD3'>, 'harmonic_sphere': <class 'pysisyphus.calculators.ExternalPotential.HarmonicSphere'>, 'logfermi': <class 'pysisyphus.calculators.ExternalPotential.LogFermi'>, 'restraint': <class 'pysisyphus.calculators.ExternalPotential.Restraint'>, 'rmsd': <class 'pysisyphus.calculators.ExternalPotential.RMSD'>}
- class pysisyphus.calculators.Gaussian09(*args, **kwargs)[source]
Bases:
Gaussian16
- conf_key = 'gaussian09'
- class pysisyphus.calculators.Gaussian16(route, gbs='', gen='', keep_chk=False, stable='', fchk=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'gaussian16'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- parse_log(*args, **kwargs)
- prepare_input(atoms, coords, calc_type, did_stable=False, point_charges=None)[source]
Meant to be extended.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- class pysisyphus.calculators.HardSphere(geom, frags, kappa=1.0, permutations=False, frag_radii=None, radii_offset=0.9452)[source]
Bases:
object
- class pysisyphus.calculators.IPIServer(*args, address=None, host=None, port=None, unlink=True, hdrlen=12, max_retries=0, verbose=False, **kwargs)[source]
Bases:
Calculator
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- listen_kinds = ('coords', 'energy', 'forces', 'hessian')
- class pysisyphus.calculators.LennardJones(sigma=1.8897261251, epsilon=1, rc=None)[source]
Bases:
Calculator
- class pysisyphus.calculators.MOPAC(method='PM7', **kwargs)[source]
Bases:
Calculator
- CALC_TYPES = {'energy': '1SCF', 'gradient': '1SCF GRADIENTS', 'hessian': 'DFORCE FORCE LET'}
- METHODS = ['am1', 'pm3', 'pm6', 'pm6-dh2', 'pm6-d3', 'pm6-dh+', 'pm6-dh2', 'pm6-dh2x', 'pm6-d3h4', 'pm6-d3h4x', 'pm7', 'pm7-ts']
- MULT_STRS = {1: 'SINGLET', 2: 'DOUBLET', 3: 'TRIPLET', 4: 'QUARTET', 5: 'QUINTET', 6: 'SEXTET', 7: 'SEPTET', 8: 'OCTET'}
- base_cmd
Do only SCF AUX: Creates a checkpoint file NOREO: Dont reorient geometry
- Type:
1SCF
- conf_key = 'mopac'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- static parse_energy_from_aux(inp, *args, **kwargs)
- static parse_hessian_from_aux(inp, *args, **kwargs)
- prepare_coords(atoms, coords, opt=False)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
- class pysisyphus.calculators.MultiCalc(calcs, **kwargs)[source]
Bases:
Calculator
- class pysisyphus.calculators.OBabel(ff='gaff', mol=None, **kwargs)[source]
Bases:
Calculator
- conv_dict = {'kcal/mol': 627.5094740630558, 'kj/mol': 2625.4996394798254}
- class pysisyphus.calculators.ONIOM(calcs, models, geom, layers=None, embedding='', real_key='real', use_link_atoms=True, *args, **kwargs)[source]
Bases:
Calculator
- __init__(calcs, models, geom, layers=None, embedding='', real_key='real', use_link_atoms=True, *args, **kwargs)[source]
- layer: list of models
len(layer) == 1: normal ONIOM, len(layer) >= 1: multicenter ONIOM.
- model:
(sub)set of all atoms that resides in a certain layer and has a certain calculator.
- atom_inds_in_layer(index, exclude_inner=False)[source]
Returns list of atom indices in layer at index.
Atoms that also appear in inner layer can be excluded on request.
- Parameters:
index (int) -- pasd
exclude_inner (bool, default=False, optional) -- Whether to exclude atom indices that also appear in inner layers.
- Returns:
atom_indices -- List containing the atom indices in the selected layer.
- Return type:
list
- property charge
- embeddings = {'': '', 'electronic': 'Electronic embedding', 'electronic_rc': 'Electronic embedding with redistributed charges', 'electronic_rcd': 'Electronic embedding with redistributed charges and dipoles'}
- get_hessian(atoms, coords)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- property model_iter
- property mult
- class pysisyphus.calculators.ORCA(keywords, blocks='', gbw=None, do_stable=False, numfreq=False, json_dump=True, **kwargs)[source]
Bases:
OverlapCalculator
- __init__(keywords, blocks='', gbw=None, do_stable=False, numfreq=False, json_dump=True, **kwargs)[source]
ORCA calculator.
Wrapper for creating ORCA input files for energy, gradient and Hessian calculations. The PAL and memory inputs must not be given in the keywords and/or blocks, as they are handled by the 'pal' and 'memory' arguments.
- Parameters:
keywords (str) -- Keyword line, as normally given in ORCA, excluding the leading "!".
blocks (str, optional) -- ORCA block input(s), e.g. for TD-DFT calculations (%tddft ... end). As the blocks start with a leading "%", wrapping the input in quotes ("") is required, otherwise the parsing will fail.
gbw (str, optional) -- Path to an input gbw file, which will be used as initial guess for the first calculation. Will be overriden later, with the path to the gbw file of a previous calculation.
do_stable (bool, optional) -- Run stability analysis until a stable wavefunction is obtained, before every calculation.
numfreq (bool, optional) -- Use numerical frequencies instead of analytical ones.
json_dump (bool, optional) -- Whether to dump the wavefunction to JSON via orca_2json. The JSON can become very large in calculations comprising many basis functions.
- check_termination(*args, **kwargs)
- conf_key = 'orca'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- static parse_atoms_coords(inp, *args, **kwargs)
- static parse_cis(cis)[source]
Simple wrapper of external function.
Currently, only returns Xα and Yα.
- static parse_engrad_info(inp, *args, **kwargs)
- static parse_hess_file(inp, *args, **kwargs)
- prepare_input(atoms, coords, calc_type, point_charges=None, do_stable=False)[source]
Meant to be extended.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- run_after(path)[source]
Meant to be extended.
This method is called after a calculation was done, but before entering
self.keep()
andself.clean()
. Can be used to call tools like formchk or ricctools.
- class pysisyphus.calculators.ORCA5(keywords, blocks='', gbw=None, do_stable=False, numfreq=False, json_dump=True, **kwargs)[source]
Bases:
ORCA
- conf_key = 'orca5'
- class pysisyphus.calculators.OpenMolcas(basis, inporb, rasscf=None, gateway=None, mcpdft=None, track=True, **kwargs)[source]
Bases:
Calculator
- conf_key = 'openmolcas'
- prepare_coords(atoms, coords)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
- class pysisyphus.calculators.Psi4(method, basis, to_set=None, to_import=None, pcm='iefpcm', solvent=None, write_fchk=False, **kwargs)[source]
Bases:
Calculator
- conf_key = 'psi4'
- class pysisyphus.calculators.PyPsi4(method, basis, **kwargs)[source]
Bases:
Calculator
- class pysisyphus.calculators.PyXTB(*args, gfn=2, acc=None, verbosity=0, keep_calculator=False, **kwargs)[source]
Bases:
Calculator
- class pysisyphus.calculators.Remote(remote_calc, host, prefix='', **kwargs)[source]
Bases:
Calculator
- class pysisyphus.calculators.TIP3P(rc=9.44863062728914)[source]
Bases:
Calculator
Transferable Intermolecular Potential 3 Point
- aHOH = 104.52
- charges
- coulomb_energy = (multiple of elem. charge * multiple of elem. charge)
/ (distance in bohr) * 1 / (4 * pi * vacuum permittivity)
coulomb_prefactor converts everything to atomic units and it is ... drum roll ... 1. from scipy.constants import value as pcval self.coulomb_prefactor = (1 / (4 * np.pi) * pcval("elementary charge")**2
/ pcval("Hartree energy") / pcval("Bohr radius") / pcval("vacuum electric permittivity")
)
- epsilon = 0.0002423919586315716
- qH = 0.417
- qO = -0.834
- rOH = 1.8088458464917874
- sigma = 5.953790025507198
- class pysisyphus.calculators.TransTorque(frags, iter_frags, a_mats, b_mats, weight_func=None, skip=True, kappa=1.0, b_coords3d=None, do_trans=True)[source]
Bases:
object
- class pysisyphus.calculators.Turbomole(control_path=None, simple_input=None, root=None, double_mol_path=None, cosmo_kwargs=None, **kwargs)[source]
Bases:
OverlapCalculator
- conf_key = 'turbomole'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- parse_double_mol(path)[source]
Parse a double molecule overlap matrix from Turbomole output to be used with WFOWrapper.
- parse_gs_energy()[source]
Several places are possible: $subenergy from control file total energy from turbomole.out Final MP2 energy from turbomole.out with ADC(2) Final CC2 energy from turbomole.out with CC(2)
- parse_td_vectors(text)[source]
For TDA calculations only the X vector is present in the ciss_a/etc. file. In TDDFT calculations there are twise as much items compared with TDA. The first half corresponds to (X+Y) and the second half to (X-Y). X can be calculated as X = ((X+Y)+(X-Y))/2. Y is then given as Y = (X+Y)-X. The normalization can then by checked as
np.concatenate((X, Y)).dot(np.concatenate((X, -Y)))
and should be 1.
- static parse_tddft_tden(inp, *args, **kwargs)
- prepare_input(atoms, coords, calc_type, point_charges=None)[source]
To rectify this we have to construct the basecmd dynamically and construct it ad hoc. We could set a RI flag in the beginning and select the correct scf binary here from it. Then we select the following binary on demand, e.g. aoforce or rdgrad or egrad etc.
- prepare_overlap_data(path)[source]
This method has to implement the calculator specific parsing of MO-coefficients, CI-coefficients and energies. Should return a filename pointing to TURBOMOLE like mos, a MO coefficient array and a CI coefficient array.
- class pysisyphus.calculators.XTB(gbsa='', alpb='', gfn=2, acc=1.0, iterations=250, etemp=None, retry_etemp=None, restart=False, topo=None, topo_update=None, quiet=False, **kwargs)[source]
Bases:
Calculator
- __init__(gbsa='', alpb='', gfn=2, acc=1.0, iterations=250, etemp=None, retry_etemp=None, restart=False, topo=None, topo_update=None, quiet=False, **kwargs)[source]
XTB calculator.
Wrapper for running energy, gradient and Hessian calculations by XTB.
- Parameters:
gbsa (str, optional) -- Solvent for GBSA calculation, by default no solvent model is used.
alpb (str, optional) -- Solvent for ALPB calculation, by default no solvent model is used.
gfn (int or str, must be (0, 1, 2, or "ff")) -- Hamiltonian for the XTB calculation (GFN0, GFN1, GFN2, or GFNFF).
acc (float, optional) -- Accuracy control of the calculation, the lower the tighter several numerical thresholds are chosen.
iterations (int, optional) -- The number of iterations in SCC calculation.
topo (str, optional) -- Path the a GFNFF-topolgy file. As setting up the topology may take some time for sizable systems, it may be desired to reuse the file.
topo_update (int) -- Integer controlling the update interval of the GFNFF topology update. If supplied, the topolgy will be recreated every N-th calculation.
mem (int) -- Mememory per core in MB.
quiet (bool, optional) -- Suppress creation of log files.
- static check_termination(inp, *args, **kwargs)
- conf_key = 'xtb'
- get_hessian(atoms, coords, **prepare_kwargs)[source]
Get Hessian matrix. Fall back to numerical Hessian, if not overriden.
Preferrably, this method should provide an analytical Hessian.
- prepare_coords(atoms, coords)[source]
Get 3d coords in Angstrom.
Reshape internal 1d coords to 3d and convert to Angstrom.
- Parameters:
atoms (iterable) -- Atom descriptors (element symbols).
coords (np.array, 1d) -- 1D-array holding coordinates in Bohr.
- Returns:
coords -- 3D-array holding coordinates in Angstrom.
- Return type:
np.array, 3d
pysisyphus.cos package
Submodules
pysisyphus.cos.AdaptiveNEB module
- class pysisyphus.cos.AdaptiveNEB.AdaptiveNEB(images, adapt=True, adapt_fact=0.25, adapt_between=1, scale_fact=False, keep_hei=True, free_ends=True, **kwargs)[source]
Bases:
NEB
- __init__(images, adapt=True, adapt_fact=0.25, adapt_between=1, scale_fact=False, keep_hei=True, free_ends=True, **kwargs)[source]
(Free-End) Adaptive Nudged Elastic Band.
- Parameters:
images (list of Geometry objects) -- Images of the band.
adapt (bool, default True) -- Whether to adapt the image number or not. This switch is included to support the FreeEndNEB class, that is just a thin wrapper around this class.
adapt_fact (positive float) -- Factor that is used to decide wether to adapt. The inital threshold is calculated by multiplying the RMS force of the band with this factor. When the RMS of the force falls below this threshold adaption takes place.
adapat_between (positive integer) -- Number of images to interpolate between the highest energy image and its neighbours. The number of starting images must be higher or equal then 2*adapt_between+3, as we reuse/transfer the calculators from the starting images onto the new ones.
scale_fact (bool, default False) -- Whether to increase adapt_fact in deeper levels. This may lead to earlier adapation.
keep_hei (bool, optional) -- Whether to keep the highest energy image (usually a very good idea) or to interpolate only between the neighbouring images.
free_ends (bool, default True) -- Whether to use modified forces on the end images.
- adapt_this_cycle(forces)[source]
Decide wether to adapt.
- Parameters:
forces (np.array) -- Forces of the previous optimization cycle.
- Returns:
adapt -- Flag that indicates if adaption should take place in this cycle.
- Return type:
bool
- property forces
See Eq. (7) in [2].
pysisyphus.cos.ChainOfStates module
- class pysisyphus.cos.ChainOfStates.ChainOfStates(images, fix_first=True, fix_last=True, align_fixed=True, climb=False, climb_rms=0.005, climb_lanczos=False, climb_lanczos_rms=0.005, climb_fixed=True, energy_min_mix=False, scheduler=None, progress=False)[source]
Bases:
object
- property atoms
- property calculator
- property cart_coords
Return a flat 1d array containing the cartesian coordinates of all images.
- property coords
Return a flat 1d array containing the coordinates of all images.
- property coords3d
- property energy
- property forces
- get_tangent(i, kind='upwinding', lanczos_guess=None, disable_lanczos=False)[source]
[1] Equations (8) - (11)
- property gradient
- property image_coords
- property image_inds
- property last_index
- logger = <Logger cos (DEBUG)>
- property masses_rep
- property max_image_num
- property moving_images
- property moving_indices
Returns the indices of the images that aren't fixed and can be optimized.
- property perpendicular_forces
- prepare_opt_cycle(last_coords, last_energies, last_forces)[source]
Implements additional logic in preparation of the next optimization cycle.
Should be called by the optimizer at the beginning of a new optimization cycle. Can be used to implement additional logic as needed for AdaptiveNEB etc.
- property results
- rms(arr)[source]
Root mean square
Returns the root mean square of the given array.
- Parameters:
arr (iterable of numbers)
- Returns:
rms -- Root mean square of the given array.
- Return type:
float
- set_coords_at(i, coords)[source]
Called from helpers.procrustes with cartesian coordinates. Then tries to set cartesian coordinate as self.images[i].coords which will raise an error when coord_type != "cart".
- set_zero_forces_for_fixed_images()[source]
This is always done in cartesian coordinates, independent of the actual coord_type of the images as setting forces only work with cartesian forces.
- valid_coord_types = ('cart', 'cartesian', 'dlc')
pysisyphus.cos.FreeEndNEB module
- class pysisyphus.cos.FreeEndNEB.FreeEndNEB(*args, fix_first=False, fix_last=False, **kwargs)[source]
Bases:
AdaptiveNEB
- __init__(*args, fix_first=False, fix_last=False, **kwargs)[source]
Simple Free-End-NEB method.
Derived from AdaptiveNEB with disabled adaptation. Only implements Eq. (7) from [2]. For other implementations please see the commit 01bc8812ca6f1cd3645d43e0337d9e3c5fb0ba55. There the other variants are present but I think Eq. (7) in [2] is the simplest & best bet.
pysisyphus.cos.FreezingString module
pysisyphus.cos.GrowingChainOfStates module
- class pysisyphus.cos.GrowingChainOfStates.GrowingChainOfStates(images, calc_getter, max_nodes=10, **kwargs)[source]
Bases:
ChainOfStates
- property arc_dims
- property max_image_num
pysisyphus.cos.GrowingNT module
- class pysisyphus.cos.GrowingNT.GrowingNT(geom, step_len=0.5, rms_thresh=0.0017, r=None, final_geom=None, between=None, bonds=None, r_update=True, r_update_thresh=1.0, stop_after_ts=False, require_imag_freq=0.0, hessian_at_ts=False, out_dir='.', dump=True)[source]
Bases:
object
- property P
Projector that keeps perpendicular component.
- property atoms
- property cart_coords
- property cart_forces
- property coords
- property energy
- property forces
- logger = <Logger cos (DEBUG)>
- property r
Parallel/search direction.
pysisyphus.cos.GrowingString module
- class pysisyphus.cos.GrowingString.GrowingString(images, calc_getter, perp_thresh=0.05, param='equi', reparam_every=2, reparam_every_full=3, reparam_tol=None, reparam_check='rms', max_micro_cycles=5, reset_dlc=True, climb=False, **kwargs)[source]
Bases:
GrowingChainOfStates
- property forces
- property full_string_image_inds
- property fully_grown
Returns wether the string is fully grown. Don't count the first and last node.
- get_new_image(ref_index)[source]
Get new image by taking a step from self.images[ref_index] towards the center of the string.
- property image_inds
- property left_size
- property lf_ind
Index of the left frontier node in self.images.
- property nodes_missing
Returns the number of nodes to be grown.
- property rf_ind
Index of the right frontier node in self.images.
- property right_size
- property string_size
pysisyphus.cos.NEB module
- class pysisyphus.cos.NEB.NEB(images, variable_springs=False, k_max=0.3, k_min=0.1, perp_spring_forces=None, bandwidth=None, **kwargs)[source]
Bases:
ChainOfStates
- property forces
- property parallel_forces
pysisyphus.cos.SimpleZTS module
- class pysisyphus.cos.SimpleZTS.SimpleZTS(images, param='equal', **kwargs)[source]
Bases:
ChainOfStates
Module contents
pysisyphus.db package
Submodules
pysisyphus.db.generate_db module
pysisyphus.db.helpers module
pysisyphus.db.level module
pysisyphus.db.molecules module
Module contents
pysisyphus.drivers package
Submodules
pysisyphus.drivers.afir module
- class pysisyphus.drivers.afir.AFIRPath(atoms, cart_coords, energies, forces, charge, mult, opt_is_converged=None, gamma=None, path_indices=None)[source]
Bases:
object
-
atoms:
tuple
-
cart_coords:
ndarray
-
charge:
int
-
energies:
ndarray
-
forces:
ndarray
-
gamma:
Optional
[float
] = None
-
mult:
int
-
opt_is_converged:
Optional
[bool
] = None
-
path_indices:
Optional
[List
[int
]] = None
-
atoms:
- pysisyphus.drivers.afir.automatic_fragmentation(atoms, coords3d, frag1, frag2, cycles=2, p=6, bond_factor=1.25)[source]
Automatic fragmentation scheme as described in SC-AFIR paper [1].
- pysisyphus.drivers.afir.coordinates_similar(test_coords3d, ref_coords3d, rmsd_thresh=0.01)[source]
- Return type:
Tuple
[bool
,int
]
- pysisyphus.drivers.afir.determine_target_pairs(atoms, coords3d, min_=1.25, max_=5.0, active_atoms=None)[source]
Determine possible target m, n atom pairs for SC-AFIR calculations.
- Return type:
List
[Tuple
[int
]]
- pysisyphus.drivers.afir.determine_target_pairs_for_geom(geom, **kwargs)[source]
Determine possible target m, n atom pairs for SC-AFIR calculations from geom.
- Return type:
List
[Tuple
[int
]]
- pysisyphus.drivers.afir.generate_random_union(geoms, offset=2.0, rng=None)[source]
Unite fragments into one Geometry with random fragment orientations.
Center, rotate and translate from origin acoording to approximate radius and an offset. Displace along +x, -x, +y, -y, +z, -z.
Results for > 3 fragments don't look so pretty ;).
- pysisyphus.drivers.afir.generate_random_union_ref(geoms, rng=None, opt_kwargs=None)[source]
Unite fragments into one Geometry with random fragment orientations.
- pysisyphus.drivers.afir.lstsqs_with_reference(coords3d, ref_coords3d, freeze_atoms=None)[source]
Least-squares w.r.t. reference coordinates while keeping some atoms frozen.
- pysisyphus.drivers.afir.opt_afir_path(geom, calc_getter, afir_kwargs, opt_kwargs=None, out_dir=None)[source]
Minimize geometry with AFIR calculator.
- pysisyphus.drivers.afir.prepare_mc_afir(geoms, rng=None, **kwargs)[source]
Wrapper for generate_random_union(_ref).
- pysisyphus.drivers.afir.prepare_sc_afir(geom, m, n, bond_factor=1.2)[source]
Create perturbed geometry, determine fragments and set AFIR calculator.
- pysisyphus.drivers.afir.relax_afir_path(atoms, cart_coords, calc_getter, images=15, out_dir=None)[source]
Sample imagef from AFIR path and do COS relaxation.
- pysisyphus.drivers.afir.run_afir_path(geom, calc_getter, out_dir, gamma_max, gamma_interval, rng, ignore_bonds=None, bond_factor=1.2, afir_kwargs=None, opt_kwargs=None)[source]
Driver for AFIR minimizations with increasing gamma values.
- pysisyphus.drivers.afir.run_afir_paths(afir_key, geoms, calc_getter, afir_kwargs=None, opt_kwargs=None, seed=None, N_sample=None, rmsd_thresh=0.25, **kwargs)[source]
- pysisyphus.drivers.afir.run_mc_afir_paths(geoms, calc_getter, gamma_max, rng, N_max=5, gamma_interval=(0.0, 1.0), afir_kwargs=None, opt_kwargs=None)[source]
pysisyphus.drivers.barriers module
pysisyphus.drivers.birkholz module
- pysisyphus.drivers.birkholz.bond_order(r, r0, b=2)[source]
Bond order for given bond length and reference length.
Eq. (3) in [1].
- pysisyphus.drivers.birkholz.bond_orders_for_geom(geom, bond_indices)[source]
Wrapper for bond_orders for simple use with Geometry.
pysisyphus.drivers.merge module
- pysisyphus.drivers.merge.align_on_subset(geom1, union, del1=None)[source]
Align 'union' onto subset of 'geom1'
- pysisyphus.drivers.merge.merge_geoms(geom1, geom2, geom1_del=None, geom2_del=None, make_bonds=None)[source]
Merge geom1 and geom2 while keeping the original coordinates.
Supports deleting certain atoms.
- pysisyphus.drivers.merge.merge_opt(union, bond_diff, ff='mmff94')[source]
Fragment merging along given bond by forcefield optimization.
- pysisyphus.drivers.merge.merge_with_frozen_geom(frozen_geom, lig_geom, make_bonds, frozen_del, lig_del, ff='mmff94')[source]
pysisyphus.drivers.opt module
- pysisyphus.drivers.opt.get_optimal_bias(ref_geom, calc_getter, opt_key, opt_kwargs, k_max, k_min=0.0, rmsd_target=0.188973, rmsd_thresh=None, rmsd_kwargs=None, k_thresh=0.001, strict=True)[source]
Driver to determine optimal bias value k for RMSD restraint.
- Parameters:
ref_geom (
Geometry
) -- Reference geometry. Starting point of the optimizations and reference for RMSD calculations.calc_getter (
Callable
) -- Function that returns the actual calculator, providing the energy and its derivatives.opt_key (
str
) -- Determines optimizer type. See pysisyphus.optimizers.cls_map.opt_kwargs (
Dict
) -- Optional dict of arguments passed to the optimizer.k_max (
float
) -- Maximum absolute value of bias factor k. Must be a > k_min.k_max -- Minimum absolute value of bias factor k. Must be a positive number >= 0.0. Defaults to 0.0.
rmsd_target (
float
, default:0.188973
) -- Target RMSD value in au. Defaults to 0.188973 a0 (approx. 0.1 Å).rmsd_thresh (
Optional
[float
], default:None
) -- Allowed deviation from rmsd_target in au. If omitted, 5% of rmsd_target are used.rmsd_kwargs (
Optional
[Dict
], default:None
) -- Additional keyword arguments that are passed to the RMSD class, e.g., atom_indices.k_thresh (
float
, default:0.001
) -- When the absolute value of k_bias - k_min or k_max becomes smaller than k_thresh, the bisection is aborted.strict (default:
True
) -- If True, AssertionError is raised when an optimization did not converged.
- Return type:
Tuple
[OptResult
,float
,bool
]- Returns:
opt_result -- OptimizationResult object containig the Optimizer object.
k_opt -- Optimal value of k_bias.
valid_k -- Whether an appropriate bias value k was found.
pysisyphus.drivers.perf module
pysisyphus.drivers.pka module
pysisyphus.drivers.precon_pos_rot module
prp a901cdfacc579eb63b193cbc9043212e8b57746f pysis 340ab6105ac4156f0613b4d0e8f080d9f195530c do_trans accidentally disabled in transtorque
- class pysisyphus.drivers.precon_pos_rot.SteepestDescent(geom, max_cycles=1000, max_step=0.05, rms_force=0.05, rms_force_only=True, prefix=None, dump=False, dump_every=100, print_every=100)[source]
Bases:
object
- pysisyphus.drivers.precon_pos_rot.form_A(frags, which_frag, formed_bonds)[source]
Construct the A-matrices.
AR[(m, n)] (AP[(m, n)]) contains the subset of atoms in Rm (Pm) that forms bonds with Rn (Pn).
- pysisyphus.drivers.precon_pos_rot.get_steps_to_active_atom_mean(frag_lists, iter_frag_lists, ind_dict, coords3d, skip=True)[source]
- pysisyphus.drivers.precon_pos_rot.precon_pos_rot(reactants, products, prefix=None, config={'s2_hs_kappa': 1.0, 's4_hs_kappa': 50.0, 's4_v_kappa': 1.0, 's4_w_kappa': 1.0, 's5_hs_kappa': 10.0, 's5_rms_force': 0.01, 's5_trans': True, 's5_v_kappa': 1.0, 's5_w_kappa': 3.0, 's5_z_kappa': 2.0})[source]
pysisyphus.drivers.rates module
- class pysisyphus.drivers.rates.ReactionRates(from_, barrier, barrier_si, temperature, imag_wavenumber, imag_frequency, rate_eyring, kappa_eyring, rate_wigner=None, kappa_wigner=None, rate_bell=None, kappa_bell=None, rate_eckart=None, kappa_eckart=None)[source]
Bases:
object
-
barrier:
float
-
barrier_si:
float
-
from_:
str
-
imag_frequency:
float
-
imag_wavenumber:
float
-
kappa_bell:
Optional
[float
] = None
-
kappa_eckart:
Optional
[float
] = None
-
kappa_eyring:
float
-
kappa_wigner:
Optional
[float
] = None
-
rate_bell:
Optional
[float
] = None
-
rate_eckart:
Optional
[float
] = None
-
rate_eyring:
float
-
rate_wigner:
Optional
[float
] = None
-
temperature:
float
-
barrier:
- pysisyphus.drivers.rates.bell_corr(temperature, imag_frequency)[source]
Tunneling correction according to Bell.
See https://onlinelibrary.wiley.com/doi/10.1002/anie.201708489 eq. (1) and eq. (2).
- Parameters:
temperature (
float
) -- Temperature in Kelvin.imag_frequency (
float
) -- Imaginary frequency in 1/s.
- Returns:
Unitless tunneling correction according to Bell. Negative kappas are meaningless.
- Return type:
kappa
- pysisyphus.drivers.rates.eckart_corr(fw_barrier_height, bw_barrier_height, temperature, imag_frequency)[source]
Tunneling correction according to Eckart.
See [3], [4] and [5]. The correction should be independent of the order fw_barrier_height/bw_barrier_height.
- Parameters:
fw_barrier_height (
float
) -- Barrier height in forward direction in Hartree.bw_barrier_height (
float
) -- Barrier height in backward direction in Hartree.temperature (
float
) -- Temperature in Kelvin.imag_frequency (
float
) -- Frequency in 1/s of the imaginary mode at the TS.
- Returns:
Unitless tunneling correction according to Eckart.
- Return type:
kappa
- pysisyphus.drivers.rates.eckart_corr_brown(fw_barrier_height, bw_barrier_height, temperature, imag_frequency)[source]
Tunneling correction according to Eckart.
Wrapper for the TUNL subroutine as given in the appendix of [5].
- Parameters:
fw_barrier_height (
float
) -- Barrier height in forward direction in Hartree.bw_barrier_height (
float
) -- Barrier height in backward direction in Hartree.temperature (
float
) -- Temperature in Kelvin.imag_frequency (
float
) -- Frequency in 1/s of the imaginary mode at the TS.
- Returns:
Unitless tunneling correction according to Eckart.
- Return type:
kappa
- pysisyphus.drivers.rates.eyring_rate(barrier_height, temperature, trans_coeff=1.0)[source]
Rate constant in 1/s from the Eyring equation.
See https://pubs.acs.org/doi/10.1021/acs.organomet.8b00456 "Reaction Rates and Barriers" on p. 3234 and eq. (8).
- Parameters:
barrier_height (
float
) -- Barrier height (energy, enthalpy, gibbs energy, ...) in Hartree.temperature (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]) -- Temperature in Kelvin.trans_coeff (
float
, default:1.0
) -- Unitless transmission coefficient, e.g., obtained from Wigner or Eckart correction.
- Returns:
Eyring reaction rate in 1/s.
- Return type:
rate
- pysisyphus.drivers.rates.get_rates(temperature, reactant_thermos, ts_thermo, product_thermos=None)[source]
- pysisyphus.drivers.rates.get_rates_for_geoms(temperature, reactant_geoms, ts_geom, product_geoms)[source]
- pysisyphus.drivers.rates.get_rates_for_hessians(temperature, reactant_h5s, ts_h5, product_h5s)[source]
- pysisyphus.drivers.rates.harmonic_tst_rate(barrier_height, temperature, rs_part_func, ts_part_func, trans_coeff=1.0)[source]
Rate constant in 1/s from harmonic TST.
See http://dx.doi.org/10.18419/opus-9841, chapter 5. Contrary to the Eyring rate this function does only takes a scalar temperature as the partition functions are also functions of the temperature and would have to be recalculated for different temperatures.
A possible extension would be to also support multiple rs/ts partition functions, one for each temperature.
- Parameters:
barrier_height (
float
) -- Barrier height (energy, enthalpy, gibbs energy, ...) in Hartree.rs_part_func (
float
) -- Partition function of the reactant state.ts_part_func (
float
) -- Partition function of the transition state.temperature (
float
) -- Temperature in Kelvin.trans_coeff (
float
, default:1.0
) -- Unitless transmission coefficient, e.g., obtained from Wigner or Eckart correction.
- Returns:
HTST reaction rate in 1/s.
- Return type:
rate
- pysisyphus.drivers.rates.tunl(alph1, alph2, U, strict=False)[source]
Eckart correction factor for rate constants according to Brown.
Python adaption of the TUNL subroutine in 4. Appendix of [5].
- Parameters:
alph1 (
float
) -- Unitless barrier height descriptor. 2π V1 / (h nu*); see (2) in [5].alph2 (
float
) -- Unitless barrier heigth descriptor. 2π V2 / (h nu*); see (2) in [5].u -- Unitless curvature descriptor. h nu* / kT; see (2) in [5].
strict (
bool
, default:False
) -- If enabled, arguments are bound checked. Will raise AssertionError if they are out of bonds. TUNL was found to yield accurate results when the arguments are within bounds.
- Returns:
Unitless tunneling correction according to Eckart.
- Return type:
G
- pysisyphus.drivers.rates.wigner_corr(temperature, imag_frequency)[source]
Tunneling correction according to Wigner.
See https://doi.org/10.1002/qua.25686 eq. (12) and https://doi.org/10.1007/978-3-642-59033-7_9 for the original publication.
- Parameters:
temperature (
float
) -- Temperature in Kelvin.imag_frequency (
float
) -- Imaginary frequency in 1/s.
- Returns:
Unitless tunneling correction according to Wigner.
- Return type:
kappa
pysisyphus.drivers.replace module
- pysisyphus.drivers.replace.replace_atom(geom, ind, repl_geom, repl_ind, return_full=True, opt=False, use_xtb=False, charge=0, mult=1)[source]
Replace atom with fragment.
pysisyphus.drivers.scan module
pysisyphus.drivers.thermo module
Module contents
pysisyphus.dynamics package
Submodules
pysisyphus.dynamics.Gaussian module
- class pysisyphus.dynamics.Gaussian.Gaussian(w=1, s=1, x0=None, colvar=None, dump_name=None)[source]
Bases:
object
- __init__(w=1, s=1, x0=None, colvar=None, dump_name=None)[source]
-
V(f(x)) = w * exp(-(f(x) - f0)**2 / (2*s**2))
F(x) = -dV/dx = -dV/df * df/dx
- calculate(coords, x0=None, gradient=False)[source]
Return potential and gradient for Gaussian(s) centered at x0.
- property s
- property w
pysisyphus.dynamics.colvars module
pysisyphus.dynamics.driver module
- class pysisyphus.dynamics.driver.MDResult(coords, t_ps, step, terminated, T, E_tot)
Bases:
tuple
- E_tot
Alias for field number 5
- T
Alias for field number 4
- coords
Alias for field number 0
- step
Alias for field number 2
- t_ps
Alias for field number 1
- terminated
Alias for field number 3
- pysisyphus.dynamics.driver.md(geom, v0, steps, dt, remove_com_v=True, thermostat=None, T=298.15, timecon=100, term_funcs=None, constraints=None, constraint_kwargs=None, gaussians=None, verbose=True, print_stride=50, dump_stride=None, h5_group_name='run')[source]
Velocity verlet integrator.
- Parameters:
geom (Geometry) -- The system for which the dynamics are to be run.
v0 (np.array, floats) -- Initial velocities in Bohr/fs.
steps (float) -- Number of simulation steps.
dt (float) -- Timestep in fs.
remove_com_v (bool, default=True) -- Remove center-of-mass velocity.
thermostat (str, optional, default None) -- Which and whether to use a thermostat.
T (float, optional, default=None) -- Desired temperature in thermostated runs.
timecon (float) -- Timeconsanst of the thermostat in fs.
term_funcs (dict, optional) -- Iterable of functions that are called with the atomic coordinates in every MD cycle and result in termination
constraints (2d iterable, optional) -- 2D iterable containing atom indices describing constrained bond lengths. of the MD integration when they evaluate to true.
constraint_kwargs (dict, optional) -- Keyword arguments for the constraint algorithm.
gaussians (list, optional, default=None) -- List of Gaussians to be used in a metadynamics run.
verbose (bool, default=True) -- Do additional printing when True.
print_stride (int, default=50) -- Report every n-th step.
dump_stride (int, default=None) -- If given, MD data will be dumped to a HDF5 file every n-th step.
str (h5_group_name =) -- Name of the HDF5 group, used for dumping.
optional -- Name of the HDF5 group, used for dumping.
pysisyphus.dynamics.helpers module
- pysisyphus.dynamics.helpers.get_mb_velocities(masses, cart_coords, T, remove_com_v=True, remove_rot_v=True, seed=None)[source]
Initial velocities from Maxwell-Boltzmann distribution.
- Parameters:
masses (np.array, 1d, shape (number of atoms, )) -- Atomic masses in amu.
cart_coords (iterable, 1d, shape (3 * number of atoms, )) -- Atomic cartesian coordinates. Needed for removal of rotation.
T (float) -- Temperature in Kelvin.
remove_com_v (bool, default=True, optional) -- Whether to remove center-of-mass velocity.
remove_rot_v (bool, default=True, optional) -- Whether to remove rotational velocity.
seed (int, default=None, optional) -- Seed for the random-number-generator.
- Returns:
v -- Initial velocities in Bohr/fs.
- Return type:
np.array, 2d, shape (number of atoms, 3)
- pysisyphus.dynamics.helpers.get_mb_velocities_for_geom(geom, T, remove_com_v=True, remove_rot_v=True, seed=None)[source]
Initial velocities from Maxwell-Boltzmann distribution.
See 'get_mb_velocities' for explanation.
- pysisyphus.dynamics.helpers.kinetic_energy_for_temperature(atom_number, T, fixed_dof=0)[source]
Kinetic energy for given temperature and number of atoms.
Each atom has three degrees of freedom (1/2 * 3 == 3/2).
- Parameters:
atom_number (int) -- Number of atoms. Each atom has three degrees of freedom.
T (float) -- Temperature in Kelvin.
fixed_dof (int, optional, default=0) -- Number of fixed degrees of freedom, e.g. 3 when the center-of-mass velocity is removed.
- Returns:
E_kin -- Kinetic energy in Hartree.
- Return type:
float
- pysisyphus.dynamics.helpers.kinetic_energy_from_velocities(masses, velocities)[source]
Kinetic energy for given velocities and masses.
- Parameters:
masses (1d array, shape (number of atoms, )) -- Atomic masses in amu.
velocities (2d array, (number of atoms, 3)) -- Atomic velocities in Bohr/fs.
- Returns:
E_kin -- Kinetic energy in Hartree.
- Return type:
float
- pysisyphus.dynamics.helpers.remove_com_velocity(v, masses, keep_norm=True)[source]
Remove center-of-mass velocity.
Returned units vary with the given input units.
- Parameters:
v (np.array, 2d, shape (number of atoms, 3)) -- Velocities.
masses (np.array, 1d, shape (number of atoms, )) -- Atomic masses.
keep_norm (bool, default=True) -- Whether to rescale v to its original norm, after removal of v_com.
- Returns:
v -- Velocities without center-of-mass velocity.
- Return type:
np.array
- pysisyphus.dynamics.helpers.scale_velocities_to_energy(masses, v, E_desired)[source]
Scale velocities to a given temperature.
- Parameters:
masses (np.array, 1d, shape (number of atoms, )) -- Atomic masses in amu.
v (np.array, 2d, shape (number of atoms, 3)) -- (Unscaled) velocities in Bohr/fs.
E_desired (float) -- Desired kinetic energy in Hartree.
- Returns:
v -- Scaled velocities in Bohr/fs.
- Return type:
np.array, 2d, shape (number of atoms, 3)
- pysisyphus.dynamics.helpers.scale_velocities_to_temperatue(masses, v, T_desired, fixed_dof=0)[source]
Scale velocities to a given temperature.
- Parameters:
masses (np.array, 1d, shape (number of atoms, )) -- Atomic masses in amu.
v (np.array, 2d, shape (number of atoms, 3)) -- (Unscaled) velocities in Bohr/fs.
T_desired (float) -- Desired temperature in Kelvin.
fixed_dof (int, optional, default=0) -- Number of fixed degrees of freedom, e.g. 3 when the center-of-mass velocity is removed.
- Returns:
v -- Scaled velocities in Bohr/fs.
- Return type:
np.array, 2d, shape (number of atoms, 3)
- pysisyphus.dynamics.helpers.temperature_for_kinetic_energy(atom_number, E_kin, fixed_dof=0)[source]
Temperature for given kinetic energy and atom number.
Each atom has three degrees of freedom (1/2 * 3 == 3/2).
- Parameters:
atom_number (int) -- Number of atoms. Each atom has three degrees of freedom.
E_kin (float) -- Kinetic energy in Hartree.
fixed_dof (int, optional, default=0) -- Number of fixed degrees of freedom, e.g. 3 when the center-of-mass velocity is removed.
- Returns:
Temperature -- Temperature in Kelvin.
- Return type:
float
- pysisyphus.dynamics.helpers.unscaled_velocity_distribution(masses, T, seed=None)[source]
ρ ∝ exp(- v² * m / (2 * kT)) ln(ρ) ∝ - 1/2 * v² * m / kT v² ∝ -2 * ln(ρ) * kT / m v ∝ ±(-2 * ln(ρ) * kT / m)**0.5 v ∝ ±(-2 * k)**0.5 * (ln(ρ) * T / m)**0.5
The first term of the RHS is constant. As we later scale the velocities we neglect it. Don't use these velocities unscaled!
v ∝ ±(ln(ρ) * T / m)**0.5
pysisyphus.dynamics.lincs module
pysisyphus.dynamics.mdp module
- pysisyphus.dynamics.mdp.MDPResult
alias of
MDResult
pysisyphus.dynamics.rattle module
pysisyphus.dynamics.thermostats module
- pysisyphus.dynamics.thermostats.csvr_closure(sigma, dof, dt, tau=100, rng=None)[source]
- Parameters:
sigma (float) -- Target average value of the kinetic energy (1/2 dof k_b T) in the same units as cur_kinetic_energy.
dof (int) -- Degrees of freedom.
tau (float) -- Timeconstant of the thermostat. tau : float Timeconstant of the thermostat.
rng (numpy.random.Generator, optional) -- Instances of a random number generator (RNG). If it is not provided the module-level RNG will be used.
Module contents
pysisyphus.intcoords package
Submodules
pysisyphus.intcoords.Bend module
pysisyphus.intcoords.Bend2 module
pysisyphus.intcoords.BondedFragment module
pysisyphus.intcoords.Cartesian module
- class pysisyphus.intcoords.Cartesian.CartesianX(*args, **kwargs)[source]
Bases:
Cartesian
- cart_axis = 0
pysisyphus.intcoords.CartesianCoords module
- class pysisyphus.intcoords.CartesianCoords.CartesianCoords(atoms, coords3d, masses, freeze_atoms=None, *, mass_weighted=False, **kwargs)[source]
Bases:
CoordSys
- property coords: ndarray[Any, dtype[_ScalarType_co]]
Getter for coordinates in this coordinate system.
- property coords3d: ndarray[Any, dtype[_ScalarType_co]]
Getter for 3d Cartesian coordinates.
- property inv_masses_rep_sqrt: ndarray[Any, dtype[_ScalarType_co]]
- property masses: ndarray[Any, dtype[_ScalarType_co]]
- property masses_sqrt: ndarray[Any, dtype[_ScalarType_co]]
- transform_forces(cart_forces)[source]
Transform Cartesian forces to this coordinate system.
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- transform_hessian(cart_hessian, int_gradient=None)[source]
Transform Cartesian Hessian to this coordinate system.
- transform_int_step(step, update_constraints=False, pure=False)[source]
Transform step in this coordinate system to Cartesians.
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- property typed_prims: List
List of (primitive) internal coordinates.
May be empty, e.g., when the coordinate system is Cartesian.
- class pysisyphus.intcoords.CartesianCoords.MWCartesianCoords(*args, **kwargs)[source]
Bases:
CartesianCoords
pysisyphus.intcoords.Coords module
- class pysisyphus.intcoords.Coords.CoordSys(*args, **kwargs)[source]
Bases:
Protocol
- abstract property coords: ndarray[Any, dtype[_ScalarType_co]]
Getter for coordinates in this coordinate system.
- abstract property coords3d: ndarray[Any, dtype[_ScalarType_co]]
Getter for 3d Cartesian coordinates.
- abstract project_hessian(hessian)[source]
Project Hessian in the current coordinate system.
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- abstract transform_forces(cart_forces)[source]
Transform Cartesian forces to this coordinate system.
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- abstract transform_hessian(cart_hessian, int_gradient)[source]
Transform Cartesian Hessian to this coordinate system.
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- abstract transform_int_step(step, update_constraints=False, pure=False)[source]
Transform step in this coordinate system to Cartesians.
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- abstract property typed_prims: List
List of (primitive) internal coordinates.
May be empty, e.g., when the coordinate system is Cartesian.
pysisyphus.intcoords.DLC module
- class pysisyphus.intcoords.DLC.DLC(*args, full_set=True, **kwargs)[source]
Bases:
RedundantCoords
- property B
Wilson B-Matrix in the non-redundant subspace.
- property U
- backtransform_hessian(*args, **kwargs)[source]
Transform Hessian in internal coordinates to Cartesians.
- property constraints
- property coords
- freeze_primitives(typed_prims)[source]
Freeze primitive internal coordinates.
- Parameters:
typed_prims (iterable of typed primitives) -- Iterable containing typed_primitives, starting with a PrimType and followed by atom indices.
- get_active_set(B, inv_thresh=None)[source]
See [5] between Eq. (7) and Eq. (8) for advice regarding the threshold.
pysisyphus.intcoords.DistanceFunction module
pysisyphus.intcoords.DummyTorsion module
pysisyphus.intcoords.LinearBend module
pysisyphus.intcoords.LinearDisplacement module
pysisyphus.intcoords.OutOfPlane module
- class pysisyphus.intcoords.OutOfPlane.OutOfPlane(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Primitive
- [1] https://doi.org/10.1002/(SICI)1096-987X(19990730)20:10<1067::AID-JCC9>3.0.CO;2-V
Lee, 1999
pysisyphus.intcoords.PrimTypes module
- class pysisyphus.intcoords.PrimTypes.PrimTypes(value)[source]
Bases:
OrderedEnum
An enumeration.
- AUX_BOND = 1
- AUX_INTERFRAG_BOND = 4
- BEND = 5
- BEND2 = 28
- BOND = 0
- BONDED_FRAGMENT = 25
- CARTESIAN = 21
- CARTESIAN_X = 22
- CARTESIAN_Y = 23
- CARTESIAN_Z = 24
- DISTANCE_FUNCTION = 27
- DUMMY_IMPROPER = 30
- DUMMY_TORSION = 26
- HYDROGEN_BOND = 2
- IMPROPER_DIHEDRAL = 9
- INTERFRAG_BOND = 3
- LINEAR_BEND = 6
- LINEAR_BEND_COMPLEMENT = 7
- LINEAR_DISPLACEMENT = 11
- LINEAR_DISPLACEMENT_COMPLEMENT = 12
- OUT_OF_PLANE = 10
- PROPER_DIHEDRAL = 8
- PROPER_DIHEDRAL2 = 29
- ROBUST_TORSION1 = 31
- ROBUST_TORSION2 = 32
- ROTATION = 17
- ROTATION_A = 18
- ROTATION_B = 19
- ROTATION_C = 20
- TRANSLATION = 13
- TRANSLATION_X = 14
- TRANSLATION_Y = 15
- TRANSLATION_Z = 16
- pysisyphus.intcoords.PrimTypes.normalize_prim_input(prim_inp)[source]
Normalize input for define_prims and constrain_prims
The intcoords.RedundantCoords constructor expects lists of integer lists (tuples) for arguments like 'define_prims' and 'constrain_prims'. The first item of every list determines the type of primitive coordinate. Currently there are about 20 different types and it is hard to remember all of them.
So we also allow a more human friendly input, that is normalized here. The most common primitives are:
0: BOND 5: BEND 8: PROPER_DIHEDRAL
This function maps inputs like ["BOND", 1, 2] to [PrimTypes.BOND, 1, 2] etc.
Always returns a list of tuples, as some prim_inps expand to multiple coordinates, e.g., XYZ or ATOM.
pysisyphus.intcoords.Primitive module
pysisyphus.intcoords.RedundantCoords module
- class pysisyphus.intcoords.RedundantCoords.HybridRedundantCoords(*args, **kwargs)[source]
Bases:
RedundantCoords
- class pysisyphus.intcoords.RedundantCoords.RedundantCoords(atoms, coords3d, masses=None, bond_factor=1.3, typed_prims=None, define_prims=None, constrain_prims=None, freeze_atoms=None, freeze_atoms_exclude=False, internals_with_frozen=False, define_for=None, bonds_only=False, check_bends=True, rebuild=True, bend_min_deg=15, dihed_max_deg=175, lb_min_deg=175, weighted=False, min_weight=0.3, svd_inv_thresh=0.000316, recalc_B=False, tric=False, hybrid=False, hbond_angles=False, rm_for_frag=None)[source]
Bases:
object
- property B
Wilson B-Matrix
- property B_inv
Generalized inverse of the Wilson B-Matrix.
- property B_inv_prim
Generalized inverse of the primitive Wilson B-Matrix.
- property B_prim
Wilson B-Matrix
- property Bt_inv
Transposed generalized inverse of the Wilson B-Matrix.
- property Bt_inv_prim
Transposed generalized inverse of the primitive Wilson B-Matrix.
- property C
Diagonal matrix. Entries for constraints are set to one.
- property P
Projection matrix onto B. See [1] Eq. (4).
- backtransform_hessian(redund_hessian, int_gradient=None)[source]
Transform Hessian in internal coordinates to Cartesians.
- property bend_atom_indices
- property bend_indices
- property bond_atom_indices
- property bond_indices
- property bond_typed_prims
- property cartesian_indices
- property constrained_indices
- property coords
- property coords3d
- property dihedral_atom_indices
- property dihedral_indices
- property linear_bend_indices
- property outofplane_indices
- property prim_coords
- property prim_indices_set
- property prim_internals
- property primitives
- project_hessian(H, shift=1000)[source]
Expects a hessian in internal coordinates. See Eq. (11) in [1].
- property rotation_indices
- transform_hessian(cart_hessian, int_gradient=None)[source]
Transform Cartesian Hessian to internal coordinates.
- property translation_indices
- property typed_prims
- class pysisyphus.intcoords.RedundantCoords.TRIC(*args, **kwargs)[source]
Bases:
RedundantCoords
pysisyphus.intcoords.Rotation module
- class pysisyphus.intcoords.Rotation.Rotation(indices, *args, ref_coords3d, **kwargs)[source]
Bases:
Primitive
See (II. Theory) in [1], Eq. (3) - (14)
- index = None
- class pysisyphus.intcoords.Rotation.RotationA(indices, *args, ref_coords3d, **kwargs)[source]
Bases:
Rotation
- index = 0
- class pysisyphus.intcoords.Rotation.RotationB(indices, *args, ref_coords3d, **kwargs)[source]
Bases:
Rotation
- index = 1
pysisyphus.intcoords.Stretch module
pysisyphus.intcoords.Torsion module
pysisyphus.intcoords.Torsion2 module
pysisyphus.intcoords.Translation module
- class pysisyphus.intcoords.Translation.Translation(*args, **kwargs)[source]
Bases:
Primitive
See (II. Theory) in [1], Eq. (2)
- class pysisyphus.intcoords.Translation.TranslationX(*args, **kwargs)[source]
Bases:
Translation
- cart_axis = 0
- class pysisyphus.intcoords.Translation.TranslationY(*args, **kwargs)[source]
Bases:
Translation
- cart_axis = 1
- class pysisyphus.intcoords.Translation.TranslationZ(*args, **kwargs)[source]
Bases:
Translation
- cart_axis = 2
pysisyphus.intcoords.augment_bonds module
pysisyphus.intcoords.derivatives module
- pysisyphus.intcoords.derivatives.d2q_a(m0, m1, m2, o0, o1, o2, n0, n1, n2)[source]
Bend, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_a2(m0, m1, m2, o0, o1, o2, n0, n1, n2)[source]
Bend2, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_b(m0, m1, m2, n0, n1, n2)[source]
Stretch, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_d(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_d2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion2, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_lb(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Bend, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_ld(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Displacement, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_oop(m0, m1, m2, n0, n1, n2, o0, o1, o2, p0, p1, p2)[source]
OutOfPlane, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_rd1(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
RobustTorsion1, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.d2q_rd2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
RobustTorsion2, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_a(m0, m1, m2, o0, o1, o2, n0, n1, n2)[source]
Bend, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_a2(m0, m1, m2, o0, o1, o2, n0, n1, n2)[source]
Bend2, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_b(m0, m1, m2, n0, n1, n2)[source]
Stretch, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_d(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_d2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion2, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_lb(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Bend, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_ld(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Displacement, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_oop(m0, m1, m2, n0, n1, n2, o0, o1, o2, p0, p1, p2)[source]
OutOfPlane, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_rd1(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
RobustTorsion1, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.dq_rd2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
RobustTorsion2, first derivative wrt. Cartesians
- pysisyphus.intcoords.derivatives.q_d(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion
- pysisyphus.intcoords.derivatives.q_d2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion2
- pysisyphus.intcoords.derivatives.q_lb(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Bend
- pysisyphus.intcoords.derivatives.q_ld(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Displacement
- pysisyphus.intcoords.derivatives.q_oop(m0, m1, m2, n0, n1, n2, o0, o1, o2, p0, p1, p2)[source]
OutOfPlane
pysisyphus.intcoords.eval module
- pysisyphus.intcoords.eval.augment_primitives(missing_prims, coords3d, prim_indices, fragments)[source]
pysisyphus.intcoords.exceptions module
- exception pysisyphus.intcoords.exceptions.NeedNewInternalsException(coords3d, *args, invalid_inds=None, invalid_prims=None, **kwargs)[source]
Bases:
Exception
pysisyphus.intcoords.findiffs module
pysisyphus.intcoords.generate_derivatives module
- class pysisyphus.intcoords.generate_derivatives.FuncResult(d0, d1, d2, f0, f1, f2)
Bases:
tuple
- d0
Alias for field number 0
- d1
Alias for field number 1
- d2
Alias for field number 2
- f0
Alias for field number 3
- f1
Alias for field number 4
- f2
Alias for field number 5
- pysisyphus.intcoords.generate_derivatives.generate_wilson(generate=None, out_fn='derivatives.py', use_mpmath=False)[source]
pysisyphus.intcoords.helpers module
- pysisyphus.intcoords.helpers.get_bond_difference(geom1, geom2, bond_factor=1.3)[source]
Return formed and broken bonds when going from geom1 to geom2.
- pysisyphus.intcoords.helpers.get_bond_differences_verbose(geom1, geom2, bond_factor=1.3, key1='geom1', key2='geom2')[source]
- pysisyphus.intcoords.helpers.get_tangent(prims1, prims2, dihedral_inds, normalize=False)[source]
Normalized tangent between primitive internal coordinates.
Tangent pointing from prims1 to prims2 in primitive internal coordinates, taking into account the periodicity of dihedral angles.
- Parameters:
prims1 (np.array) -- 1d-array of primitive internal coordinates in the order (stretches, bends, dihedrals).
prims2 (np.array) -- See prims1.
dihedral_inds (list of int) -- Dihedral indices in prims1 and prims2.
- Returns:
tangent -- 1d array containing the normalized tangent pointing from prims1 to prims2.
- Return type:
np.array
- pysisyphus.intcoords.helpers.get_weighted_bond_mode(weighted_bonds, coords3d, remove_translation=True)[source]
- pysisyphus.intcoords.helpers.get_weighted_bond_mode_getter(target_weighted_bonds, bond_factor=1.2, fractional=False)[source]
Create input for intcoords.helpers.get_weighted_bond_mode.
Compared to the rest of pysisyphus this method uses a slightly lowered bond factor, so it is more strict regarding what is considered a bond and what not.
pysisyphus.intcoords.mp_derivatives module
- pysisyphus.intcoords.mp_derivatives.d2q_a(m0, m1, m2, o0, o1, o2, n0, n1, n2)[source]
Bend, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_a2(m0, m1, m2, o0, o1, o2, n0, n1, n2)[source]
Bend2, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_b(m0, m1, m2, n0, n1, n2)[source]
Stretch, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_d(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_d2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion2, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_lb(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Bend, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_ld(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Displacement, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_oop(m0, m1, m2, n0, n1, n2, o0, o1, o2, p0, p1, p2)[source]
OutOfPlane, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_rd1(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
RobustTorsion1, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.d2q_rd2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
RobustTorsion2, 2nd derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_a(m0, m1, m2, o0, o1, o2, n0, n1, n2)[source]
Bend, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_a2(m0, m1, m2, o0, o1, o2, n0, n1, n2)[source]
Bend2, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_b(m0, m1, m2, n0, n1, n2)[source]
Stretch, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_d(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_d2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion2, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_lb(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Bend, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_ld(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Displacement, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_oop(m0, m1, m2, n0, n1, n2, o0, o1, o2, p0, p1, p2)[source]
OutOfPlane, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_rd1(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
RobustTorsion1, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.dq_rd2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
RobustTorsion2, first derivative wrt. Cartesians
- pysisyphus.intcoords.mp_derivatives.q_d(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion
- pysisyphus.intcoords.mp_derivatives.q_d2(m0, m1, m2, o0, o1, o2, p0, p1, p2, n0, n1, n2)[source]
Torsion2
- pysisyphus.intcoords.mp_derivatives.q_lb(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Bend
- pysisyphus.intcoords.mp_derivatives.q_ld(m0, m1, m2, o0, o1, o2, n0, n1, n2, p0, p1, p2)[source]
Linear Displacement
- pysisyphus.intcoords.mp_derivatives.q_oop(m0, m1, m2, n0, n1, n2, o0, o1, o2, p0, p1, p2)[source]
OutOfPlane
pysisyphus.intcoords.setup module
- class pysisyphus.intcoords.setup.CoordInfo(bonds, hydrogen_bonds, interfrag_bonds, aux_interfrag_bonds, bends, linear_bends, linear_bend_complements, proper_dihedrals, improper_dihedrals, translation_inds, rotation_inds, cartesian_inds, typed_prims, fragments)
Bases:
tuple
- aux_interfrag_bonds
Alias for field number 3
- bends
Alias for field number 4
- bonds
Alias for field number 0
- cartesian_inds
Alias for field number 11
- fragments
Alias for field number 13
- hydrogen_bonds
Alias for field number 1
- improper_dihedrals
Alias for field number 8
- interfrag_bonds
Alias for field number 2
- linear_bend_complements
Alias for field number 6
- linear_bends
Alias for field number 5
- proper_dihedrals
Alias for field number 7
- rotation_inds
Alias for field number 10
- translation_inds
Alias for field number 9
- typed_prims
Alias for field number 12
- pysisyphus.intcoords.setup.connect_fragments(cdm, fragments, max_aux=3.78, aux_factor=1.3, logger=None)[source]
Determine the smallest interfragment bond for a list of fragments and a condensed distance matrix. For more than a few fragments this function performs poorly, as each fragment is connected to all reamaining fragments, leading to an explosion of bonds, bends and dihedrals.
- pysisyphus.intcoords.setup.connect_fragments_ahlrichs(cdm, fragments, atoms, min_dist_scale=1.1, scale=1.2, avoid_h=False, logger=None)[source]
- pysisyphus.intcoords.setup.connect_fragments_kmeans(cdm, fragments, atoms, aux_below_thresh=3.7807, aux_add_dist=2.8356, aux_keep=5, aux_no_hh=True, min_dist_thresh=5.0, min_scale=1.2, logger=None)[source]
Generate (auxiliary) interfragment bonds.
In the a first step, minimum distance interfragment bonds (IFBs) are determined between all possible fragment pairs. Similarly, possible auxiliary IFBs are determined. Candidates for auxiliary IFBs are:
IFB <= aux_below_thresh, default 2 Å IFB <= (minimum distance IFB + aux_add_dist), default 1.5 Å
By default, only the first aux_keep (default = 5) auxiliary IFBs are kept.
Connecting all fragments can lead to bonds between very distant atoms. If more than two fragments are present we cluster the minimum distance IFB distances using KMeans, to determine a reasonable length for valid IFBs. We start out with two clusters and increase the number of cluster until the center of one cluster is around the scaled global minimum distance between the fragments. The center of this cluster is then used as a cutoff vor valid IFBs.
After pruning all possible IFBs we can determine the fragment pairs, that are actually connected. This information is then used to also prune possible interfragment bonds. Only auxiliary IFBs between fragments that are actually connected via IFBs are kept.
- pysisyphus.intcoords.setup.get_bend_inds(coords3d, bond_inds, min_deg, max_deg, logger=None)[source]
- pysisyphus.intcoords.setup.get_bond_sets(atoms, coords3d, bond_factor=1.3, return_cdm=False, return_cbm=False)[source]
I'm sorry, but this function does not return sets, but an int ndarray.
- pysisyphus.intcoords.setup.get_dihedral_inds(coords3d, bond_inds, bend_inds, max_deg, logger=None)[source]
- pysisyphus.intcoords.setup.get_fragments(atoms, coords, bond_inds=None, bond_factor=1.3)[source]
This misses unconnected single atoms!
- pysisyphus.intcoords.setup.get_hydrogen_bond_inds_v2(atoms, coords3d, bond_inds, logger=None)[source]
- pysisyphus.intcoords.setup.get_linear_bend_inds(coords3d, cbm, bends, min_deg=175, max_bonds=4, logger=None)[source]
- pysisyphus.intcoords.setup.setup_redundant(atoms, coords3d, factor=1.3, define_prims=None, min_deg=15, dihed_max_deg=175, lb_min_deg=None, lb_max_bonds=4, min_weight=None, tric=False, hybrid=False, interfrag_hbonds=True, hbond_angles=False, freeze_atoms=None, define_for=None, internals_with_frozen=False, rm_for_frag=None, logger=None)[source]
pysisyphus.intcoords.setup_fast module
- pysisyphus.intcoords.setup_fast.find_bonds(atoms, coords3d, covalent_radii=None, bond_factor=1.3, min_dist=0.1)[source]
- pysisyphus.intcoords.setup_fast.find_bonds_bends(geom, bond_factor=1.3, min_deg=15, max_deg=175)[source]
- pysisyphus.intcoords.setup_fast.find_dihedrals(coords3d, bonds, bends, max_deg, logger=None)[source]
- pysisyphus.intcoords.setup_fast.get_bend_candidates(bonds)[source]
Also yields duplicates [a, b, c] and [c, b, a].
pysisyphus.intcoords.update module
- pysisyphus.intcoords.update.correct_dihedrals(new_dihedrals, old_dihedrals)[source]
Dihedrals are periodic. Going from -179° to 179° is not a step of 358°, but a step of 2°. By considering the actual distance of the dihedrals from π the correct step can be calculated.
dihedral step length = abs(abs(new_dihedral) - π) + abs(abs(old_dihedral) - π)
or put differently
dihedral step length = abs(abs(new_dihedral - old_dihedral) - 2*π)
The sign is left to be determined. Going from -179° to 179° (roughly π - -π = 2π) is a counter clockwise rotation and the dihedral has to decrease below -π. Going from 179° to -179° (roughly -π - π = -2π) is a clockwise rotation and the dihedral increases abvove π. So the correct sign corresponds to the negative sign of the original difference.
original difference 2π -> dihedral must decrease -> sign = -1 original difference -2π -> dihedral must increase -> sign = +1
Overall, the old dihedral is modified by the actual step length with the correct sign.
- pysisyphus.intcoords.update.transform_int_step(int_step, old_cart_coords, cur_internals, Bt_inv_prim, primitives, typed_prims=None, dihedral_inds=None, rotation_inds=None, bend_inds=None, check_dihedrals=False, check_bends=False, bend_min_deg=15, bend_max_deg=175, freeze_atoms=None, constrained_inds=None, update_constraints=False, cart_rms_thresh=1e-06, Bt_inv_prim_getter=None, max_cycles=25, logger=None)[source]
Transformation is done in primitive internals, so int_step must be given in primitive internals and not in DLC!
pysisyphus.intcoords.valid module
Module contents
- class pysisyphus.intcoords.Bend(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Primitive
- class pysisyphus.intcoords.Bend2(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Bend
- class pysisyphus.intcoords.CartesianCoords(atoms, coords3d, masses, freeze_atoms=None, *, mass_weighted=False, **kwargs)[source]
Bases:
CoordSys
- property coords: ndarray[Any, dtype[_ScalarType_co]]
Getter for coordinates in this coordinate system.
- property coords3d: ndarray[Any, dtype[_ScalarType_co]]
Getter for 3d Cartesian coordinates.
- property inv_masses_rep_sqrt: ndarray[Any, dtype[_ScalarType_co]]
- property masses: ndarray[Any, dtype[_ScalarType_co]]
- property masses_sqrt: ndarray[Any, dtype[_ScalarType_co]]
- transform_forces(cart_forces)[source]
Transform Cartesian forces to this coordinate system.
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- transform_hessian(cart_hessian, int_gradient=None)[source]
Transform Cartesian Hessian to this coordinate system.
- transform_int_step(step, update_constraints=False, pure=False)[source]
Transform step in this coordinate system to Cartesians.
- Return type:
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]
- property typed_prims: List
List of (primitive) internal coordinates.
May be empty, e.g., when the coordinate system is Cartesian.
- class pysisyphus.intcoords.DLC(*args, full_set=True, **kwargs)[source]
Bases:
RedundantCoords
- property B
Wilson B-Matrix in the non-redundant subspace.
- property U
- backtransform_hessian(*args, **kwargs)[source]
Transform Hessian in internal coordinates to Cartesians.
- property constraints
- property coords
- freeze_primitives(typed_prims)[source]
Freeze primitive internal coordinates.
- Parameters:
typed_prims (iterable of typed primitives) -- Iterable containing typed_primitives, starting with a PrimType and followed by atom indices.
- get_active_set(B, inv_thresh=None)[source]
See [5] between Eq. (7) and Eq. (8) for advice regarding the threshold.
- class pysisyphus.intcoords.DummyImproper(indices, *args, fix_inner=True, **kwargs)[source]
Bases:
Torsion
- class pysisyphus.intcoords.DummyTorsion(indices, *args, fix_inner=True, **kwargs)[source]
Bases:
Torsion
- class pysisyphus.intcoords.HybridRedundantCoords(*args, **kwargs)[source]
Bases:
RedundantCoords
- class pysisyphus.intcoords.LinearDisplacement(*args, complement=False, **kwargs)[source]
Bases:
Primitive
- class pysisyphus.intcoords.MWCartesianCoords(*args, **kwargs)[source]
Bases:
CartesianCoords
- class pysisyphus.intcoords.OutOfPlane(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Primitive
- [1] https://doi.org/10.1002/(SICI)1096-987X(19990730)20:10<1067::AID-JCC9>3.0.CO;2-V
Lee, 1999
- exception pysisyphus.intcoords.PrimitiveNotDefinedException(typed_prim, *args, **kwargs)[source]
Bases:
Exception
- class pysisyphus.intcoords.RedundantCoords(atoms, coords3d, masses=None, bond_factor=1.3, typed_prims=None, define_prims=None, constrain_prims=None, freeze_atoms=None, freeze_atoms_exclude=False, internals_with_frozen=False, define_for=None, bonds_only=False, check_bends=True, rebuild=True, bend_min_deg=15, dihed_max_deg=175, lb_min_deg=175, weighted=False, min_weight=0.3, svd_inv_thresh=0.000316, recalc_B=False, tric=False, hybrid=False, hbond_angles=False, rm_for_frag=None)[source]
Bases:
object
- property B
Wilson B-Matrix
- property B_inv
Generalized inverse of the Wilson B-Matrix.
- property B_inv_prim
Generalized inverse of the primitive Wilson B-Matrix.
- property B_prim
Wilson B-Matrix
- property Bt_inv
Transposed generalized inverse of the Wilson B-Matrix.
- property Bt_inv_prim
Transposed generalized inverse of the primitive Wilson B-Matrix.
- property C
Diagonal matrix. Entries for constraints are set to one.
- property P
Projection matrix onto B. See [1] Eq. (4).
- backtransform_hessian(redund_hessian, int_gradient=None)[source]
Transform Hessian in internal coordinates to Cartesians.
- property bend_atom_indices
- property bend_indices
- property bond_atom_indices
- property bond_indices
- property bond_typed_prims
- property cartesian_indices
- property constrained_indices
- property coords
- property coords3d
- property dihedral_atom_indices
- property dihedral_indices
- property linear_bend_indices
- property outofplane_indices
- property prim_coords
- property prim_indices_set
- property prim_internals
- property primitives
- project_hessian(H, shift=1000)[source]
Expects a hessian in internal coordinates. See Eq. (11) in [1].
- property rotation_indices
- transform_hessian(cart_hessian, int_gradient=None)[source]
Transform Cartesian Hessian to internal coordinates.
- property translation_indices
- property typed_prims
- class pysisyphus.intcoords.RobustTorsion1(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Primitive
- class pysisyphus.intcoords.RobustTorsion2(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Primitive
- class pysisyphus.intcoords.RotationA(indices, *args, ref_coords3d, **kwargs)[source]
Bases:
Rotation
- index = 0
- class pysisyphus.intcoords.RotationB(indices, *args, ref_coords3d, **kwargs)[source]
Bases:
Rotation
- index = 1
- class pysisyphus.intcoords.RotationC(indices, *args, ref_coords3d, **kwargs)[source]
Bases:
Rotation
- index = 2
- class pysisyphus.intcoords.Stretch(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Primitive
- class pysisyphus.intcoords.TRIC(*args, **kwargs)[source]
Bases:
RedundantCoords
- class pysisyphus.intcoords.Torsion(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Primitive
- class pysisyphus.intcoords.Torsion2(indices, periodic=False, calc_kwargs=None, cache=False)[source]
Bases:
Torsion
- class pysisyphus.intcoords.TranslationX(*args, **kwargs)[source]
Bases:
Translation
- cart_axis = 0
- class pysisyphus.intcoords.TranslationY(*args, **kwargs)[source]
Bases:
Translation
- cart_axis = 1
- class pysisyphus.intcoords.TranslationZ(*args, **kwargs)[source]
Bases:
Translation
- cart_axis = 2
pysisyphus.interpolate package
Submodules
pysisyphus.interpolate.IDPP module
- class pysisyphus.interpolate.IDPP.IDPP(geoms, between, extrapolate=0, extrapolate_before=0, extrapolate_after=0, extrapolate_damp=1.0, align=False)[source]
Bases:
Interpolator
pysisyphus.interpolate.Interpolator module
pysisyphus.interpolate.LST module
pysisyphus.interpolate.Redund module
- class pysisyphus.interpolate.Redund.Redund(*args, align=True, rebuild_geoms=True, **kwargs)[source]
Bases:
Interpolator
pysisyphus.interpolate.helpers module
Module contents
pysisyphus.io package
Submodules
pysisyphus.io.cjson module
pysisyphus.io.crd module
pysisyphus.io.hdf5 module
- pysisyphus.io.hdf5.get_h5_group(fn, group_name, data_model=None, reset=False)[source]
Return (and create if neccesary) group with given name and data model.
pysisyphus.io.hessian module
pysisyphus.io.mol2 module
pysisyphus.io.molden module
pysisyphus.io.pdb module
pysisyphus.io.pubchem module
pysisyphus.io.sdf module
pysisyphus.io.xyz module
pysisyphus.io.zmat module
- class pysisyphus.io.zmat.ZLine(atom, rind, r, aind, a, dind, d)
Bases:
tuple
- a
Alias for field number 4
- aind
Alias for field number 3
- atom
Alias for field number 0
- d
Alias for field number 6
- dind
Alias for field number 5
- r
Alias for field number 2
- rind
Alias for field number 1
- pysisyphus.io.zmat.geom_from_zmat(zmat, atoms=None, coords3d=None, geom=None, start_at=None, drop_dummy=True, **geom_kwargs)[source]
Adapted from https://github.com/robashaw/geomConvert by Robert Shaw.
Module contents
- pysisyphus.io.geom_from_cube(inp, *args, **kwargs)
- pysisyphus.io.geom_from_fchk(inp, *args, **kwargs)
- pysisyphus.io.geom_from_zmat(zmat, atoms=None, coords3d=None, geom=None, start_at=None, drop_dummy=True, **geom_kwargs)[source]
Adapted from https://github.com/robashaw/geomConvert by Robert Shaw.
pysisyphus.irc package
Submodules
pysisyphus.irc.DWI module
pysisyphus.irc.DampedVelocityVerlet module
- class pysisyphus.irc.DampedVelocityVerlet.DampedVelocityVerlet(geometry, v0=0.04, dt0=0.5, error_tol=0.003, max_cycles=150, **kwargs)[source]
Bases:
IRC
pysisyphus.irc.Euler module
pysisyphus.irc.EulerPC module
- class pysisyphus.irc.EulerPC.EulerPC(*args, hessian_recalc=None, hessian_update='bofill', hessian_init='calc', max_pred_steps=500, loose_cycles=3, dump_dwi=False, scipy_method=None, corr_func='mbs', **kwargs)[source]
Bases:
IRC
pysisyphus.irc.GonzalezSchlegel module
pysisyphus.irc.IMKMod module
pysisyphus.irc.IRC module
- class pysisyphus.irc.IRC.IRC(geometry, step_length=0.1, max_cycles=125, downhill=False, forward=True, backward=True, root=0, hessian_init=None, displ='energy', displ_energy=0.001, displ_length=0.1, displ_third_h5=None, rms_grad_thresh=0.001, hard_rms_grad_thresh=None, energy_thresh=1e-06, imag_below=0.0, force_inflection=True, check_bonds=True, out_dir='.', prefix='', dump_fn='irc_data.h5', dump_every=5)[source]
Bases:
object
- __init__(geometry, step_length=0.1, max_cycles=125, downhill=False, forward=True, backward=True, root=0, hessian_init=None, displ='energy', displ_energy=0.001, displ_length=0.1, displ_third_h5=None, rms_grad_thresh=0.001, hard_rms_grad_thresh=None, energy_thresh=1e-06, imag_below=0.0, force_inflection=True, check_bonds=True, out_dir='.', prefix='', dump_fn='irc_data.h5', dump_every=5)[source]
Base class for IRC calculations.
- Parameters:
geometry (Geometry) -- Transtion state geometry, or initial geometry for downhill run.
step_length (float, optional) -- Step length in unweighted coordinates.
max_cycles (int, optional) -- Positive integer, controlloing the maximum number of IRC steps taken in a direction (forward/backward/downhill).
downhill (bool, default=False) -- Downhill run from a non-stationary point with non-vanishing gradient. Disables forward and backward runs.
forward (bool, default=True) -- Integrate IRC in positive s direction.
backward (bool, default=True) -- Integrate IRC in negative s direction.
root (int, default=0) -- Use n-th root for initial displacement from TS.
hessian_init (str, default=None) -- Path to Hessian HDF5 file, e.g., from a previous TS calculation.
displ (str, one of ("energy", "length", "energy_cubic")) -- Controlls initial displacement from the TS. 'energy' assumes a quadratic model, from which a step length for a given energy lowering (see 'displ_energy') is determined. 'length' corresponds to a displacement along the transition vector. 'energy_cubic' considers 3rd derivatives of the energy along the transition vector.
displ_energy (float, default=1e-3) -- Required energy lowering from the TS in au (Hartree). Used with 'displ: energy|energy_cubic'.
displ_length (float, default=0.1) -- Step length along the transition vector. Used only with 'displ: length'.
displ_third_h5 (str, optional) -- Path to HDF5 file containing 3rd derivative information. Used with 'displ: energy_cubic'.
rms_grad_thresh (float, default=1e-3,) -- Convergence is signalled when to root mean square of the unweighted gradient is less than or equal to this value
energy_thresh (float, default=1e-6,) -- Signal convergence when the energy difference between two points is equal to or less than 'energy_thresh'.
imag_below (float, default=0.0) -- Require the wavenumber of the imaginary mode to be below the given threshold. If given, it should be a negative number.
force_inflection (bool, optional) -- Don't indicate convergence before passing an inflection point.
check_bonds (bool, optional, default=True) -- Report whether bonds are formed/broken along the IRC, w.r.t the TS.
out_dir (str, optional) -- Dump everything into 'out_dir' directory instead of the CWD.
prefix (str, optional) -- Short string that is prepended to all files that are created by this class, e.g., trajectories and HDF5 dumps.
dump_fn (str, optional) -- Base name for the HDF5 files.
dump_every (int, optional) -- Dump to HDF5 every n-th cycle.
- property coords
- property energy
- property gradient
- initial_displacement()[source]
Returns non-mass-weighted steps in +s and -s direction for initial displacement from the TS. Earlier version only returned one step, that was later multiplied by either 1 or -1, depending on the desired IRC direction (forward/backward). The current implementation directly returns two steps for forward and backward direction. Whereas for plus and minus steps for displ 'length' and displ 'energy'
step_plus = -step_minus
is valid, it is not valid for dipsl 'energy_cubic' anymore. The latter step is formed as
x(ds) = ds * v0 + ds**2 * v1
- so
x(ds) != -x(ds)
- as
ds * v0 + ds**2 * v1 != -ds * v0 - ds**2 * v1 .
So, all required step are formed directly and later used as appropriate.
- property m_sqrt
- property mw_coords
- property mw_gradient
- valid_displs = ('energy', 'length', 'energy_cubic')
pysisyphus.irc.IRCDummy module
pysisyphus.irc.Instanton module
- class pysisyphus.irc.Instanton.Instanton(images, calc_getter, T)[source]
Bases:
object
- property P
- P_bh
the first image is connected to the last image. At k=0 the index k-1 will be -1, which points to the last image.
- Below we pre-calculate some indices (assuming N images).
unshifted indices ks: k = {0, 1, .. , N-1} shifted indices ksm1: k-1 = {-1, 0, 1, .. , N-2} shifted indices ksp1: k+1 = {1, 2, .. , N-1, 0}
- Type:
The Instanton is periodic
- action_gradient()[source]
kin_grad corresponds to the gradient of S_0 in (Eq. 1 in [1], or first term in Eq. 6 in [2].) It boils down to the derivative of a sum of vector norms
d sum_k (||y_k - y_(k-1)||_2)² --- d y_k
The derivative of a norm of a vector difference is quite simple, but care has to be taken to recognize, that y_k appears two times in the sum. It appears in the first summand for k and in the second summand for k+1.
- sum_k (||y_k - y_(k-1)||_2)²
term 2. term
= (||y_k - y_(k-1)||_2)² + (||y_(k+1) - y_k||_2)² + ... and so on
The derivative of the first term is
2 * (y_k - y_(k-1))
and the derivative of the second term is
-2 * (y_(k+1) - y_k))
which is equal to
2 * (y_k - y_(k+1)) .
To summarize:
d sum_k(||y_k - y_(k-1)||_2)² --- d y_k
= 2 * (2 * y_k - y_(k-1) - y_(k+1)) .
- property cart_coords
- property cart_forces
- property cart_hessian
- property coords
- property energy
- property forces
- property gradient
- property hessian
- property path_length
pysisyphus.irc.LQA module
pysisyphus.irc.ModeKill module
pysisyphus.irc.ParamPlot module
pysisyphus.irc.RK4 module
- class pysisyphus.irc.RK4.RK4(geometry, step_length=0.1, max_cycles=125, downhill=False, forward=True, backward=True, root=0, hessian_init=None, displ='energy', displ_energy=0.001, displ_length=0.1, displ_third_h5=None, rms_grad_thresh=0.001, hard_rms_grad_thresh=None, energy_thresh=1e-06, imag_below=0.0, force_inflection=True, check_bonds=True, out_dir='.', prefix='', dump_fn='irc_data.h5', dump_every=5)[source]
Bases:
IRC
pysisyphus.irc.initial_displ module
- class pysisyphus.irc.initial_displ.ThirdDerivResult(coords_plus, energy_plus, H_plus, coords_minus, energy_minus, H_minus, G_vec, vec, ds)
Bases:
tuple
- G_vec
Alias for field number 6
- H_minus
Alias for field number 5
- H_plus
Alias for field number 2
- coords_minus
Alias for field number 3
- coords_plus
Alias for field number 0
- ds
Alias for field number 8
- energy_minus
Alias for field number 4
- energy_plus
Alias for field number 1
- vec
Alias for field number 7
- pysisyphus.irc.initial_displ.cubic_displ(H, v0, w0, Gv, dE)[source]
- According to Eq. (26) in [2] v1 does not depend on the sign of v0.
v1 = (F0 - 2v0^T F0 v0 I)⁻¹ x ([G0v0] - v0^T [G0v0] v0 I) v0
The first term is obviously independent of v0's sign. Using v0' = -v0 the second term becomes
([G0v0'] - v0'^T [G0v0'] v0' I) v0' (-[G0v0] - v0^T [G0v0'] v0 I) v0' (-[G0v0] + v0^T [G0v0] v0 I) v0' -(-[G0v0] + v0^T [G0v0] v0 I) v0 ([G0v0] - v0^T [G0v0] v0 I) v0
Strictly speaking the contraction [G0v0] should depend on the sign of v0. In the current implementation, the direction of v0 is not taken into account, but
get_curv_vec(H, Gv, v0, w0) == get_curv_vec(H, -Gv, -v0, w0) .
But somehow the Taylor expansion gives bogus results when called with -Gv and -v0...
- pysisyphus.irc.initial_displ.taylor_closure(H, Gv, v0, v1, w0)[source]
Taylor expansion of energy to 3rd order.
dx(ds) = ds*v0 + ds**2*v1 / 2 dE(ds) = dx^T H dx / 2 + dx^T [Gv] dx / 6
H = Hessian Gv = 3rd derivative of energy along v0 v0 = Transition vector v1 = Curvature vector w0 = Eigenvalue belonging to v0
Module contents
- class pysisyphus.irc.DampedVelocityVerlet(geometry, v0=0.04, dt0=0.5, error_tol=0.003, max_cycles=150, **kwargs)[source]
Bases:
IRC
- class pysisyphus.irc.EulerPC(*args, hessian_recalc=None, hessian_update='bofill', hessian_init='calc', max_pred_steps=500, loose_cycles=3, dump_dwi=False, scipy_method=None, corr_func='mbs', **kwargs)[source]
Bases:
IRC
- class pysisyphus.irc.GonzalezSchlegel(geometry, max_micro_cycles=20, micro_step_thresh=0.001, hessian_recalc=None, line_search=False, **kwargs)[source]
Bases:
IRC
- class pysisyphus.irc.IMKMod(geometry, corr_first=True, corr_first_size=0.5, corr_first_energy=True, corr_bisec_size=0.0025, corr_bisec_energy=True, **kwargs)[source]
Bases:
IRC
- class pysisyphus.irc.ModeKill(geometry, kill_inds, nu_thresh=-5.0, do_hess=True, hessian_update=True, **kwargs)[source]
Bases:
IRC
- class pysisyphus.irc.RK4(geometry, step_length=0.1, max_cycles=125, downhill=False, forward=True, backward=True, root=0, hessian_init=None, displ='energy', displ_energy=0.001, displ_length=0.1, displ_third_h5=None, rms_grad_thresh=0.001, hard_rms_grad_thresh=None, energy_thresh=1e-06, imag_below=0.0, force_inflection=True, check_bonds=True, out_dir='.', prefix='', dump_fn='irc_data.h5', dump_every=5)[source]
Bases:
IRC
pysisyphus.line_searches package
Submodules
pysisyphus.line_searches.Backtracking module
- class pysisyphus.line_searches.Backtracking.Backtracking(*args, rho_lo=0.05, rho_hi=0.9, use_grad=False, **kwargs)[source]
Bases:
LineSearch
pysisyphus.line_searches.HagerZhang module
- class pysisyphus.line_searches.HagerZhang.HagerZhang(*args, alpha_prev=None, f_prev=None, dphi0_prev=None, quad_step=False, eps=1e-06, theta=0.5, gamma=0.5, rho=5, psi_0=0.01, psi_1=0.1, psi_2=2.0, psi_low=0.1, psi_hi=10, Delta=0.7, omega=0.001, max_bisects=10, **kwargs)[source]
Bases:
LineSearch
pysisyphus.line_searches.LineSearch module
- class pysisyphus.line_searches.LineSearch.LineSearch(p, cond='armijo', x0=None, geometry=None, f=None, df=None, alpha_init=None, f0=None, g0=None, c1=0.1, c2=0.9, max_cycles=10, alpha_min=1e-06)[source]
Bases:
object
- class pysisyphus.line_searches.LineSearch.LineSearchResult(converged, alpha, f_new, g_new, f_evals, df_evals, dphi0)
Bases:
tuple
- alpha
Alias for field number 1
- converged
Alias for field number 0
- df_evals
Alias for field number 5
- dphi0
Alias for field number 6
- f_evals
Alias for field number 4
- f_new
Alias for field number 2
- g_new
Alias for field number 3
pysisyphus.line_searches.StrongWolfe module
- class pysisyphus.line_searches.StrongWolfe.StrongWolfe(*args, alpha_max=10.0, fac=2, **kwargs)[source]
Bases:
LineSearch
pysisyphus.line_searches.interpol module
Module contents
- class pysisyphus.line_searches.Backtracking(*args, rho_lo=0.05, rho_hi=0.9, use_grad=False, **kwargs)[source]
Bases:
LineSearch
- class pysisyphus.line_searches.HagerZhang(*args, alpha_prev=None, f_prev=None, dphi0_prev=None, quad_step=False, eps=1e-06, theta=0.5, gamma=0.5, rho=5, psi_0=0.01, psi_1=0.1, psi_2=2.0, psi_low=0.1, psi_hi=10, Delta=0.7, omega=0.001, max_bisects=10, **kwargs)[source]
Bases:
LineSearch
- class pysisyphus.line_searches.StrongWolfe(*args, alpha_max=10.0, fac=2, **kwargs)[source]
Bases:
LineSearch
pysisyphus.modefollow package
Submodules
pysisyphus.modefollow.NormalMode module
- class pysisyphus.modefollow.NormalMode.NormalMode(l, masses)[source]
Bases:
object
- __init__(l, masses)[source]
NormalMode class.
Cartesian displacements are normalized to 1.
- Parameters:
l (np.array) -- Cartesian, non-mass-weighted displacements.
masses (np.array) -- Atomic masses.
- property l_mw
- property red_mass
pysisyphus.modefollow.davidson module
- class pysisyphus.modefollow.davidson.DavidsonResult(cur_cycle, converged, final_modes, qs, nus, mode_inds, res_rms)
Bases:
tuple
- converged
Alias for field number 1
- cur_cycle
Alias for field number 0
- final_modes
Alias for field number 2
- mode_inds
Alias for field number 5
- nus
Alias for field number 4
- qs
Alias for field number 3
- res_rms
Alias for field number 6
pysisyphus.modefollow.lanczos module
Module contents
- class pysisyphus.modefollow.NormalMode(l, masses)[source]
Bases:
object
- __init__(l, masses)[source]
NormalMode class.
Cartesian displacements are normalized to 1.
- Parameters:
l (np.array) -- Cartesian, non-mass-weighted displacements.
masses (np.array) -- Atomic masses.
- property l_mw
- property red_mass
pysisyphus.optimizers package
Submodules
pysisyphus.optimizers.BFGS module
- class pysisyphus.optimizers.BFGS.BFGS(geometry, *args, update='bfgs', **kwargs)[source]
Bases:
Optimizer
- damped_bfgs_update(s, y, mu_1=0.2)[source]
Damped BFGS update of inverse Hessian.
Potentially updates s. See Section 3.2 of [2], Eq. (30) - (33). There is a typo ;) It should be
H_{k+1} = V_k H_k V_k^T + ...
- instead of
H_{k+1} = V_k^T H_k V_k + ...
- double_damped_bfgs_update(s, y, mu_1=0.2, mu_2=0.2)[source]
Double damped BFGS update of inverse Hessian.
See [3]. Potentially updates s and y.
- property eye
pysisyphus.optimizers.BacktrackingOptimizer module
pysisyphus.optimizers.ConjugateGradient module
pysisyphus.optimizers.CubicNewton module
pysisyphus.optimizers.FIRE module
pysisyphus.optimizers.HessianOptimizer module
- class pysisyphus.optimizers.HessianOptimizer.HessianOptimizer(geometry, trust_radius=0.5, trust_update=True, trust_min=0.1, trust_max=1, max_energy_incr=None, hessian_update='bfgs', hessian_init='fischer', hessian_recalc=None, hessian_recalc_adapt=None, hessian_xtb=False, hessian_recalc_reset=False, small_eigval_thresh=1e-08, line_search=False, alpha0=1.0, max_micro_cycles=25, rfo_overlaps=False, **kwargs)[source]
Bases:
Optimizer
- __init__(geometry, trust_radius=0.5, trust_update=True, trust_min=0.1, trust_max=1, max_energy_incr=None, hessian_update='bfgs', hessian_init='fischer', hessian_recalc=None, hessian_recalc_adapt=None, hessian_xtb=False, hessian_recalc_reset=False, small_eigval_thresh=1e-08, line_search=False, alpha0=1.0, max_micro_cycles=25, rfo_overlaps=False, **kwargs)[source]
Baseclass for optimizers utilizing Hessian information.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.trust_radius (
float
, default:0.5
) -- Initial trust radius in whatever unit the optimization is carried out.trust_update (
bool
, default:True
) -- Whether to update the trust radius throughout the optimization.trust_min (
float
, default:0.1
) -- Minimum trust radius.trust_max (
float
, default:1
) -- Maximum trust radius.max_energy_incr (
Optional
[float
], default:None
) -- Maximum allowed energy increased after a faulty step. Optimization is aborted when the threshold is exceeded.hessian_update (
Literal
['none'
,None
,False
,'bfgs'
,'damped_bfgs'
,'flowchart'
,'bofill'
,'ts_bfgs'
,'ts_bfgs_org'
,'ts_bfgs_rev'
], default:'bfgs'
) -- Type of Hessian update. Defaults to BFGS for minimizations and Bofill for saddle point searches.hessian_init (
Literal
['calc'
,'unit'
,'fischer'
,'lindh'
,'simple'
,'swart'
,'xtb'
,'xtb1'
,'xtbff'
], default:'fischer'
) -- Type of initial model Hessian.hessian_recalc (
Optional
[int
], default:None
) -- Recalculate exact Hessian every n-th cycle instead of updating it.hessian_recalc_adapt (
Optional
[float
], default:None
) -- Use a more flexible scheme to determine Hessian recalculation. Undocumented.hessian_xtb (
bool
, default:False
) -- Recalculate the Hessian at the GFN2-XTB level of theory.hessian_recalc_reset (
bool
, default:False
) -- Whether to skip Hessian recalculation after reset. Undocumented.small_eigval_thresh (
float
, default:1e-08
) -- Threshold for small eigenvalues. Eigenvectors belonging to eigenvalues below this threshold are discardewd.line_search (
bool
, default:False
) -- Whether to carry out a line search. Not implemented by a subclassing optimizers.alpha0 (
float
, default:1.0
) -- Initial alpha for restricted-step (RS) procedure.max_micro_cycles (
int
, default:25
) -- Maximum number of RS iterations.rfo_overlaps (
bool
, default:False
) -- Enable mode-following in RS procedure.**kwargs -- Keyword arguments passed to the Optimizer baseclass.
- get_newton_step_on_trust(eigvals, eigvecs, gradient, transform=True)[source]
Step on trust-radius.
See Nocedal 4.3 Iterative solutions of the subproblem
- housekeeping()[source]
Calculate gradient and energy. Update trust radius and hessian if needed. Return energy, gradient and hessian for the current cycle.
- property prev_eigvec_max
- property prev_eigvec_min
- rfo_dict = {'max': (-1, 'max'), 'min': (0, 'min')}
pysisyphus.optimizers.LBFGS module
- class pysisyphus.optimizers.LBFGS.LBFGS(geometry, keep_last=7, beta=1, max_step=0.2, double_damp=True, gamma_mult=False, line_search=False, mu_reg=None, max_mu_reg_adaptions=10, control_step=True, **kwargs)[source]
Bases:
Optimizer
- __init__(geometry, keep_last=7, beta=1, max_step=0.2, double_damp=True, gamma_mult=False, line_search=False, mu_reg=None, max_mu_reg_adaptions=10, control_step=True, **kwargs)[source]
Limited-memory BFGS optimizer.
See [1] Nocedal, Wright - Numerical Optimization, 2006 for a general discussion of LBFGS. See pysisyphus.optimizers.hessian_updates for the references related to double damping and pysisyphus.optimizers.closures for references related to regularized LBFGS.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.keep_last (
int
, default:7
) -- History size. Keep last 'keep_last' steps and gradient differences.beta (
float
, default:1
) -- Force constant β in -(H + βI)⁻¹g.max_step (
float
, default:0.2
) -- Upper limit for the absolute component of the step vector in whatever unit the optimization is carried out.double_damp (
bool
, default:True
) -- Use double damping procedure to modify steps s and gradient differences y to ensure sy > 0.gamma_mult (
bool
, default:False
) -- Estimate β from previous cycle. Eq. (7.20) in [1]. See 'beta' argument.line_search (
bool
, default:False
) -- Enable implicit linesearches.mu_reg (
Optional
[float
], default:None
) -- Initial guess for regularization constant in regularized LBFGS.max_mu_reg_adaptions (
int
, default:10
) -- Maximum number of trial steps in regularized LBFGS.control_step (
bool
, default:True
) -- Wheter to scale down the proposed step its biggest absolute component is equal to or below 'max_step'**kwargs -- Keyword arguments passed to the Optimizer baseclass.
pysisyphus.optimizers.LayerOpt module
- class pysisyphus.optimizers.LayerOpt.LayerOpt(geometry, layers=None, **kwargs)[source]
Bases:
Optimizer
- check_convergence(*args, **kwargs)[source]
Check if we must use the model optimizer to signal convergence.
- property layer_num: int
- property model_opt
Return the persistent optimizer belonging to the model system. We don't have to supply any coordinates to the optimizer of the most expensive layer, as it is persistent, as well as the associated geometry.
pysisyphus.optimizers.MicroOptimizer module
pysisyphus.optimizers.NCOptimizer module
- class pysisyphus.optimizers.NCOptimizer.NCOptimizer(geometry, *args, freeze_modes=None, **kwargs)[source]
Bases:
HessianOptimizer
pysisyphus.optimizers.Optimizer module
- class pysisyphus.optimizers.Optimizer.ConvInfo(cur_cycle, energy_converged, max_force_converged, rms_force_converged, max_step_converged, rms_step_converged, desired_eigval_structure)[source]
Bases:
object
-
cur_cycle:
int
-
desired_eigval_structure:
bool
-
energy_converged:
bool
-
max_force_converged:
bool
-
max_step_converged:
bool
-
rms_force_converged:
bool
-
rms_step_converged:
bool
-
cur_cycle:
- class pysisyphus.optimizers.Optimizer.Optimizer(geometry, thresh='gau_loose', max_step=0.04, max_cycles=150, min_step_norm=1e-08, assert_min_step=True, rms_force=None, rms_force_only=False, max_force_only=False, force_only=False, converge_to_geom_rms_thresh=0.05, align=False, align_factor=1.0, dump=False, dump_restart=False, print_every=1, prefix='', reparam_thresh=0.001, reparam_check_rms=True, reparam_when='after', overachieve_factor=0.0, check_eigval_structure=False, restart_info=None, check_coord_diffs=True, coord_diff_thresh=0.01, fragments=None, monitor_frag_dists=0, out_dir='.', h5_fn='optimization.h5', h5_group_name='opt')[source]
Bases:
object
- __init__(geometry, thresh='gau_loose', max_step=0.04, max_cycles=150, min_step_norm=1e-08, assert_min_step=True, rms_force=None, rms_force_only=False, max_force_only=False, force_only=False, converge_to_geom_rms_thresh=0.05, align=False, align_factor=1.0, dump=False, dump_restart=False, print_every=1, prefix='', reparam_thresh=0.001, reparam_check_rms=True, reparam_when='after', overachieve_factor=0.0, check_eigval_structure=False, restart_info=None, check_coord_diffs=True, coord_diff_thresh=0.01, fragments=None, monitor_frag_dists=0, out_dir='.', h5_fn='optimization.h5', h5_group_name='opt')[source]
Optimizer baseclass. Meant to be subclassed.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.thresh (
Literal
['gau_loose'
,'gau'
,'gau_tight'
,'gau_vtight'
,'baker'
,'never'
], default:'gau_loose'
) -- Convergence threshold.max_step (
float
, default:0.04
) -- Maximum absolute component of the allowed step vector. Utilized in optimizers that don't support a trust region or line search.max_cycles (
int
, default:150
) -- Maximum number of allowed optimization cycles.min_step_norm (
float
, default:1e-08
) -- Minimum norm of an allowed step. If the step norm drops below this value a ZeroStepLength-exception is raised. The unit depends on the coordinate system of the supplied geometry.assert_min_step (
bool
, default:True
) -- Flag that controls whether the norm of the proposed step is check for being too small.rms_force (
Optional
[float
], default:None
) -- Root-mean-square of the force from which user-defined thresholds are derived. When 'rms_force' is given 'thresh' is ignored.rms_force_only (
bool
, default:False
) -- When set, convergence is signalled only based on rms(forces).max_force_only (
bool
, default:False
) -- When set, convergence is signalled only based on max(|forces|).force_only (
bool
, default:False
) -- When set, convergence is signalled only based on max(|forces|) and rms(forces).converge_to_geom_rms_thresh (
float
, default:0.05
) -- Threshold for the RMSD with another geometry. When the RMSD drops below this threshold convergence is signalled. Only used with Growing Newton trajectories.align (
bool
, default:False
) -- Flag that controls whether the geometry is aligned in every step onto the coordinates of the previous step. Must not be used with internal coordinates.align_factor (
float
, default:1.0
) -- Factor that controls the strength of the alignment. 1.0 means full alignment, 0.0 means no alignment. The factor mixes the rotation matrix of the alignment with the identity matrix.dump (
bool
, default:False
) -- Flag to control dumping/writing of optimization progress to the filesystemdump_restart (
bool
, default:False
) -- Flag to control whether restart information is dumped to the filesystem.print_every (
int
, default:1
) -- Report optimization progress every nth cycle.prefix (
str
, default:''
) -- Short string that is prepended to several files created by the optimizer. Allows distinguishing several optimizations carried out in the same directory.reparam_thresh (
float
, default:0.001
) -- Controls the minimal allowed similarity between coordinates after two successive reparametrizations. Convergence is signalled if the coordinates did not change significantly.reparam_check_rms (
bool
, default:True
) -- Whether to check for (too) similar coordinates after reparametrization.reparam_when (
Optional
[Literal
['before'
,'after'
]], default:'after'
) -- Reparametrize before or after calculating the step. Can also be turned off by setting it to None.overachieve_factor (
float
, default:0.0
) -- Signal convergence when max(forces) and rms(forces) fall below the chosen threshold, divided by this factor. Convergence of max(step) and rms(step) is ignored.check_eigval_structure (
bool
, default:False
) -- Check the eigenvalues of the modes we maximize along. Convergence requires them to be negative. Useful if TS searches are started from geometries close to a minimum.restart_info (default:
None
) -- Restart information. Undocumented.check_coord_diffs (
bool
, default:True
) -- Whether coordinates of chain-of-sates images are checked for being too similar.coord_diff_thresh (
float
, default:0.01
) -- Unitless threshold for similary checking of COS image coordinates. The first image is assigned 0, the last image is assigned to 1.fragments (
Optional
[Tuple
], default:None
) -- Tuple of lists containing atom indices, defining two fragments.monitor_frag_dists (
int
, default:0
) -- Monitor fragment distances for N cycles. The optimization is terminated when the interfragment distances falls below the initial value after N cycles.out_dir (
str
, default:'.'
) -- String poiting to a directory where optimization progress is dumped.h5_fn (
str
, default:'optimization.h5'
) -- Basename of the HDF5 file used for dumping.h5_group_name (
str
, default:'opt'
) -- Groupname used for dumping of this optimization.
- check_convergence(step=None, multiple=1.0, overachieve_factor=None)[source]
Check if the current convergence of the optimization is equal to or below the required thresholds, or a multiple thereof. The latter may be used in initiating the climbing image.
pysisyphus.optimizers.PreconLBFGS module
- class pysisyphus.optimizers.PreconLBFGS.PreconLBFGS(geometry, alpha_init=1.0, history=7, precon=True, precon_update=1, precon_getter_update=None, precon_kind='full', max_step_element=None, line_search='armijo', c_stab=None, **kwargs)[source]
Bases:
Optimizer
- __init__(geometry, alpha_init=1.0, history=7, precon=True, precon_update=1, precon_getter_update=None, precon_kind='full', max_step_element=None, line_search='armijo', c_stab=None, **kwargs)[source]
Preconditioned limited-memory BFGS optimizer.
See pysisyphus.optimizers.precon for related references.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.alpha_init (
float
, default:1.0
) -- Initial scaling factor for the first trial step in the excplicit line search.history (
int
, default:7
) -- History size. Keep last 'history' steps and gradient differences.precon (
bool
, default:True
) -- Wheter to use preconditioning or not.precon_update (
int
, default:1
) -- Recalculate preconditioner P in every n-th cycle with the same topology.precon_getter_update (
Optional
[int
], default:None
) -- Recalculate topology for preconditioner P in every n-th cycle. It is usually sufficient to only determine the topology once at the beginning.precon_kind (
Literal
['full'
,'full_fast'
,'bonds'
,'bonds_bends'
], default:'full'
) -- What types of primitive internal coordinates to consider in the preconditioner.max_step_element (
Optional
[float
], default:None
) -- Maximum component of the absolute step vector when no line search is carried out.line_search (
Literal
['armijo'
,'armijo_fg'
,'strong_wolfe'
,'hz'
,None
,False
], default:'armijo'
) -- Whether to use explicit line searches and if so, which kind of line search.c_stab (
Optional
[float
], default:None
) -- Regularization constant c in (H + cI)⁻¹ in atomic units.**kwargs -- Keyword arguments passed to the Optimizer baseclass.
pysisyphus.optimizers.PreconSteepestDescent module
- class pysisyphus.optimizers.PreconSteepestDescent.PreconSteepestDescent(geometry, alpha_init=0.5, **kwargs)[source]
Bases:
PreconLBFGS
pysisyphus.optimizers.QuickMin module
pysisyphus.optimizers.RFOptimizer module
- class pysisyphus.optimizers.RFOptimizer.RFOptimizer(geometry, line_search=True, gediis=False, gdiis=True, gdiis_thresh=0.0025, gediis_thresh=0.01, gdiis_test_direction=True, max_micro_cycles=25, adapt_step_func=False, **kwargs)[source]
Bases:
HessianOptimizer
- __init__(geometry, line_search=True, gediis=False, gdiis=True, gdiis_thresh=0.0025, gediis_thresh=0.01, gdiis_test_direction=True, max_micro_cycles=25, adapt_step_func=False, **kwargs)[source]
Rational function Optimizer.
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.line_search (
bool
, default:True
) -- Whether to carry out implicit line searches.gediis (
bool
, default:False
) -- Whether to enable GEDIIS.gdiis (
bool
, default:True
) -- Whether to enable GDIIS.gdiis_thresh (
float
, default:0.0025
) -- Threshold for rms(forces) to enable GDIIS.gediis_thresh (
float
, default:0.01
) -- Threshold for rms(step) to enable GEDIIS.gdiis_test_direction (
bool
, default:True
) -- Whether to the overlap of the RFO step and the GDIIS step.max_micro_cycles (
int
, default:25
) -- Number of restricted-step microcycles. Disabled by default.adapt_step_func (
bool
, default:False
) -- Whether to switch between shifted Newton and RFO-steps.**kwargs -- Keyword arguments passed to the Optimizer/HessianOptimizer baseclass.
pysisyphus.optimizers.RSA module
- class pysisyphus.optimizers.RSA.RSA(geometry, trust_radius=0.5, trust_update=True, trust_min=0.1, trust_max=1, max_energy_incr=None, hessian_update='bfgs', hessian_init='fischer', hessian_recalc=None, hessian_recalc_adapt=None, hessian_xtb=False, hessian_recalc_reset=False, small_eigval_thresh=1e-08, line_search=False, alpha0=1.0, max_micro_cycles=25, rfo_overlaps=False, **kwargs)[source]
Bases:
HessianOptimizer
The Importance of Step Control in Optimization Methods, del Campo, 2009.
pysisyphus.optimizers.StabilizedQNMethod module
pysisyphus.optimizers.SteepestDescent module
pysisyphus.optimizers.StringOptimizer module
- class pysisyphus.optimizers.StringOptimizer.StringOptimizer(geometry, max_step=0.1, stop_in_when_full=-1, keep_last=10, lbfgs_when_full=True, gamma_mult=False, double_damp=True, scale_step='global', **kwargs)[source]
Bases:
Optimizer
pysisyphus.optimizers.closures module
- pysisyphus.optimizers.closures.bfgs_multiply(s_list, y_list, vector, beta=1, P=None, logger=None, gamma_mult=True, mu_reg=None, inds=None, cur_size=None)[source]
Matrix-vector product H·v.
Multiplies given vector with inverse Hessian, obtained from repeated BFGS updates calculated from steps in 's_list' and gradient differences in 'y_list'.
Based on algorithm 7.4 Nocedal, Num. Opt., p. 178.
- pysisyphus.optimizers.closures.get_update_mu_reg(mu_min=0.001, gamma_1=0.1, gamma_2=5.0, eta_1=0.01, eta_2=0.9, logger=None)[source]
See 5.1 in [1]
- pysisyphus.optimizers.closures.lbfgs_closure(force_getter, M=10, beta=1, restrict_step=None)[source]
- pysisyphus.optimizers.closures.modified_broyden_closure(force_getter, M=5, beta=1, restrict_step=None)[source]
https://doi.org/10.1006/jcph.1996.0059 F corresponds to the residual gradient, so we after calling force_getter we multiply the force by -1 to get the gradient.
- pysisyphus.optimizers.closures.small_lbfgs_closure(history=5, gamma_mult=True)[source]
Compact LBFGS closure.
The returned function takes two arguments: forces and prev_step. forces are the forces at the current iterate and prev_step is the previous step that lead us to the current iterate. In this way step restriction/line search can be done outisde of the lbfgs function.
pysisyphus.optimizers.cls_map module
pysisyphus.optimizers.exceptions module
pysisyphus.optimizers.gdiis module
- class pysisyphus.optimizers.gdiis.DIISResult(coeffs, coords, forces, energy, N, type)
Bases:
tuple
- N
Alias for field number 4
- coeffs
Alias for field number 0
- coords
Alias for field number 1
- energy
Alias for field number 3
- forces
Alias for field number 2
- type
Alias for field number 5
pysisyphus.optimizers.guess_hessians module
- pysisyphus.optimizers.guess_hessians.get_guess_hessian(geometry, hessian_init, int_gradient=None, cart_gradient=None, h5_fn=None)[source]
Obtain/calculate (model) Hessian.
For hessian_init="calc" the Hessian will be in the coord_type of the geometry, otherwise a Hessian in primitive internals will be returned.
- pysisyphus.optimizers.guess_hessians.improved_guess(geom, bond_func, bend_func, dihedral_func)[source]
- pysisyphus.optimizers.guess_hessians.lindh_guess(geom)[source]
Slightly modified Lindh model hessian as described in [1].
Instead of using the tabulated r_ref,ij values from [1] we will use the 'true' covalent radii as pyberny. The tabulated r_ref,ij value for two carbons (2nd period) is 2.87 Bohr. Carbons covalent radius is ~ 1.44 Bohr, so 2*1.44 Bohr = 2.88 Bohr which fits nicely with the tabulate value. If values for elements > 3rd are requested the alpha values for the 3rd period will be (re)used.
- pysisyphus.optimizers.guess_hessians.lindh_style_guess(geom, ks, rhos)[source]
Approximate force constants according to Lindh.[1]
Bonds: k_ij = k_r * rho_ij Bends: k_ijk = k_b * rho_ij * rho_jk Dihedrals: k_ijkl = k_d * rho_ij * rho_jk * rho_kl
pysisyphus.optimizers.hessian_updates module
- pysisyphus.optimizers.hessian_updates.double_damp(s, y, H=None, s_list=None, y_list=None, mu_1=0.2, mu_2=0.2, logger=None)[source]
Double damped step 's' and gradient differences 'y'.
H is the inverse Hessian! See [6]. Potentially updates s and y. y is only updated if mu_2 is not None.
- Parameters:
s (np.array, shape (N, ), floats) -- Coordiante differences/step.
y (np.array, shape (N, ), floats) -- Gradient differences
H (np.array, shape (N, N), floats, optional) -- Inverse Hessian.
s_list (list of nd.array, shape (K, N), optional) -- List of K previous steps. If no H is supplied and prev_ys is given the matrix-vector product Hy will be calculated through the two-loop LBFGS-recursion.
y_list (list of nd.array, shape (K, N), optional) -- List of K previous gradient differences. See s_list.
mu_1 (float, optional) -- Parameter for 's' damping.
mu_2 (float, optional) -- Parameter for 'y' damping.
logger (logging.Logger, optional) -- Logger to be used.
- Returns:
s (np.array, shape (N, ), floats) -- Damped coordiante differences/step.
y (np.array, shape (N, ), floats) -- Damped gradient differences
- pysisyphus.optimizers.hessian_updates.ts_bfgs_update_org(H, dx, dg)[source]
Do not use! Implemented as described in the 1998 bofill paper [8].
This does not seem to work too well.
- pysisyphus.optimizers.hessian_updates.ts_bfgs_update_revised(H, dx, dg)[source]
TS-BFGS update as described in [9].
Better than the original formula of Bofill, worse than the implementation in [7]. a is caluclated as described in the footnote 1 on page 38. Eq. (8) looks suspicious as it contains the inverse of a vector?! As also outlined in the paper abs(a) is used (|a| in the paper).
pysisyphus.optimizers.poly_fit module
- class pysisyphus.optimizers.poly_fit.FitResult(x, y, polys)
Bases:
tuple
- polys
Alias for field number 2
- x
Alias for field number 0
- y
Alias for field number 1
- pysisyphus.optimizers.poly_fit.gen_solutions()[source]
Given two energies (e0, e1) and corresponding gradients (g0, g1) we can (try to) fit a quartic polynomial
f(x) = a0 + a1*x + a2*x**2 + a3*x**3 + a4*x**4
s.t. the constraint f''(x) >= 0, with the equality being fullfilled at only one point. There are five unknowns (a0 - a4) to be determined. Four equations can be derived from f(x) and its first derivative
f'(x) = a1 + 2*a2*x + 3*a3*x**2 + 4*a4*x**3 .
With (e0, g0) being given at x=0 and (e1, g1) being given at x=1 we can setup the following equations:
f (0) = a0 (1) f'(0) = a1 (2)
- using e0 and g0 at x=0, and
f (1) = a0 + a1 + a2 + a3 + a4 (3) f'(1) = a1 + 2*a2 + 3*a3 + 4*a4 . (4)
The missing last equation can be derived from the constraint. The second derivative of f(x) is
f''(x) = 2*a2 + 6*a3*x + 12*a4*x**2
and shall be positive except at one point where it is allowed to be 0, that its two roots (f''(x) = 0) must be degenerate. This is fullfilled when the discriminant D of the quadratic polynomial a*x**2 + b*x + c is zero.
D = b**2 – 4*a*c = 0
- With
a = 12*a4 b = 6*a3 c = 2*a2
- we get
0 = (6*a3)**2 - 4*12*a4*2*a2 0 = 36*a3**2 - 96*a4*a2 0 = 3*a3**2 - 8*a4*a2 (5) or a4 = 3/8 * a3**2 / a2
Using (1) - (5) we can solve the set of equations for a0 - a4.
- pysisyphus.optimizers.poly_fit.poly_line_search(cur_energy, prev_energy, cur_grad, prev_grad, prev_step, cubic_max_x=2.0, quartic_max_x=4.0, logger=None)[source]
Generate directional gradients by projecting them on the previous step.
pysisyphus.optimizers.precon module
- pysisyphus.optimizers.precon.get_lindh_k(atoms, coords3d, bonds=None, angles=None, torsions=None)[source]
pysisyphus.optimizers.restrict_step module
Module contents
- class pysisyphus.optimizers.CubicNewton(geometry, **kwargs)[source]
Bases:
HessianOptimizer
pysisyphus.plotters package
Submodules
pysisyphus.plotters.AnimPlot module
Module contents
pysisyphus.stocastic package
Submodules
pysisyphus.stocastic.FragmentKick module
pysisyphus.stocastic.Kick module
pysisyphus.stocastic.Pipeline module
- class pysisyphus.stocastic.Pipeline.Pipeline(geom, calc_getter=None, seed=None, max_cycles=5, cycle_size=15, rmsd_thresh=0.1, energy_thresh=0.001, energy_range=0.125, compare_num=25, break_after=2, calc_kwargs=None)[source]
Bases:
object
- geom_is_valid(geom)[source]
Filter out geometries that are None, or were the atoms are too close or when they are already known.
pysisyphus.stocastic.align module
- pysisyphus.stocastic.align.apply_transform(coords3d, swap, reflection)[source]
Apply axis swaps and reflections to a coordinate array.
- pysisyphus.stocastic.align.match_geom_atoms(ref_geom, geom_to_match, hydrogen=True)[source]
Apply the hungarian method to geom_to_match.
Uses the scipy implementation of the Hungarian method/ Kuhn-Munkres algorithm in scipy.optimize.linear_sum_assignment.
- See
[1] 10.1021/ci400534h [2] 10.1021/acs.jcim.6b00516
- pysisyphus.stocastic.align.matched_rmsd(geom1, geom2, thresh=0.05)[source]
RMSD for optimally aligned and matched geometries.
- Returns:
matched_rmsd (float) -- RMSD of optimally aligned and matched geometries.
matched_geoms (tuple(Geometry, Geometry)) -- Tuple of the optimally aligned and matched geometries.
Module contents
pysisyphus.tests package
Submodules
pysisyphus.tests.test_calculators module
Module contents
pysisyphus.tsoptimizers package
Submodules
pysisyphus.tsoptimizers.RSIRFOptimizer module
- class pysisyphus.tsoptimizers.RSIRFOptimizer.RSIRFOptimizer(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
pysisyphus.tsoptimizers.RSPRFOptimizer module
- class pysisyphus.tsoptimizers.RSPRFOptimizer.RSPRFOptimizer(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
pysisyphus.tsoptimizers.TRIM module
- class pysisyphus.tsoptimizers.TRIM.TRIM(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
pysisyphus.tsoptimizers.TSHessianOptimizer module
- class pysisyphus.tsoptimizers.TSHessianOptimizer.TSHessianOptimizer(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
HessianOptimizer
Optimizer to find first-order saddle points.
- __init__(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Baseclass for transition state optimizers utilizing Hessian information.
Several arguments expect a typed primitive or an iterable of typed primitives. A typed primitive is specified as (PrimType, int, int, ...), e.g., for a bond between atoms 0 and 1: (BOND, 0, 1) or for a bend between the atom triple 0, 1, 2 as (BEND, 0, 1, 2).
- Parameters:
geometry (
Geometry
) -- Geometry to be optimized.roots (
Optional
[List
[int
]], default:None
) -- Indices of modes to maximize along, e.g., to optimize saddle points of 2nd order. Overrides 'root'.root (
int
, default:0
) -- Index of imaginary mode to maximize along. Shortcut for 'roots' with only one root.hessian_ref (
Optional
[str
], default:None
) -- Filename pointing to a pysisyphus HDF5 Hessian.rx_modes (iterable of (iterable of (typed_prim, phase_factor))) -- Select initial root(s) by overlap with a modes constructed from the given typed primitives with respective phase factors.
prim_coord (typed_prim) -- Select initial root/imaginary mode by overlap with this internal coordinate. Shortcut for 'rx_modes' with only one internal coordinate.
rx_coords (iterable of (typed_prim)) -- Construct imaginary mode comprising the given typed prims by modifying a model Hessian.
hessian_init (
Literal
['calc'
,'unit'
,'fischer'
,'lindh'
,'simple'
,'swart'
,'xtb'
,'xtb1'
,'xtbff'
], default:'calc'
) -- Type of initial model Hessian.hessian_update (
Literal
['none'
,None
,False
,'bfgs'
,'damped_bfgs'
,'flowchart'
,'bofill'
,'ts_bfgs'
,'ts_bfgs_org'
,'ts_bfgs_rev'
], default:'bofill'
) -- Type of Hessian update. Defaults to BFGS for minimizations and Bofill for saddle point searches.hessian_recalc_reset (
bool
, default:True
) -- Whether to skip Hessian recalculation after reset. Undocumented.max_micro_cycles (
int
, default:50
) -- Maximum number of RS iterations.trust_radius (
float
, default:0.3
) -- Initial trust radius in whatever unit the optimization is carried out.trust_max (
float
, default:0.5
) -- Maximum trust radius.augment_bonds (
bool
, default:False
) -- Try to derive additional streching coordinates from the imaginary mode.min_line_search (
bool
, default:False
) -- Carry out line search along the imaginary mode.max_line_search (
bool
, default:False
) -- Carry out line search in the subspace that is minimized.assert_neg_eigval (
bool
, default:False
) -- Check for the existences for at least one significant negative eigenvalue. If enabled and no negative eigenvalue is present the optimization will be aborted.**kwargs -- Keyword arguments passed to the HessianOptimizer/Optimizer baseclass.
- property root
- property roots
- valid_updates = ('bofill', 'ts_bfgs', 'ts_bfgs_org', 'ts_bfgs_rev')
Module contents
- class pysisyphus.tsoptimizers.RSIRFOptimizer(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
- class pysisyphus.tsoptimizers.RSPRFOptimizer(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
- class pysisyphus.tsoptimizers.TRIM(geometry, roots=None, root=0, hessian_ref=None, rx_modes=None, prim_coord=None, rx_coords=None, hessian_init='calc', hessian_update='bofill', hessian_recalc_reset=True, max_micro_cycles=50, trust_radius=0.3, trust_max=0.5, augment_bonds=False, min_line_search=False, max_line_search=False, assert_neg_eigval=False, **kwargs)[source]
Bases:
TSHessianOptimizer
pysisyphus.wrapper package
Submodules
pysisyphus.wrapper.jmol module
pysisyphus.wrapper.mwfn module
- pysisyphus.wrapper.mwfn.get_mwfn_exc_str(energies, Xa, Ya=None, Xb=None, Yb=None, thresh=0.001)[source]
Write plain text input for MWFN according to 3.21.
As of version 3.8 MWFN does not seem to handle this file when spin labels are present, even though it is given as an example in the manual.
- pysisyphus.wrapper.mwfn.make_cdd(inp_fn, state, log_fn, cwd=None, keep=False, quality=2, prefix='S')[source]
Create CDD cube in cwd.
- Parameters:
inp_fn (str) -- Filename of a .molden/.fchk file.
state (int) -- CDD cubes will be generated up to this state.
log_fn (str) -- Filename of the .log file.
cwd (str or Path, optional) -- If a different cwd should be used.
keep (bool) -- Wether to keep electron.cub and hole.cub, default is False.
quality (int) -- Quality of the cube. (1=low, 2=medium, 3=high).
pysisyphus.wrapper.packmol module
Module contents
Submodules
pysisyphus.Geometry module
- class pysisyphus.Geometry.Geometry(atoms, coords, fragments=None, coord_type='cart', coord_kwargs=None, isotopes=None, freeze_atoms=None, comment='', name='')[source]
Bases:
object
- __init__(atoms, coords, fragments=None, coord_type='cart', coord_kwargs=None, isotopes=None, freeze_atoms=None, comment='', name='')[source]
Object representing atoms in a coordinate system.
The Geometry represents atoms and their positions in coordinate system. By default cartesian coordinates are used, but internal coordinates are also possible.
- Parameters:
atoms (iterable) -- Iterable of length N, containing element symbols.
coords (1d iterable) -- 1d iterable of length 3N, containing the cartesian coordinates of N atoms.
fragments (dict, optional) -- Dict with different keys denoting different fragments. The values contain lists of atom indices.
coord_type ({"cart", "redund"}, optional) -- Type of coordinate system to use. Right now cartesian (cart) and redundand (redund) are supported.
coord_kwargs (dict, optional) -- Dictionary containing additional arguments that get passed to the constructor of the internal coordinate class.
isotopes (iterable of pairs, optional) -- Iterable of pairs consisting of 0-based atom index and either an integer or a float. If an integer is given the closest isotope mass will be selected. Given a float, this float will be directly used as mass.
freeze_atoms (iterable of integers) -- Specifies which atoms should remain fixed at their initial positions.
comment (str, optional) -- Comment string.
name (str, optional) -- Verbose name of the geometry, e.g. methanal or water. Used for printing
- property all_energies
Return energies of all states that were calculated.
This will also set self.energy, which may NOT be the ground state, but the state correspondig to the 'root' attribute of the calculator.
- approximate_radius()[source]
Approximate molecule radius from the biggest atom distance along an axis.
- as_g98_list()[source]
Returns data for fake Gaussian98 standard orientation output.
- Returns:
g98_list -- List with one row per atom. Every row contains [center number, atomic number, atomic type (always 0 for now), X Y Z coordinates in Angstrom.
- Return type:
list
- as_xyz(comment='', atoms=None, cart_coords=None)[source]
Current geometry as a string in XYZ-format.
- Parameters:
comment (str, optional) -- Will be written in the second line (comment line) of the XYZ-string.
cart_coords (np.array, 1d, shape (3 * atoms.size, )) -- Cartesians for dumping instead of self._coords.
- Returns:
xyz_str -- Current geometry as string in XYZ-format.
- Return type:
str
- assert_compatibility(other)[source]
Assert that two Geometries can be substracted from each other.
- Parameters:
other (Geometry) -- Geometry for comparison.
- atom_indices()[source]
Dict with atom types as key and corresponding indices as values.
- Returns:
inds_dict -- Unique atom types as keys, corresponding indices as values.
- Return type:
dict
- property atom_types
- property atomic_numbers
- property bond_sets
- property cart_coords
- property cart_forces
- property cart_gradient
- property cart_hessian
- property center_of_mass
Returns the center of mass.
- Returns:
R -- Center of mass.
- Return type:
np.array, shape(3, )
- center_of_mass_at(coords3d)[source]
Returns the center of mass at given coords3d.
- Parameters:
coords3d (np.array, shape(N, 3)) -- Cartesian coordiantes.
- Returns:
R -- Center of mass.
- Return type:
np.array, shape(3, )
- property centroid
Geometric center of the Geometry.
- Returns:
R -- Geometric center of the Geometry.
- Return type:
np.array, shape(3, )
- property comment
- coord_types = {'cart': None, 'cartesian': <class 'pysisyphus.intcoords.CartesianCoords.CartesianCoords'>, 'dlc': <class 'pysisyphus.intcoords.DLC.DLC'>, 'hdlc': <class 'pysisyphus.intcoords.DLC.HDLC'>, 'hredund': <class 'pysisyphus.intcoords.RedundantCoords.HybridRedundantCoords'>, 'mwcartesian': <class 'pysisyphus.intcoords.CartesianCoords.MWCartesianCoords'>, 'redund': <class 'pysisyphus.intcoords.RedundantCoords.RedundantCoords'>, 'tmtric': <class 'pysisyphus.intcoords.RedundantCoords.TMTRIC'>, 'tric': <class 'pysisyphus.intcoords.RedundantCoords.TRIC'>}
- property coords
1d vector of atomic coordinates.
- Returns:
coords -- 1d array holding the current coordinates.
- Return type:
np.array
- property coords3d
Coordinates in 3d.
- Returns:
coords3d -- Coordinates of the Geometry as 2D array.
- Return type:
np.array
- property coords_by_type
Coordinates in 3d by atom type and their corresponding indices.
- Returns:
cbt (dict) -- Dictionary with the unique atom types of the Geometry as keys. It's values are the 3d coordinates of the corresponding atom type.
inds (dict) -- Dictionary with the unique atom types of the Geometry as keys. It's values are the original indices of the 3d coordinates in the whole coords3d array.
- copy(coord_type=None, coord_kwargs=None)[source]
Returns a new Geometry object with same atoms and coordinates.
- Parameters:
coord_type (str) -- Desired coord_type, defaults to current coord_type.
coord_kwargs (dict, optional) -- Any desired coord_kwargs that will be passed to the RedundantCoords object.
- Returns:
geom -- New Geometry object with the same atoms and coordinates.
- Return type:
- property covalent_radii
- property energy
Energy of the current atomic configuration.
- Returns:
energy -- Energy of the current atomic configuration.
- Return type:
float
- property forces
Energy of the current atomic configuration.
- Returns:
force -- 1d array containing the forces acting on the atoms. Negative of the gradient.
- Return type:
np.array
- get_energy_and_forces_at(coords)[source]
Calculate forces and energies at the given coordinates.
The results are not saved in the Geometry object.
- get_normal_modes(cart_hessian=None, full=False)[source]
Normal mode wavenumbers, eigenvalues and Cartesian displacements Hessian.
- get_subgeom(indices, coord_type='cart', sort=False)[source]
Return a Geometry containing a subset of the current Geometry.
- Parameters:
indices (iterable of ints) -- Atomic indices that the define the subset of the current Geometry.
coord_type (str, ("cart", "redund"), optional) -- Coordinate system of the new Geometry.
- Returns:
sub_geom -- Subset of the current Geometry.
- Return type:
- property gradient
Negative of the force.
- Returns:
gradient -- 1d array containing the negative of the current forces.
- Return type:
np.array
- property hessian
Matrix of second derivatives of the energy in respect to atomic displacements.
- Returns:
hessian -- 2d array containing the second derivatives of the energy with respect to atomic/coordinate displacements depending on the type of coordiante system.
- Return type:
np.array
- property inertia_tensor
- property is_analytical_2d
- property layers
- property masses
- property masses_rep
- property mm_inv
Inverted mass matrix.
Returns a diagonal matrix containing the inverted atomic masses.
- property mm_sqrt_inv
Inverted square root of the mass matrix.
- property moving_atoms
- property mw_coords
Mass-weighted coordinates.
- Returns:
mw_coords -- 1d array containing the mass-weighted cartesian coordiantes.
- Return type:
np.array
- property mw_gradient
Mass-weighted gradient.
- Returns:
mw_gradient -- Returns the mass-weighted gradient.
- Return type:
np.array
- property mw_hessian
Mass-weighted hessian.
- Returns:
mw_hessian -- 2d array containing the mass-weighted hessian M^(-1/2) H M^(-1/2).
- Return type:
np.array
- principal_axes_are_aligned()[source]
Check if the principal axes are aligned with the cartesian axes.
- Returns:
aligned -- Wether the principal axes are aligned or not.
- Return type:
bool
- set_coord(ind, coord)[source]
Set a coordinate by index.
- Parameters:
ind (int) -- Index in of the coordinate to set in the self.coords array.
coord (float) -- Coordinate value.
- set_results(results)[source]
Save the results from a dictionary.
- Parameters:
results (dict) -- The keys in this dict will be set as attributes in the current object, with the corresponding item as value.
- property sum_formula
- property total_mass
- unweight_mw_hessian(mw_hessian)[source]
Unweight a mass-weighted hessian.
- Parameters:
mw_hessian (np.array) -- Mass-weighted hessian to be unweighted.
- Returns:
hessian -- 2d array containing the hessian.
- Return type:
np.array
- property vdw_radii
- pysisyphus.Geometry.get_trans_rot_vectors(cart_coords, masses, rot_thresh=1e-06)[source]
Vectors describing translation and rotation.
These vectors are used for the Eckart projection by constructing a projector from them.
See Martin J. Field - A Pratcial Introduction to the simulation of Molecular Systems, 2007, Cambridge University Press, Eq. (8.23), (8.24) and (8.26) for the actual projection.
See also https://chemistry.stackexchange.com/a/74923.
- Parameters:
cart_coords (np.array, 1d, shape (3 * atoms.size, )) -- Atomic masses in amu.
masses (iterable, 1d, shape (atoms.size, )) -- Atomic masses in amu.
- Returns:
ortho_vecs -- 2d array containing row vectors describing translations and rotations.
- Return type:
np.array(6, 3*atoms.size)
pysisyphus.TableFormatter module
pysisyphus.TablePrinter module
pysisyphus.color module
pysisyphus.config module
pysisyphus.constants module
pysisyphus.elem_data module
pysisyphus.exceptions module
pysisyphus.filtertrj module
pysisyphus.helpers module
- class pysisyphus.helpers.FinalHessianResult(neg_eigvals, eigvals, nus, imag_fns, thermo)
Bases:
tuple
- eigvals
Alias for field number 1
- imag_fns
Alias for field number 3
- neg_eigvals
Alias for field number 0
- nus
Alias for field number 2
- thermo
Alias for field number 4
- pysisyphus.helpers.do_final_hessian(geom, save_hessian=True, write_imag_modes=False, is_ts=False, prefix='', T=298.15, p=101325, ev_thresh=-1e-06, print_thermo=False, out_dir=None)[source]
- pysisyphus.helpers.fit_rigid(geometry, vectors=None, vector_lists=None, hessian=None, align_factor=1.0)[source]
- pysisyphus.helpers.geom_loader(fn, coord_type='cart', iterable=False, **coord_kwargs)[source]
After introducing the pubchem functionality I don't like this function anymore :) Too complicated.
- pysisyphus.helpers.get_tangent_trj_str(atoms, coords, tangent, comment=None, points=10, displ=None)[source]
- pysisyphus.helpers.index_array_from_overlaps(overlaps, axis=1)[source]
It is assumed that the overlaps between two points with indices i and j with (j > i) are computed and that i changes along the first axis (axis=0) and j changes along the second axis (axis=1).
So the first row of the overlap matrix (overlaps[0]) should contain the overlaps between state 0 at index i and all states at index j.
argmax along axis 1 returns the indices of the most overlapping states at index j with the states at index i, given by the item index in the indices array. E.g.:
[0 1 3 2] indicates a root flip in a system with four states when going from index i to index j. Root 2 at i became root 3 at j and vice versa.
- pysisyphus.helpers.match_geoms(ref_geom, geom_to_match, hydrogen=False)[source]
- See
[1] 10.1021/ci400534h [2] 10.1021/acs.jcim.6b00516
pysisyphus.helpers_pure module
- pysisyphus.helpers_pure.approx_float(num, expected, abs_tol=1e-06, rel_tol=1e-12)[source]
- Return type:
bool
- pysisyphus.helpers_pure.chunks(l, n)[source]
Yield successive n-sized chunks from l. https://stackoverflow.com/a/312464
- pysisyphus.helpers_pure.find_closest_sequence(str_, comp_strs)[source]
- Return type:
Tuple
[str
,float
]
- pysisyphus.helpers_pure.get_ratio(str_, comp_str)[source]
See https://stackoverflow.com/a/17388505
- Return type:
str
- pysisyphus.helpers_pure.increment_fn(org_fn, suffix=None)[source]
Append, or increase a suffixed counter on a given filename. If no counter is present it will be set to zero. Otherwise it is incremented by one.
>>> increment_fn("opt", "rebuilt") 'opt_rebuilt_000' >>> increment_fn("opt") 'opt_000' >>> increment_fn("opt_rebuilt_000", "rebuilt") 'opt_rebuilt_001'
- Parameters:
org_fn (
str
) -- The original, unaltered filename.suffix (
Optional
[str
], default:None
) -- Optional suffix to be append.
- Returns:
Modified filename with optional suffix and incremented counter.
- Return type:
incr_fn
- pysisyphus.helpers_pure.interpolate_colors(values, c1, c2, num=32)[source]
Expects two RGB colors c1 and c2.
- pysisyphus.helpers_pure.kill_dir(path)[source]
Innocent function remove a directory.
It must contain only files and no other directories. So this won't do too much damage hopefully.
- pysisyphus.helpers_pure.molecular_volume(coords3d, vdw_radii, n_trial=10000, offset=1.0)[source]
Monte-Carlo estimate of molecular volume using Van der Waals spheres. Cartesian coordinates and VdW-radii are expected in Bohr!
- Return type:
Tuple
[float
,float
,float
]
- pysisyphus.helpers_pure.recursive_update(d, u)[source]
Recursive update of d with keys/values from u.
- pysisyphus.helpers_pure.sort_by_central(set1, set2)[source]
Determines a common index in two sets and returns a length 3 tuple with the central index at the middle position and the two terminal indices as first and last indices.
pysisyphus.init_logging module
- pysisyphus.init_logging.get_fh_logger(name, log_fn)[source]
Initialize a logger with 'name', level DEBUG and a FileHandler.
pysisyphus.linalg module
- pysisyphus.linalg.eigvec_grad(w, v, ind, mat_grad)[source]
Gradient of 'ind'-th eigenvector.
dv_i / dx_i = (w_i*I - mat)⁻¹ dmat/dx_i v_i
- pysisyphus.linalg.finite_difference_hessian(coords, grad_func, step_size=0.01, acc=2, callback=None)[source]
Numerical Hessian from central finite gradient differences.
- Return type:
ndarray
[Any
,dtype
[float
]]
- See central differences in
for the different accuracies.
- pysisyphus.linalg.orthogonalize_against(mat, vecs, max_cycles=5, thresh=1e-10)[source]
Orthogonalize rows of 'mat' against rows in 'vecs'
Returns a (modified) copy of mat.
- pysisyphus.linalg.perp_comp(vec, along)[source]
Return the perpendicular component of vec along along.
- pysisyphus.linalg.pivoted_cholesky(A, tol=-1.0)[source]
Cholesky factorization a real symmetric positive semidefinite matrix. Cholesky factorization is carried out with full pivoting.
Adapated from PySCF.
P.T * A * P = L * L.T
- Parameters:
A (
ndarray
[Any
,dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]) -- Matrix to be factorized.tol (
float
, default:-1.0
) -- User defined tolerance, as outlined in the LAPACK docs.
- Returns:
L -- Lower or upper triangular matrix.
piv -- Pivot vectors, starting at 0.
rank -- Rank of the factoirzed matrix.
- pysisyphus.linalg.rmsd_grad(coords3d, ref_coords3d, offset=1e-09)[source]
RMSD and gradient between two sets of coordinates from quaternions.
The gradient is given w.r.t. the coordinates of 'coords3d'.
- Python adaption of
ls_rmsd.f90
- from the xtb repository of the Grimme group, which in turn implements
.
- Parameters:
coords3d (
ndarray
[Any
,dtype
[float
]]) -- Coordinate array of shape (N, 3) with N denoting the number of atoms.ref_coords3d (
ndarray
[Any
,dtype
[float
]]) -- Reference coordinates.offset (
float
, default:1e-09
) -- Small floating-point number that is added to the RMSD, to avoid division by zero.
- Return type:
Tuple
[float
,ndarray
[Any
,dtype
[float
]]]- Returns:
rmsd -- RMSD value.
rmsd_grad -- Gradient of the RMSD value w.r.t. to 'coords3d'.
pysisyphus.pack module
pysisyphus.peakdetect module
- pysisyphus.peakdetect.peakdetect(y_axis, x_axis=None, lookahead=200, delta=0)[source]
Converted from/based on a MATLAB script at: http://billauer.co.il/peakdet.html
function for detecting local maxima and minima in a signal. Discovers peaks by searching for values which are surrounded by lower or larger values for maxima and minima respectively
keyword arguments: y_axis -- A list containing the signal over which to find peaks
- x_axis -- A x-axis whose values correspond to the y_axis list and is used
in the return to specify the position of the peaks. If omitted an index of the y_axis is used. (default: None)
- lookahead -- distance to look ahead from a peak candidate to determine if
it is the actual peak (default: 200) '(samples / period) / f' where '4 >= f >= 1.25' might be a good value
- delta -- this specifies a minimum difference between a peak and
the following points, before a peak may be considered a peak. Useful to hinder the function from picking up false peaks towards to end of the signal. To work well delta should be set to delta >= RMSnoise * 5. (default: 0)
When omitted delta function causes a 20% decrease in speed. When used Correctly it can double the speed of the function
- return: two lists [max_peaks, min_peaks] containing the positive and
negative peaks respectively. Each cell of the lists contains a tuple of: (position, peak_value) to get the average peak value do: np.mean(max_peaks, 0)[1] on the results to unpack one of the lists into x, y coordinates do: x, y = zip(*max_peaks)
- pysisyphus.peakdetect.peakdetect_fft(y_axis, x_axis, pad_len=20)[source]
Performs a FFT calculation on the data and zero-pads the results to increase the time domain resolution after performing the inverse fft and send the data to the 'peakdetect' function for peak detection.
Omitting the x_axis is forbidden as it would make the resulting x_axis value silly if it was returned as the index 50.234 or similar.
Will find at least 1 less peak then the 'peakdetect_zero_crossing' function, but should result in a more precise value of the peak as resolution has been increased. Some peaks are lost in an attempt to minimize spectral leakage by calculating the fft between two zero crossings for n amount of signal periods.
The biggest time eater in this function is the ifft and thereafter it's the 'peakdetect' function which takes only half the time of the ifft. Speed improvements could include to check if 2**n points could be used for fft and ifft or change the 'peakdetect' to the 'peakdetect_zero_crossing', which is maybe 10 times faster than 'peakdetct'. The pro of 'peakdetect' is that it results in one less lost peak. It should also be noted that the time used by the ifft function can change greatly depending on the input.
keyword arguments: y_axis -- A list containing the signal over which to find peaks
- x_axis -- A x-axis whose values correspond to the y_axis list and is used
in the return to specify the position of the peaks.
- pad_len -- By how many times the time resolution should be
increased by, e.g. 1 doubles the resolution. The amount is rounded up to the nearest 2**n amount (default: 20)
- return: two lists [max_peaks, min_peaks] containing the positive and
negative peaks respectively. Each cell of the lists contains a tuple of: (position, peak_value) to get the average peak value do: np.mean(max_peaks, 0)[1] on the results to unpack one of the lists into x, y coordinates do: x, y = zip(*max_peaks)
- pysisyphus.peakdetect.peakdetect_parabola(y_axis, x_axis, points=31)[source]
Function for detecting local maxima and minima in a signal. Discovers peaks by fitting the model function: y = k (x - tau) ** 2 + m to the peaks. The amount of points used in the fitting is set by the points argument.
Omitting the x_axis is forbidden as it would make the resulting x_axis value silly, if it was returned as index 50.234 or similar.
will find the same amount of peaks as the 'peakdetect_zero_crossing' function, but might result in a more precise value of the peak.
keyword arguments: y_axis -- A list containing the signal over which to find peaks
- x_axis -- A x-axis whose values correspond to the y_axis list and is used
in the return to specify the position of the peaks.
- points -- How many points around the peak should be used during curve
fitting (default: 31)
- return: two lists [max_peaks, min_peaks] containing the positive and
negative peaks respectively. Each cell of the lists contains a tuple of: (position, peak_value) to get the average peak value do: np.mean(max_peaks, 0)[1] on the results to unpack one of the lists into x, y coordinates do: x, y = zip(*max_peaks)
- pysisyphus.peakdetect.peakdetect_sine(y_axis, x_axis, points=31, lock_frequency=False)[source]
Function for detecting local maxima and minima in a signal. Discovers peaks by fitting the model function: y = A * sin(2 * pi * f * (x - tau)) to the peaks. The amount of points used in the fitting is set by the points argument.
Omitting the x_axis is forbidden as it would make the resulting x_axis value silly if it was returned as index 50.234 or similar.
will find the same amount of peaks as the 'peakdetect_zero_crossing' function, but might result in a more precise value of the peak.
The function might have some problems if the sine wave has a non-negligible total angle i.e. a k*x component, as this messes with the internal offset calculation of the peaks, might be fixed by fitting a y = k * x + m function to the peaks for offset calculation.
keyword arguments: y_axis -- A list containing the signal over which to find peaks
- x_axis -- A x-axis whose values correspond to the y_axis list and is used
in the return to specify the position of the peaks.
- points -- How many points around the peak should be used during curve
fitting (default: 31)
- lock_frequency -- Specifies if the frequency argument of the model
function should be locked to the value calculated from the raw peaks or if optimization process may tinker with it. (default: False)
- return: two lists [max_peaks, min_peaks] containing the positive and
negative peaks respectively. Each cell of the lists contains a tuple of: (position, peak_value) to get the average peak value do: np.mean(max_peaks, 0)[1] on the results to unpack one of the lists into x, y coordinates do: x, y = zip(*max_peaks)
- pysisyphus.peakdetect.peakdetect_sine_locked(y_axis, x_axis, points=31)[source]
Convenience function for calling the 'peakdetect_sine' function with the lock_frequency argument as True.
keyword arguments: y_axis -- A list containing the signal over which to find peaks x_axis -- A x-axis whose values correspond to the y_axis list and is used
in the return to specify the position of the peaks.
- points -- How many points around the peak should be used during curve
fitting (default: 31)
return: see the function 'peakdetect_sine'
- pysisyphus.peakdetect.peakdetect_spline(y_axis, x_axis, pad_len=20)[source]
Performs a b-spline interpolation on the data to increase resolution and send the data to the 'peakdetect_zero_crossing' function for peak detection.
Omitting the x_axis is forbidden as it would make the resulting x_axis value silly if it was returned as the index 50.234 or similar.
will find the same amount of peaks as the 'peakdetect_zero_crossing' function, but might result in a more precise value of the peak.
keyword arguments: y_axis -- A list containing the signal over which to find peaks
- x_axis -- A x-axis whose values correspond to the y_axis list and is used
in the return to specify the position of the peaks. x-axis must be equally spaced.
- pad_len -- By how many times the time resolution should be increased by,
e.g. 1 doubles the resolution. (default: 20)
- return: two lists [max_peaks, min_peaks] containing the positive and
negative peaks respectively. Each cell of the lists contains a tuple of: (position, peak_value) to get the average peak value do: np.mean(max_peaks, 0)[1] on the results to unpack one of the lists into x, y coordinates do: x, y = zip(*max_peaks)
- pysisyphus.peakdetect.peakdetect_zero_crossing(y_axis, x_axis=None, window=11)[source]
Function for detecting local maxima and minima in a signal. Discovers peaks by dividing the signal into bins and retrieving the maximum and minimum value of each the even and odd bins respectively. Division into bins is performed by smoothing the curve and finding the zero crossings.
Suitable for repeatable signals, where some noise is tolerated. Executes faster than 'peakdetect', although this function will break if the offset of the signal is too large. It should also be noted that the first and last peak will probably not be found, as this function only can find peaks between the first and last zero crossing.
keyword arguments: y_axis -- A list containing the signal over which to find peaks
- x_axis -- A x-axis whose values correspond to the y_axis list
and is used in the return to specify the position of the peaks. If omitted an index of the y_axis is used. (default: None)
- window -- the dimension of the smoothing window; should be an odd integer
(default: 11)
- return: two lists [max_peaks, min_peaks] containing the positive and
negative peaks respectively. Each cell of the lists contains a tuple of: (position, peak_value) to get the average peak value do: np.mean(max_peaks, 0)[1] on the results to unpack one of the lists into x, y coordinates do: x, y = zip(*max_peaks)
- pysisyphus.peakdetect.zero_crossings(y_axis, window_len=11, window_f='hanning', offset_corrected=False)[source]
Algorithm to find zero crossings. Smooths the curve and finds the zero-crossings by looking for a sign change.
keyword arguments: y_axis -- A list containing the signal over which to find zero-crossings
- window_len -- the dimension of the smoothing window; should be an odd
integer (default: 11)
- window_f -- the type of window from 'flat', 'hanning', 'hamming',
'bartlett', 'blackman' (default: 'hanning')
offset_corrected -- Used for recursive calling to remove offset when needed
return: the index for each zero-crossing
- pysisyphus.peakdetect.zero_crossings_sine_fit(y_axis, x_axis, fit_window=None, smooth_window=11)[source]
Detects the zero crossings of a signal by fitting a sine model function around the zero crossings: y = A * sin(2 * pi * Hz * (x - tau)) + k * x + m Only tau (the zero crossing) is varied during fitting.
Offset and a linear drift of offset is accounted for by fitting a linear function the negative respective positive raw peaks of the wave-shape and the amplitude is calculated using data from the offset calculation i.e. the 'm' constant from the negative peaks is subtracted from the positive one to obtain amplitude.
Frequency is calculated using the mean time between raw peaks.
Algorithm seems to be sensitive to first guess e.g. a large smooth_window will give an error in the results.
keyword arguments: y_axis -- A list containing the signal over which to find peaks
- x_axis -- A x-axis whose values correspond to the y_axis list
and is used in the return to specify the position of the peaks. If omitted an index of the y_axis is used. (default: None)
- fit_window -- Number of points around the approximate zero crossing that
should be used when fitting the sine wave. Must be small enough that no other zero crossing will be seen. If set to none then the mean distance between zero crossings will be used (default: None)
- smooth_window -- the dimension of the smoothing window; should be an odd
integer (default: 11)
return: A list containing the positions of all the zero crossings.
pysisyphus.plot module
- pysisyphus.plot.CDD_PNG_FNS = 'cdd_png_fns'
Default to kJ mol⁻¹. DE_LABEL and get_en_conv will be overwritten when run() is executed. Both are still defined here, to make the functions from plot.py importable.
pysisyphus.run module
- class pysisyphus.run.RunResult(preopt_first_geom, preopt_last_geom, cos, cos_opt, ts_geom, ts_opt, end_geoms, irc, irc_geom, mdp_result, opt_geom, opt, calced_geoms, calced_results, stocastic, calc_getter, scan_geoms, scan_vals, scan_energies, perf_results)
Bases:
tuple
- calc_getter
Alias for field number 15
- calced_geoms
Alias for field number 12
- calced_results
Alias for field number 13
- cos
Alias for field number 2
- cos_opt
Alias for field number 3
- end_geoms
Alias for field number 6
- irc
Alias for field number 7
- irc_geom
Alias for field number 8
- mdp_result
Alias for field number 9
- opt
Alias for field number 11
- opt_geom
Alias for field number 10
- perf_results
Alias for field number 19
- preopt_first_geom
Alias for field number 0
- preopt_last_geom
Alias for field number 1
- scan_energies
Alias for field number 18
- scan_geoms
Alias for field number 16
- scan_vals
Alias for field number 17
- stocastic
Alias for field number 14
- ts_geom
Alias for field number 4
- ts_opt
Alias for field number 5
- pysisyphus.run.copy_yaml_and_geometries(run_dict, yaml_fn, dest_and_add_cp, new_yaml_fn=None)[source]
- pysisyphus.run.do_clean(force=False)[source]
Deletes files from previous runs in the cwd. A similar function could be used to store everything ...
- pysisyphus.run.do_rmsds(xyz, geoms, end_fns, end_geoms, preopt_map=None, similar_thresh=0.25)[source]
- pysisyphus.run.get_calc_closure(base_name, calc_key, calc_kwargs, iter_dict=None, index=None)[source]
- pysisyphus.run.print_header()[source]
Generated from https://asciiartgen.now.sh/?s=pysisyphus&style=colossal
- pysisyphus.run.run_calculations(geoms, calc_getter, scheduler=None, assert_track=False, run_func=None)[source]
- pysisyphus.run.run_from_dict(run_dict, cwd=None, set_defaults=True, yaml_fn=None, cp=None, scheduler=None, clean=False, fclean=False, version=False, restart=False)[source]
pysisyphus.socket_helper module
pysisyphus.testing module
pysisyphus.thermo module
pysisyphus.trj module
- pysisyphus.trj.dump_geoms(geoms, fn_base, trj_infix='', dump_trj=True, dump_xyz=True, dump_pdb=False, ang=False)[source]
- pysisyphus.trj.get_geoms(xyz_fns, coord_type='cart', geom_kwargs=None, union=False, same_prims=True, quiet=False, interpol_kwargs=None)[source]
Returns a list of Geometry objects in the given coordinate system and interpolates if necessary.
pysisyphus.version module
pysisyphus.xyzloader module
- pysisyphus.xyzloader.parse_xyz_str(xyz_str, with_comment)[source]
Parse a xyz string.
Paramters
- xyz_strstr
The contents of a .xyz file.
- with_commentbool
Return comment line if True.
- returns:
atoms (list) -- List of length N (N = number of atoms) holding the element symbols.
coords (np.array) -- An array of shape (N, 3) holding the xyz coordinates.
comment_line (str, optional) -- Comment line if with_comment argument was True.