Skip to content

Commit

Permalink
Merge pull request #1323 from robertodr/modernize-use-auto
Browse files Browse the repository at this point in the history
clang-tidy apply modernize-use-auto fixes
  • Loading branch information
dgasmith committed Oct 31, 2018
2 parents b39c597 + 470c5dc commit 20563da
Show file tree
Hide file tree
Showing 95 changed files with 296 additions and 296 deletions.
4 changes: 2 additions & 2 deletions psi4/src/psi4/cc/ccenergy/diis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ void CCEnergyWavefunction::diis_invert_B(double** B, double* C, int dimension, d
double** Bp = B2->pointer();
::memcpy((void*)Bp[0], B[0], sizeof(double) * dimension * dimension);

double* Sp = new double[dimension];
double* Tp = new double[dimension];
auto* Sp = new double[dimension];
auto* Tp = new double[dimension];

bool is_zero = false;
for (int i = 0; i < dimension - 1; i++) {
Expand Down
10 changes: 5 additions & 5 deletions psi4/src/psi4/cc/ccenergy/form_df_ints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void CCEnergyWavefunction::form_df_ints(Options &options, int **cachelist, int *
// We're done with the original AO basis integrals now
Qao.reset();

double *htints = new double[nbf2];
auto *htints = new double[nbf2];

/*
* Set up the DPD machinery
Expand All @@ -107,8 +107,8 @@ void CCEnergyWavefunction::form_df_ints(Options &options, int **cachelist, int *
aospaces.push_back(moinfo_.virtpi);
aospaces.push_back(moinfo_.vir_sym);
}
int *dforbspi = new int[moinfo_.nirreps];
int *dummyorbspi = new int[moinfo_.nirreps];
auto *dforbspi = new int[moinfo_.nirreps];
auto *dummyorbspi = new int[moinfo_.nirreps];
int count = 0;
for (int h = 0; h < moinfo_.nirreps; ++h) {
dummyorbspi[h] = 0;
Expand All @@ -117,8 +117,8 @@ void CCEnergyWavefunction::form_df_ints(Options &options, int **cachelist, int *
count += norb;
}
dummyorbspi[0] = 1;
int *dforbsym = new int[count];
int *dummyorbsym = new int[1];
auto *dforbsym = new int[count];
auto *dummyorbsym = new int[1];
dummyorbsym[0] = 0;
count = 0;
for (int h = 0; h < moinfo_.nirreps; ++h)
Expand Down
2 changes: 1 addition & 1 deletion psi4/src/psi4/cc/cceom/get_eom_params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void get_eom_params(SharedWavefunction ref_wfn, Options &options) {
size_t full_nirreps = old_pg->char_table().nirrep();
if (options["ROOTS_PER_IRREP"].size() != full_nirreps)
throw PSIEXCEPTION("Input ROOTS_PER_IRREP array has the wrong dimensions");
int *temp_docc = new int[full_nirreps];
auto *temp_docc = new int[full_nirreps];
for (int h = 0; h < full_nirreps; ++h) temp_docc[h] = options["ROOTS_PER_IRREP"][h].to_integer();
map_irreps(temp_docc, old_pg, ref_wfn->molecule()->point_group());
eom_params.states_per_irrep = new int[moinfo.nirreps];
Expand Down
2 changes: 1 addition & 1 deletion psi4/src/psi4/dcft/dcft_density_UHF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ void DCFTSolver::compute_TPDM_trace() {
opdm_trace += (aocc_tau_->trace() + bocc_tau_->trace() + avir_tau_->trace() + bvir_tau_->trace());

// Compute deviations from N-representability
double N = (double)(nalpha_ + nbeta_);
auto N = (double)(nalpha_ + nbeta_);
double opdm_dev = N - opdm_trace;
double tpdm_dev = N * (N - 1.0) - tpdm_trace;

Expand Down
12 changes: 6 additions & 6 deletions psi4/src/psi4/dcft/dcft_gradient_RHF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,15 @@ void DCFTSolver::compute_ewdm_odc_RHF() {
auto a_opdm = std::make_shared<Matrix>("MO basis OPDM (Alpha)", nirrep_, nmopi_, nmopi_);

const int *alpha_corr_to_pitzer = _ints->alpha_corr_to_pitzer();
int *alpha_pitzer_to_corr = new int[nmo_];
auto *alpha_pitzer_to_corr = new int[nmo_];
::memset(alpha_pitzer_to_corr, '\0', nmo_ * sizeof(int));

for (int n = 0; n < nmo_; ++n) {
alpha_pitzer_to_corr[alpha_corr_to_pitzer[n]] = n;
}

const int *beta_corr_to_pitzer = _ints->beta_corr_to_pitzer();
int *beta_pitzer_to_corr = new int[nmo_];
auto *beta_pitzer_to_corr = new int[nmo_];
::memset(beta_pitzer_to_corr, '\0', nmo_ * sizeof(int));

for (int n = 0; n < nmo_; ++n) {
Expand Down Expand Up @@ -553,10 +553,10 @@ void DCFTSolver::compute_ewdm_odc_RHF() {
psio_->write_entry(PSIF_MO_OPDM, "MO-basis OPDM", (char *)a_qt[0], sizeof(double) * nmo_ * nmo_);
psio_->close(PSIF_MO_OPDM, 1);

int *aocc_qt = new int[nalpha_];
int *bocc_qt = new int[nbeta_];
int *avir_qt = new int[navir_];
int *bvir_qt = new int[nbvir_];
auto *aocc_qt = new int[nalpha_];
auto *bocc_qt = new int[nbeta_];
auto *avir_qt = new int[navir_];
auto *bvir_qt = new int[nbvir_];

int aocc_count = 0;
int bocc_count = 0;
Expand Down
24 changes: 12 additions & 12 deletions psi4/src/psi4/dcft/dcft_gradient_UHF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3631,15 +3631,15 @@ void DCFTSolver::compute_ewdm_dc() {
auto b_zia = std::make_shared<Matrix>("MO basis Orbital Response (Beta)", nirrep_, nmopi_, nmopi_);

const int *alpha_corr_to_pitzer = _ints->alpha_corr_to_pitzer();
int *alpha_pitzer_to_corr = new int[nmo_];
auto *alpha_pitzer_to_corr = new int[nmo_];
::memset(alpha_pitzer_to_corr, '\0', nmo_ * sizeof(int));

for (int n = 0; n < nmo_; ++n) {
alpha_pitzer_to_corr[alpha_corr_to_pitzer[n]] = n;
}

const int *beta_corr_to_pitzer = _ints->beta_corr_to_pitzer();
int *beta_pitzer_to_corr = new int[nmo_];
auto *beta_pitzer_to_corr = new int[nmo_];
::memset(beta_pitzer_to_corr, '\0', nmo_ * sizeof(int));

for (int n = 0; n < nmo_; ++n) {
Expand Down Expand Up @@ -3909,10 +3909,10 @@ void DCFTSolver::compute_ewdm_dc() {
psio_->write_entry(PSIF_MO_OPDM, "MO-basis Beta OPDM", (char *)b_qt[0], sizeof(double) * nmo_ * nmo_);
psio_->close(PSIF_MO_OPDM, 1);

int *aocc_qt = new int[nalpha_];
int *bocc_qt = new int[nbeta_];
int *avir_qt = new int[navir_];
int *bvir_qt = new int[nbvir_];
auto *aocc_qt = new int[nalpha_];
auto *bocc_qt = new int[nbeta_];
auto *avir_qt = new int[navir_];
auto *bvir_qt = new int[nbvir_];

int aocc_count = 0;
int bocc_count = 0;
Expand Down Expand Up @@ -4590,15 +4590,15 @@ void DCFTSolver::compute_ewdm_odc() {
auto b_opdm = std::make_shared<Matrix>("MO basis OPDM (Beta)", nirrep_, nmopi_, nmopi_);

const int *alpha_corr_to_pitzer = _ints->alpha_corr_to_pitzer();
int *alpha_pitzer_to_corr = new int[nmo_];
auto *alpha_pitzer_to_corr = new int[nmo_];
::memset(alpha_pitzer_to_corr, '\0', nmo_ * sizeof(int));

for (int n = 0; n < nmo_; ++n) {
alpha_pitzer_to_corr[alpha_corr_to_pitzer[n]] = n;
}

const int *beta_corr_to_pitzer = _ints->beta_corr_to_pitzer();
int *beta_pitzer_to_corr = new int[nmo_];
auto *beta_pitzer_to_corr = new int[nmo_];
::memset(beta_pitzer_to_corr, '\0', nmo_ * sizeof(int));

for (int n = 0; n < nmo_; ++n) {
Expand Down Expand Up @@ -4780,10 +4780,10 @@ void DCFTSolver::compute_ewdm_odc() {
psio_->write_entry(PSIF_MO_OPDM, "MO-basis Beta OPDM", (char *)b_qt[0], sizeof(double) * nmo_ * nmo_);
psio_->close(PSIF_MO_OPDM, 1);

int *aocc_qt = new int[nalpha_];
int *bocc_qt = new int[nbeta_];
int *avir_qt = new int[navir_];
int *bvir_qt = new int[nbvir_];
auto *aocc_qt = new int[nalpha_];
auto *bocc_qt = new int[nbeta_];
auto *avir_qt = new int[navir_];
auto *bvir_qt = new int[nbvir_];

int aocc_count = 0;
int bocc_count = 0;
Expand Down
8 changes: 4 additions & 4 deletions psi4/src/psi4/dcft/dcft_integrals_RHF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ void DCFTSolver::build_denominators_RHF() {
dpdbuf4 D;
dpdfile2 F;

double *aOccEvals = new double[nalpha_];
double *bOccEvals = new double[nbeta_];
double *aVirEvals = new double[navir_];
double *bVirEvals = new double[nbvir_];
auto *aOccEvals = new double[nalpha_];
auto *bOccEvals = new double[nbeta_];
auto *aVirEvals = new double[navir_];
auto *bVirEvals = new double[nbvir_];
// Pick out the diagonal elements of the Fock matrix, making sure that they are in the order
// used by the DPD library, i.e. starting from zero for each space and ordering by irrep
int aOccCount = 0, aVirCount = 0;
Expand Down
8 changes: 4 additions & 4 deletions psi4/src/psi4/dcft/dcft_integrals_UHF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,10 @@ void DCFTSolver::build_denominators() {
dpdbuf4 D;
dpdfile2 F;

double *aOccEvals = new double[nalpha_];
double *bOccEvals = new double[nbeta_];
double *aVirEvals = new double[navir_];
double *bVirEvals = new double[nbvir_];
auto *aOccEvals = new double[nalpha_];
auto *bOccEvals = new double[nbeta_];
auto *aVirEvals = new double[navir_];
auto *bVirEvals = new double[nbvir_];
// Pick out the diagonal elements of the Fock matrix, making sure that they are in the order
// used by the DPD library, i.e. starting from zero for each space and ordering by irrep
int aOccCount = 0, bOccCount = 0, aVirCount = 0, bVirCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion psi4/src/psi4/dcft/dcft_memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void DCFTSolver::init() {
}

// Store the AO overlap matrix
double *sArray = new double[ntriso_];
auto *sArray = new double[ntriso_];
IWL::read_one(psio_.get(), PSIF_OEI, PSIF_SO_S, sArray, ntriso_, 0, 0, "outfile");
ao_s_->set(sArray);
delete[] sArray;
Expand Down
10 changes: 5 additions & 5 deletions psi4/src/psi4/dcft/dcft_qc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ void DCFTSolver::form_idps() {
::memset(lookup_orbitals_, '\0', sizeof(int) * dim_orbitals_);

// Temporary vectors containing gradient value and diagonal part of the Hessian for each IDP
double *grad = new double[dim_];
double *Hd = new double[dim_];
auto *grad = new double[dim_];
auto *Hd = new double[dim_];

// Count the number of IDPs for orbital rotations (Alpha spin)
// The minus sign in the gradient takes into account the sign of the g vector in the N-R equations: dX H = -g
Expand Down Expand Up @@ -2072,7 +2072,7 @@ void DCFTSolver::run_davidson() {
G->diagonalize(Evecs, Evals, ascending);

// Define the eigenvectors to be positive to make sure the phase doesn't change
double *ones = new double[b_dim_];
auto *ones = new double[b_dim_];
for (int i = 0; i < b_dim_; ++i) ones[i] = 1.0;
double **Evecs_p = Evecs->pointer();
for (int k = 0; k < b_dim_; ++k) {
Expand Down Expand Up @@ -2166,8 +2166,8 @@ void DCFTSolver::run_davidson() {
double value = Evals->get(k);
outfile->Printf("\t %10.6f \n", value);
if (value < 0.0) {
double *max_values = new double[values_to_print + 1];
int *max_values_idp = new int[values_to_print + 1];
auto *max_values = new double[values_to_print + 1];
auto *max_values_idp = new int[values_to_print + 1];
int stored = 0;

double norm = 0.0;
Expand Down
4 changes: 2 additions & 2 deletions psi4/src/psi4/dcft/dcft_sort_mo_tpdm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void DCFTSolver::presort_mo_tpdm_AB() {
int q = _ints->alpha_corr_to_pitzer()[(int)lblptr[labelIndex++]];
int r = _ints->alpha_corr_to_pitzer()[(int)lblptr[labelIndex++]];
int s = _ints->alpha_corr_to_pitzer()[(int)lblptr[labelIndex++]];
double value = (double)valptr[index];
auto value = (double)valptr[index];
dpdFiller(p, q, r, s, value);
} /* end loop through current buffer */
} while (!lastbuf); /* end loop over reading buffers */
Expand Down Expand Up @@ -310,7 +310,7 @@ void DCFTSolver::presort_mo_tpdm_AA() {
int q = _ints->alpha_corr_to_pitzer()[(int)lblptr[labelIndex++]];
int r = _ints->alpha_corr_to_pitzer()[(int)lblptr[labelIndex++]];
int s = _ints->alpha_corr_to_pitzer()[(int)lblptr[labelIndex++]];
double value = (double)valptr[index];
auto value = (double)valptr[index];
dpdFiller(p, q, r, s, value);

} /* end loop through current buffer */
Expand Down
16 changes: 8 additions & 8 deletions psi4/src/psi4/detci/ciwave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ void CIWavefunction::orbital_locations(const std::string& orbitals, int* start,

SharedMatrix CIWavefunction::get_orbitals(const std::string& orbital_name) {
/// Figure out orbital positions
int* start = new int[nirrep_];
int* end = new int[nirrep_];
auto* start = new int[nirrep_];
auto* end = new int[nirrep_];

orbital_locations(orbital_name, start, end);

int* spread = new int[nirrep_];
auto* spread = new int[nirrep_];
for (int h = 0; h < nirrep_; h++) {
spread[h] = end[h] - start[h];
}
Expand All @@ -286,12 +286,12 @@ SharedMatrix CIWavefunction::get_orbitals(const std::string& orbital_name) {

void CIWavefunction::set_orbitals(const std::string& orbital_name, SharedMatrix orbitals) {
/// Figure out orbital positions
int* start = new int[nirrep_];
int* end = new int[nirrep_];
auto* start = new int[nirrep_];
auto* end = new int[nirrep_];

orbital_locations(orbital_name, start, end);

int* spread = new int[nirrep_];
auto* spread = new int[nirrep_];
for (int h = 0; h < nirrep_; h++) {
spread[h] = end[h] - start[h];
}
Expand All @@ -311,8 +311,8 @@ void CIWavefunction::set_orbitals(const std::string& orbital_name, SharedMatrix

Dimension CIWavefunction::get_dimension(const std::string& orbital_name) {
/// Figure out orbital positions
int* start = new int[nirrep_];
int* end = new int[nirrep_];
auto* start = new int[nirrep_];
auto* end = new int[nirrep_];
orbital_locations(orbital_name, start, end);

Dimension dim = Dimension(nirrep_);
Expand Down
4 changes: 2 additions & 2 deletions psi4/src/psi4/detci/compute_mpn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void CIWavefunction::mpn_generator(CIvect &Hd) {
else {
std::string str = std::to_string(13);
str += " vector norm = ";
char *str2 = new char[25];
auto *str2 = new char[25];
sprintf(str2, "%20.15lf", cvec_norm[k - 1]);
str += str2;
str += " < ";
Expand All @@ -427,7 +427,7 @@ void CIWavefunction::mpn_generator(CIvect &Hd) {
else {
std::string str = std::to_string(13);
str += " vector norm = ";
char *str2 = new char[25];
auto *str2 = new char[25];
sprintf(str2, "%20.15lf", cvec_norm[k - 1]);
str += str2;
str += " < ";
Expand Down
2 changes: 1 addition & 1 deletion psi4/src/psi4/detci/diag_h.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int CIWavefunction::diag_h(double conv_e, double conv_rms) {

// Write evecs to Dvec
evals = init_array(nroots);
double *tmp_buff = new double[size];
auto *tmp_buff = new double[size];
double **evecsp = evecs->pointer();
double *evals_vp = evals_v->pointer();
for (size_t root = 0; root < nroots; root++) {
Expand Down
2 changes: 1 addition & 1 deletion psi4/src/psi4/detci/ints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ void CIWavefunction::read_dpd_ci_ints() {
// => Read one electron integrals <= //
// Build temporary desired arrays
int nmotri_full = (CalcInfo_->nmo * (CalcInfo_->nmo + 1)) / 2;
double* tmp_onel_ints = new double[nmotri_full];
auto* tmp_onel_ints = new double[nmotri_full];

// Read one electron integrals
iwl_rdone(PSIF_OEI, PSIF_MO_FZC, tmp_onel_ints, nmotri_full, 0, (print_ > 4), "outfile");
Expand Down
2 changes: 1 addition & 1 deletion psi4/src/psi4/detci/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ void CIWavefunction::get_parameters(Options &options) {
}
if (junk <= 0.0) {
std::string str = "Error: AVERAGE WEIGHTS add up to ";
char *str2 = new char[25];
auto *str2 = new char[25];
sprintf(str2, "%20.15lf", junk);
str += str2;
delete[] str2;
Expand Down
2 changes: 1 addition & 1 deletion psi4/src/psi4/dfmp2/mp2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void DFMP2::compute_opdm_and_nos(const SharedMatrix Dnosym, SharedMatrix Dso, Sh
// Now, copy over the full matrix, whenever nonzero columns are
for (int h = 0; h < nirrep_; ++h) {
if (nsopi_[h] == 0) continue;
double* CStemp = new double[nsopi_[h]];
auto* CStemp = new double[nsopi_[h]];
double** pC1 = SO_c1NO->pointer(h);
double** Smat = S_->pointer(h);
int symcol = 0;
Expand Down
Loading

0 comments on commit 20563da

Please sign in to comment.