Skip to content

Commit

Permalink
Merge pull request #1257 from tomspur/cclambda_classes
Browse files Browse the repository at this point in the history
ENH: CCLambdaWfn inherits from CCEnergyWfn
  • Loading branch information
andysim committed Sep 25, 2018
2 parents 462dfac + fc4dc36 commit d9afbac
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 48 deletions.
2 changes: 0 additions & 2 deletions psi4/src/psi4/ccenergy/ccenergy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ double CCEnergyWavefunction::compute_energy() {
double **geom, *zvals, value;
FILE *efile;
int **cachelist, *cachefiles;
dpdfile2 t1;
dpdbuf4 t2;
double *emp2_aa, *emp2_ab, *ecc_aa, *ecc_ab, tval;

moinfo_.iter = 0;
Expand Down
4 changes: 2 additions & 2 deletions psi4/src/psi4/cclambda/L2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/
#include <cstdio>
#include "psi4/libdpd/dpd.h"
#include "psi4/cclambda/cclambda.h"
#include "MOInfo.h"
#include "Params.h"
#define EXTERN
Expand All @@ -57,9 +58,8 @@ void GmiL2(int L_irr);
void dijabL2(int L_irr);

void BL2_AO(int L_irr);
void status(const char *, std::string);

void L2_build(struct L_Params L_params) {
void CCLambdaWavefunction::L2_build(struct L_Params L_params) {
dpdbuf4 L2;
int L_irr;
L_irr = L_params.irrep;
Expand Down
9 changes: 5 additions & 4 deletions psi4/src/psi4/cclambda/cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "psi4/libciomr/libciomr.h"
#include "psi4/psifiles.h"
#include "psi4/libpsi4util/exception.h"
#include "psi4/cclambda/cclambda.h"

namespace psi {
extern FILE* outfile;
Expand All @@ -54,7 +55,7 @@ void cache_iajb_uhf(int **cachelist);
void cache_ijka_uhf(int **cachelist);
void cache_ijkl_uhf(int **cachelist);

int **cacheprep_uhf(int level, int *cachefiles)
int **CCLambdaWavefunction::cacheprep_uhf(int level, int *cachefiles)
{
int **cachelist;

Expand Down Expand Up @@ -120,7 +121,7 @@ int **cacheprep_uhf(int level, int *cachefiles)
}
}

int **cacheprep_rhf(int level, int *cachefiles)
int **CCLambdaWavefunction::cacheprep_rhf(int level, int *cachefiles)
{
int **cachelist;

Expand Down Expand Up @@ -745,12 +746,12 @@ void cache_ijkl_uhf(int **cachelist)
cachelist[23][23] = 1;
}

void cachedone_uhf(int **cachelist)
void CCLambdaWavefunction::cachedone_uhf(int **cachelist)
{
free_int_matrix(cachelist);
}

void cachedone_rhf(int **cachelist)
void CCLambdaWavefunction::cachedone_rhf(int **cachelist)
{
free_int_matrix(cachelist);
}
Expand Down
4 changes: 2 additions & 2 deletions psi4/src/psi4/cclambda/cc2_L2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/
#include <cstdio>
#include "psi4/libdpd/dpd.h"
#include "psi4/cclambda/cclambda.h"
#include "MOInfo.h"
#include "Params.h"
#define EXTERN
Expand All @@ -50,9 +51,8 @@ void L1FL2(int L_irr);
void dijabL2(int L_irr);

void BL2_AO(int L_irr);
void status(const char *, std::string );

void cc2_L2_build(struct L_Params L_params) {
void CCLambdaWavefunction::cc2_L2_build(struct L_Params L_params) {
int L_irr;
L_irr = L_params.irrep;

Expand Down
31 changes: 6 additions & 25 deletions psi4/src/psi4/cclambda/cclambda.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "psi4/libqt/qt.h"
#include "psi4/psi4-dec.h"
#include "psi4/libmints/wavefunction.h"
#include "psi4/libmints/matrix.h"

#include <cstdio>
#include <cstdlib>
Expand All @@ -57,29 +58,14 @@

namespace psi { namespace cclambda {

void init_io(void);
void title(void);
void get_moinfo(std::shared_ptr<Wavefunction> wfn);
void get_params(Options& options);
void cleanup(void);
void init_amps(struct L_Params L_params);
double pseudoenergy(struct L_Params L_params);
void exit_io(void);
void G_build(int L_irr);
void L1_build(struct L_Params L_params);
void L2_build(struct L_Params L_params);
void sort_amps(int L_irr);
void Lsave(int L_irr);
void Lnorm(struct L_Params L_params);
void Lmag(void);
void update(void);
int converged(int L_irr);
void diis(int iter, int L_irr);
int **cacheprep_rhf(int level, int *cachefiles);
int **cacheprep_uhf(int level, int *cachefiles);
void cachedone_rhf(int **cachelist);
void cachedone_uhf(int **cachelist);
void denom(struct L_Params);
void overlap(int L_irr);
void overlap_LAMPS(struct L_Params L_params);
void Lsave_index(struct L_Params L_params);
Expand All @@ -91,7 +77,6 @@ void c_clean(dpdfile2 *LIA, dpdfile2 *Lia, dpdbuf4 *LIJAB, dpdbuf4 *Lijab, dpdbu
void L_clean(struct L_Params pL_params);
void zeta_norm(struct L_Params pL_params);
void spinad_amps(void);
void status(const char *, std::string);
void hbar_extra(void);
void ortho_Rs(struct L_Params *pL_params, int current_L);

Expand All @@ -105,9 +90,6 @@ void cc3_t3x(void);
void cc3_l3l2(void);
void cc3_l3l1(void);

void local_init(void);
void local_done(void);

}} //namespace psi::cclambda

// Forward declaration to call cctriples
Expand All @@ -119,9 +101,8 @@ namespace psi { namespace cclambda {

CCLambdaWavefunction::CCLambdaWavefunction(std::shared_ptr<Wavefunction>
reference_wavefunction, Options &options)
: Wavefunction(options)
: CCEnergyWavefunction(reference_wavefunction, options)
{
set_reference_wavefunction(reference_wavefunction);
psio_ = _default_psio_lib_;
init();
}
Expand All @@ -141,7 +122,6 @@ double CCLambdaWavefunction::compute_energy()
energy_ = 0.0;
int done=0, i, root_L_irr;
int **cachelist, *cachefiles;
dpdfile2 L1;

init_io();
title();
Expand Down Expand Up @@ -299,6 +279,7 @@ double CCLambdaWavefunction::compute_energy()
}
Lsave_index(pL_params[i]); /* save Ls with indices in LAMPS */
Lamp_write(pL_params[i]); /* write out largest Ls */

/* sort_amps(); to be done by later functions */
outfile->Printf( "\n\tIterations converged.\n");

Expand Down Expand Up @@ -357,7 +338,7 @@ double CCLambdaWavefunction::compute_energy()
}

// must be fixed with options later for excited states
void init_io(void)
void CCLambdaWavefunction::init_io(void)
{
int i, num_unparsed;
char *lbl, *argv_unparsed[100];
Expand All @@ -382,7 +363,7 @@ void init_io(void)
for(i=PSIF_CC_MIN; i <= PSIF_CC_MAX; i++) psio_open(i,1);
}

void title(void)
void CCLambdaWavefunction::title(void)
{
outfile->Printf( "\n");
outfile->Printf( "\t\t\t**************************\n");
Expand All @@ -391,7 +372,7 @@ void title(void)
outfile->Printf( "\n");
}

void exit_io(void)
void CCLambdaWavefunction::exit_io(void)
{
int i;

Expand Down
26 changes: 25 additions & 1 deletion psi4/src/psi4/cclambda/cclambda.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define CCLAMBDA_H

#include "psi4/libmints/wavefunction.h"
#include "psi4/ccenergy/ccwave.h"

namespace psi {
class Wavefunction;
Expand All @@ -38,7 +39,7 @@ class Options;

namespace psi { namespace cclambda {

class CCLambdaWavefunction : public Wavefunction
class CCLambdaWavefunction final : public psi::ccenergy::CCEnergyWavefunction
{
public:
CCLambdaWavefunction(std::shared_ptr<Wavefunction> reference_wavefunction, Options &options);
Expand All @@ -48,6 +49,29 @@ class CCLambdaWavefunction : public Wavefunction

private:
void init();
void init_io();
void init_amps(struct L_Params);
int **cacheprep_uhf(int level, int *cachefiles);
int **cacheprep_rhf(int level, int *cachefiles);
void cachedone_rhf(int **cachelist);
void cachedone_uhf(int **cachelist);
void cleanup();
void denom(struct L_Params);
void get_params(psi::Options&);
void local_init();
void local_done();
void exit_io();
void title();
void get_moinfo(std::shared_ptr<psi::Wavefunction> wfn);

int converged(int);
void diis(int, int);
void sort_amps(int);
void status(const char*, std::string);
void update();

void cc2_L2_build(struct L_Params);
void L2_build(struct L_Params);
};

}}
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cclambda/converged.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@
#include <cmath>
#include "psi4/libdpd/dpd.h"
#include "psi4/libqt/qt.h"
#include "psi4/cclambda/cclambda.h"
#include "MOInfo.h"
#include "Params.h"
#define EXTERN
#include "globals.h"

namespace psi { namespace cclambda {

int converged(int L_irr)
int CCLambdaWavefunction::converged(int L_irr)
{
int row,col,h,nirreps;
double rms=0.0;
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cclambda/denom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <cstdio>
#include <cstring>
#include "psi4/libdpd/dpd.h"
#include "psi4/cclambda/cclambda.h"
#include "MOInfo.h"
#include "Params.h"
#define EXTERN
Expand All @@ -44,7 +45,7 @@ void denom_rhf(struct L_Params);
void denom_rohf(struct L_Params);
void denom_uhf(struct L_Params);

void denom(struct L_Params L_params) {
void CCLambdaWavefunction::denom(struct L_Params L_params) {
if(params.ref == 0) denom_rhf(L_params);
else if(params.ref == 1) denom_rohf(L_params);
else if(params.ref == 2) denom_uhf(L_params);
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cclambda/diis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "psi4/libdpd/dpd.h"
#include "psi4/libqt/qt.h"
#include "psi4/libpsi4util/exception.h"
#include "psi4/cclambda/cclambda.h"
#include "psi4/psifiles.h"
#include "MOInfo.h"
#include "Params.h"
Expand All @@ -60,7 +61,7 @@ namespace psi { namespace cclambda {
** -TDC 12/22/01
*/

void diis(int iter, int L_irr)
void CCLambdaWavefunction::diis(int iter, int L_irr)
{
int nvector=8; /* Number of error vectors to keep */
int h, nirreps;
Expand Down
5 changes: 3 additions & 2 deletions psi4/src/psi4/cclambda/get_moinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "psi4/libmints/wavefunction.h"
#include "psi4/libmints/basisset.h"
#include "psi4/libmints/molecule.h"
#include "psi4/cclambda/cclambda.h"
#include "MOInfo.h"
#include "Params.h"
#define EXTERN
Expand All @@ -54,7 +55,7 @@ namespace psi { namespace cclambda {
** Modified for UHF references by TDC, June 2002.
*/

void get_moinfo(std::shared_ptr<Wavefunction> wfn)
void CCLambdaWavefunction::get_moinfo(std::shared_ptr<Wavefunction> wfn)
{
int i,j, h, p, q, errcod, nactive, nirreps, sym;
double ***C, ***Ca, ***Cb;
Expand Down Expand Up @@ -241,7 +242,7 @@ void get_moinfo(std::shared_ptr<Wavefunction> wfn)
}

/* Frees memory allocated in get_moinfo() and dumps some info. */
void cleanup(void)
void CCLambdaWavefunction::cleanup(void)
{
int i, h;

Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cclambda/get_params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "psi4/libqt/qt.h"
#include "psi4/liboptions/liboptions.h"
#include "psi4/psi4-dec.h"
#include "psi4/cclambda/cclambda.h"

#include "MOInfo.h"
#include "Params.h"
Expand All @@ -51,7 +52,7 @@

namespace psi { namespace cclambda {

void get_params(Options& options)
void CCLambdaWavefunction::get_params(Options& options)
{
int errcod, iconv,i,j,k,l,prop_sym,prop_root, excited_method=0;
int *states_per_irrep, prop_all, lambda_and_Ls = 0;
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cclambda/init_amps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@
*/
#include <cstdio>
#include "psi4/libdpd/dpd.h"
#include "psi4/cclambda/cclambda.h"
#include "MOInfo.h"
#include "Params.h"
#define EXTERN
#include "globals.h"

namespace psi { namespace cclambda {

void init_amps(struct L_Params L_params)
void CCLambdaWavefunction::init_amps(struct L_Params L_params)
{
double norm;
dpdfile2 T1, R1, LIA, Lia, dIA, dia, XIA, Xia;
Expand Down
5 changes: 3 additions & 2 deletions psi4/src/psi4/cclambda/local.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "MOInfo.h"
#include "Params.h"
#include "Local.h"
#include "psi4/cclambda/cclambda.h"
#define EXTERN
#include "globals.h"

Expand All @@ -64,7 +65,7 @@ namespace psi { namespace cclambda {
** TDC, Jan-June 2002
*/

void local_init(void)
void CCLambdaWavefunction::local_init(void)
{
local.nso = moinfo.nso;
local.nocc = moinfo.occpi[0]; /* active doubly occupied orbitals */
Expand All @@ -74,7 +75,7 @@ void local_init(void)

}

void local_done(void)
void CCLambdaWavefunction::local_done(void)
{
outfile->Printf( "\tLocal parameters free.\n");
}
Expand Down
3 changes: 2 additions & 1 deletion psi4/src/psi4/cclambda/sort_amps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@
*/
#include <cstdio>
#include "psi4/libdpd/dpd.h"
#include "psi4/cclambda/cclambda.h"
#include "MOInfo.h"
#include "Params.h"
#define EXTERN
#include "globals.h"

namespace psi { namespace cclambda {

void sort_amps(int L_irr)
void CCLambdaWavefunction::sort_amps(int L_irr)
{
dpdbuf4 L2;

Expand Down
Loading

0 comments on commit d9afbac

Please sign in to comment.