Permalink
Browse files

Merge pull request #1166 from andysim/fmtgdma

fmt: clang-format GDMA interface
  • Loading branch information...
jturney committed Sep 7, 2018
2 parents f7c1a59 + 9d65ceb commit cb18022f12258b10cf85ff826b7c893c4ee336ac
Showing with 24 additions and 22 deletions.
  1. +24 −22 psi4/src/psi4/gdma_interface/wrapper.cc
@@ -36,17 +36,17 @@
#include <iostream>
extern "C" {
void run_gdma(const char* outfilename, const char*datfilename);
int get_nsites();
int get_order(int site);
double get_dma_value(int site, int addr);
double get_tot_value(int addr);
void run_gdma(const char* outfilename, const char* datfilename);
int get_nsites();
int get_order(int site);
double get_dma_value(int site, int addr);
double get_tot_value(int addr);
};
namespace psi { namespace gdma_interface {
namespace psi {
namespace gdma_interface {
SharedWavefunction gdma_interface(SharedWavefunction ref_wfn, Options & options, const std::string &datfilename)
{
SharedWavefunction gdma_interface(SharedWavefunction ref_wfn, Options& options, const std::string& datfilename) {
run_gdma(outfile_name.c_str(), datfilename.c_str());
// Reopen the outfile
if (outfile_name == "stdout") {
@@ -56,36 +56,38 @@ SharedWavefunction gdma_interface(SharedWavefunction ref_wfn, Options & options,
}
int nsites = get_nsites();
int maxorder = 0;
for(int site = 1; site <= nsites; ++site){
for (int site = 1; site <= nsites; ++site) {
int site_order = get_order(site);
maxorder = maxorder > site_order ? maxorder : site_order;
}
int nvals = (maxorder+1)*(maxorder+1);
int nvals = (maxorder + 1) * (maxorder + 1);
auto dmavals = std::make_shared<Matrix>("Spherical Harmonic DMA for each site", nsites, nvals);
for(int site = 1; site <= nsites; ++site){
for (int site = 1; site <= nsites; ++site) {
int site_order = get_order(site);
int site_nvals = (site_order+1)*(site_order+1);
for(int n = 1; n <= site_nvals; ++n){
int site_nvals = (site_order + 1) * (site_order + 1);
for (int n = 1; n <= site_nvals; ++n) {
double val = get_dma_value(site, n);
dmavals->set(site-1, n-1, val);
dmavals->set(site - 1, n - 1, val);
}
}
auto totvals = std::make_shared<Matrix>("Total multipoles, translated to the origin", 1, nvals);
for(int n = 1; n <= nvals; ++n){
for (int n = 1; n <= nvals; ++n) {
double val = get_tot_value(n);
totvals->set(0, n-1, val);
totvals->set(0, n - 1, val);
}
Process::environment.arrays["DMA DISTRIBUTED MULTIPOLES"] = dmavals;
Process::environment.arrays["DMA TOTAL MULTIPOLES"] = totvals;
outfile->Printf("\n DMA results are available in the Python driver through the\n"
"\t get_array_variable('DMA DISTRIBUTED MULTIPOLES')\n"
" and\n"
"\t get_array_variable('DMA TOTAL MULTIPOLES')\n"
" commands.\n\n");
outfile->Printf(
"\n DMA results are available in the Python driver through the\n"
"\t get_array_variable('DMA DISTRIBUTED MULTIPOLES')\n"
" and\n"
"\t get_array_variable('DMA TOTAL MULTIPOLES')\n"
" commands.\n\n");
return ref_wfn;
}
}}
} // namespace gdma_interface
} // namespace psi
#endif

0 comments on commit cb18022

Please sign in to comment.