PZ optimizer and stability analysis. More...
#include <pzstability.h>
Public Member Functions | |
PZStability (SCF *solver, bool verbose=true) | |
Constructor. | |
~PZStability () | |
Destructor. | |
void | set_method (const dft_t &ovmethod, const dft_t &oomethod, double pzw, pz_scaling_t scale, double scaleexp) |
Set method and weight. | |
void | set_params (bool real, bool imag, bool ov, bool oo) |
Set parameters. real: real rotations? imag: imaginary rotations? ov: ov rotations? oo: oo rotations? | |
void | set (const rscf_t &sol) |
Set reference. | |
void | set (const uscf_t &sol) |
Set reference. | |
double | get_E () |
Evaluate energy. | |
rscf_t | get_rsol () const |
Get updated solution. | |
uscf_t | get_usol () const |
Get updated solution. | |
bool | check (bool stability=false, double cutoff=-1e-3, double dEthr=-1e-7) |
Check stability of solution. | |
void | linesearch (const std::string &fname="pz_ls.dat", int prec=1, int Np=100) |
Print out a line search. | |
void | print_info () |
Print information. | |
void | perturb (double h=1e-6) |
Add in a small random perturbation to the solution. | |
virtual double | optimize (size_t maxiter=1000, double gthr=1e-4, double nrthr=1e-4, double dEthr=1e-9, int preconditioning=1) |
Run optimization. | |
![]() | |
FDHessian (bool verbose=true) | |
Constructor. | |
virtual | ~FDHessian () |
Destructor. | |
virtual arma::vec | gradient (const arma::vec &x) |
Evaluate finite difference gradient at point x. | |
virtual double | optimize (size_t maxiter=1000, double gthr=1e-4, bool max=false) |
Run optimization. | |
Protected Member Functions | |
size_t | count_ov_params (size_t o, size_t v) const |
Count amount of parameters for rotations. | |
size_t | count_oo_params (size_t o) const |
Count amount of parameters for rotations. | |
size_t | count_params (size_t o, size_t v) const |
Count amount of parameters for rotations. | |
size_t | count_params () const |
Count amount of parameters. | |
std::vector< pz_rot_par_t > | classify () const |
Classify parameters. | |
arma::cx_mat | rotation (const arma::vec &x, bool spin=false) const |
Calculate rotation matrix. | |
arma::cx_mat | rotation_pars (const arma::vec &x, bool spin=false) const |
Form rotation parameter matrix. | |
arma::cx_mat | matexp (const arma::cx_mat &X) const |
Calculate matrix exponential. | |
arma::cx_mat | unified_H (const arma::cx_mat &CO, const arma::cx_mat &CV, const std::vector< arma::cx_mat > &Forb, const arma::vec &worb, const arma::cx_mat &H0) const |
Construct unified Hamiltonian. | |
arma::vec | gradient () |
Evaluate analytic gradient. | |
arma::vec | gradient (const arma::vec &x, bool ref) |
Evaluate analytic gradient at point x. | |
arma::mat | hessian () |
Evaluate semi-analytic Hessian. | |
void | parallel_transport (arma::vec &gold, const arma::vec &sd, double step) const |
Parallel transport. | |
void | update_step (const arma::vec &g) |
Update step size. | |
void | diagonalize () |
Perform quasicanonical diagonalisation. | |
arma::vec | compute_worb (const arma::cx_mat &C) |
Get orbital weights. | |
void | scaling_gradient_oo (arma::cx_mat &gOO, const arma::cx_mat &CO, const arma::vec &Eorb) |
Put in the scaling part of the OO gradient. | |
void | scaling_gradient_ov (arma::cx_mat &gOV, const arma::cx_mat &CO, const arma::vec &Eorb, const arma::cx_mat &CV) |
Put in the scaling part of the OV gradient. | |
double | eval (const arma::vec &x, rscf_t &sol, std::vector< arma::cx_mat > &Forb, arma::vec &Eorb, arma::vec &worb, bool ks, bool fock, bool useref) |
Evaluate function at x, and possibly orbital Fock matrices. | |
double | eval (const arma::vec &x, uscf_t &sol, std::vector< arma::cx_mat > &Forba, arma::vec &Eorba, arma::vec &worba, std::vector< arma::cx_mat > &Forbb, arma::vec &Eorbb, arma::vec &worbb, bool ks, bool fock, bool useref) |
Evaluate function at x, and possibly orbital Fock matrices. | |
double | eval (const arma::vec &x) |
Evaluate function at x. | |
void | update (const arma::vec &x) |
Update solution. | |
void | update_reference (bool sort) |
Update reference. | |
void | update_grid (bool init) |
Update (adaptive) integration grid. If init=true, initialization is done for a static grid. | |
void | print_status (size_t iiter, const arma::vec &g, const Timer &t) const |
Print status of optimization. | |
void | print_info (const arma::cx_mat &CO, const arma::cx_mat &CV, const std::vector< arma::cx_mat > &Forb, const arma::cx_mat &H0, const arma::vec &Eorb, const arma::vec &worb) |
Print information on solution. | |
arma::cx_mat | get_H (const rscf_t &sol) const |
Get the full Fock matrix. | |
arma::cx_mat | get_H (const uscf_t &sol, bool spin) const |
Get the full Fock matrix. | |
arma::vec | precondition_unified (const arma::vec &g) const |
Precondition gradient vector with unified Hamiltonian. | |
arma::vec | precondition_orbital (const arma::vec &g) const |
Precondition gradient vector with orbital Hamiltonian. | |
arma::cx_mat | get_CO (const rscf_t &sol) const |
Get occupied orbitals (restricted) | |
arma::cx_mat | get_CO () const |
arma::cx_mat | get_CO (bool spin, const uscf_t &sol) const |
Get occupied orbitals (unrestricted) | |
arma::cx_mat | get_CO (bool spin) const |
arma::cx_mat | get_CV (const rscf_t &sol) const |
Get virtual orbitals (restricted) | |
arma::cx_mat | get_CV () const |
arma::cx_mat | get_CV (bool spin, const uscf_t &sol) const |
Get virtual orbitals (unrestricted) | |
arma::cx_mat | get_CV (bool spin) const |
Protected Attributes | |
SCF * | solverp |
SCF solver, used for energy calculations. | |
BasisSet | basis |
Basis set. | |
DFTGrid | grid |
DFT grid. | |
DFTGrid | nlgrid |
NL grid. | |
dft_t | ovmethod |
OV method. | |
dft_t | oomethod |
OO method. | |
double | pzw |
Weight for PZ correction. | |
pz_scaling_t | scale |
or scaling method | |
double | scaleexp |
and scaling exponent | |
rscf_t | rsol |
Reference solution. Spin-restricted. | |
uscf_t | usol |
or unrestricted | |
arma::vec | ref_Eorb |
Reference self-interaction energies. | |
arma::vec | ref_Eorba |
arma::vec | ref_Eorbb |
std::vector< arma::cx_mat > | ref_Forb |
Reference orbital Fock matrices. | |
std::vector< arma::cx_mat > | ref_Forba |
std::vector< arma::cx_mat > | ref_Forbb |
arma::vec | ref_worb |
Reference weighting factors. | |
arma::vec | ref_worba |
arma::vec | ref_worbb |
bool | real |
Real part of transformations? | |
bool | imag |
Imaginary part of transformations? | |
bool | cancheck |
Check stability of canonical orbitals? | |
bool | oocheck |
Check stability of oo block. | |
bool | restr |
Spin-restricted? | |
size_t | oa |
Amount of occupied orbitals. | |
size_t | ob |
size_t | va |
Amount of virtual orbitals. | |
size_t | vb |
double | Tmu |
Maximum step size. | |
![]() | |
bool | verbose |
Verbose operation? | |
double | ss_fd |
Finite difference derivative step size. | |
double | ss_ls |
Line search step size. | |
PZ optimizer and stability analysis.