oqp.library.libscipy

OQP single point class

Classes

Optimizer

TemplateOpt

ConstrainOpt

MECIOpt

MECPOpt

StateSpecificOpt

MEP

QMMMOpt

Functions

ReLU(x, y)

Module Contents

class Optimizer(mol)
OQP optimization class

user should use the subclass to define the one_step optimization function
see TemplateOpt class for example
mol
optimizer
step_size
step_tol
maxit
mep_maxit
rmsd_grad
rmsd_step
max_grad
max_step
istate
jstate
kstate
imult
jmult
energy_shift
energy_gap
init_scf
nstate
natom
atoms
sp
grad
ls
itr = 0
pre_energy = 0
pre_coord
metrics
optimize()
one_step(coordinates)
opt_func(coordinates)
check_convergence()
class TemplateOpt(mol)

Bases: Optimizer

OQP abstract class for optimization
one_step(coordinates)
class ConstrainOpt(mol)

Bases: Optimizer

OQP Constrained optimization class
mol
ref_coord
mass
tmass
init_energy = 0
last_energy = 0
init_xyz = None
last_xyz = None
last_radius = 0
opt_status = 0
message = 'not converged'
one_step(coordinates)
check_convergence()
class MECIOpt(mol)

Bases: Optimizer

OQP MECI optimization class

upb or penalty method
sigma
alpha
incre
weights
x
y
method
work_func
one_step(coordinates)
hybrid(coordinates, energies, grads)
first use penalty method
switch to ubp when gap is < self.energy_gap
ubp(coordinates, energies, grads)
update branching plane method
for state i and j,
j = i + 1

in the first step
x_0 = [G(j) - G(i)] / np.sum([G(j) - G(i)] ** 2) ** 2
y_0 = G(i) - np.sum(G(i) * x_0) * x_0
y_0 = y_0 / np.sum(y_0 ** 2), so x_0 and y_0 are orthonormal

in the k-th step
y_k = [(x_k-1 * x_k) * y_k-1 - (y_k-1 * x_k) * x_k-1] / [(y_k-1 * x_k) ** 2 + (x_k-1 * x_k) ** 2] ** 0.5
note the sign of x_k-1 and y_k-1 are opposite to the paper

F = [E(j) + E(i)] * 0.5 + [E(j) - E(i)] ** 2 / sigma
dF = PE * 0.5 + 2 * [E(j) - E(i)] / sigma * [G(j) - G(i)]
PE = G(j) + G(i) - np.sum([G(j) + G(i)] * x_k) * x_k - np.sum([G(j) + G(i)] * y_k) * y_k

in the original paper
sigma = np.sum([G(j) - G(i)] ** 2) ** 0.5

in this implementation
we set sigma = np.sum([G(j) - G(i)] ** 2)

reference: J. Chem. Theory Comput.2010,6,1538–1545
penalty(coordinates, energies, grads)
penalty method
for state i and j,
j = i + 1
F = [E(j) + E(i)] * 0.5 + sigma * P
P = [E(j) - E(i)] ** 2 / [E(j) - E(i) + alpha]
dF = [G(j) + G(i)] * 0.5 + sigma * dP
dP = {[E(j) - E(i)] ** 2 + 2 * alpha * [E(j) - E(i)]} / [E(j) - E(i) + alpha] ** 2 * [G(j) - G(i)]

in the original paper
sigma is a growing factor, 3.5
alpha is a constant factor, 0.02

in this implementation
we set a constant sigma to 1
we replace alpha with np.mean([G(j) - G(i)] ** 2) ** 0.5

reference: J. Phys. Chem. B 2008,112,405-413
check_convergence()
class MECPOpt(mol)

Bases: Optimizer

OQP MECP optimization class

quadratic method
weights
method
work_func
one_step(coordinates)
quad(coordinates, energies, grads)
quadratic penalty optimization

F = 0.5 * (E1 + E2) + w * (E2 - E1) ** 2
dF = 0.5 * (G1 + G2) + 2 * w * (E2 - E1) * (G2 - G1)
check_convergence()
class StateSpecificOpt(mol)

Bases: Optimizer

OQP state specific optimization class
method
one_step(coordinates)
class MEP(mol)
OQP minimum energy path calculation class
mol
istate
mep_maxit
atoms
mo = None
mep_itr = 0
mep_energies = []
optimizer
optimize()
check_mep()
ReLU(x, y)
class QMMMOpt(mol)

Bases: Optimizer

OQP QM/MM optimization class
mol
pre_coord
tmass
init_energy = 0
last_energy = 0
init_xyz = None
last_xyz = None
last_radius = 0
opt_status = 0
message = 'not converged'
one_step(coordinates)
check_convergence()