Psi4
csg.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _psi_src_lib_libcubeprop_csg_h_
29 #define _psi_src_lib_libcubeprop_csg_h_
30 
31 #include <map>
32 #include <set>
33 
34 #include "psi4/libmints/typedefs.h"
35 
36 namespace psi {
37 
38 class Options;
39 class BasisExtents;
40 class RKSFunctions;
41 class BlockOPoints;
42 
44 
45 protected:
46 
47  // => Input Specification <= //
48 
52  std::shared_ptr<Molecule> mol_;
54  std::shared_ptr<BasisSet> primary_;
56  std::shared_ptr<BasisSet> auxiliary_;
58  std::string filepath_;
59 
60  // => Physical Grid <= //
61 
63  int* N_;
65  double* D_;
67  double* O_;
68 
70  size_t npoints_;
72  size_t nxyz_;
73 
75  double* x_;
77  double* y_;
79  double* z_;
81  double* w_;
82 
83  // => Grid Computers <= //
84 
86  std::vector<std::shared_ptr<BlockOPoints> > blocks_;
88  std::shared_ptr<BasisExtents> extents_;
90  std::shared_ptr<RKSFunctions> points_;
91 
92  // => Helper Routines <= //
93 
95  void populate_grid();
96 
97 public:
98  // => Constructors <= //
99 
100  CubicScalarGrid(std::shared_ptr<BasisSet> primary, Options& options);
101  virtual ~CubicScalarGrid();
102 
103  // => High-Level Setup Routines <= //
104 
106  void build_grid();
108  void build_grid(const std::string filepath, int* N, double* D, double* O);
110  void build_grid(std::shared_ptr<CubicScalarGrid> other);
112  void print_header();
113 
115  void set_auxiliary_basis(std::shared_ptr<BasisSet> aux) { auxiliary_ = aux; }
116 
117  // => High-Level Set Routines <= //
118 
120  void set_filepath(const std::string filepath) { filepath_ = filepath; }
121 
122  // => High-Level Accessor Routines <= //
123 
125  int* N() const { return N_; }
127  double* D() const { return D_; }
129  double* O() const { return O_; }
131  std::string filepath() const { return filepath_; }
132 
133  // => Low-Level Accessor Routines (Use only if you know what you are doing) <= //
134 
136  size_t npoints() const { return npoints_; }
138  size_t nxyz() const { return nxyz_; }
139 
141  double* x() const { return x_; }
143  double* y() const { return y_; }
145  double* z() const { return z_; }
147  double* w() const { return w_; }
148 
149  // => Low-Level Write Routines (Use only if you know what you are doing) <= //
150 
152  void write_gen_file(double* v, const std::string& name, const std::string& type);
154  void write_cube_file(double* v, const std::string& name);
155 
156  // => Low-Level Scalar Field Computation (Use only if you know what you are doing) <= //
157 
159  void add_density(double* v, std::shared_ptr<Matrix> D);
161  void add_esp(double* v, std::shared_ptr<Matrix> D, const std::vector<double>& nuc_weights = std::vector<double>());
163  void add_basis_functions(double** v, const std::vector<int>& indices);
165  void add_orbitals(double** v, std::shared_ptr<Matrix> C);
167  void add_LOL(double* v, std::shared_ptr<Matrix> D);
169  void add_ELF(double* v, std::shared_ptr<Matrix> D);
170 
171  // => High-Level Scalar Field Computation <= //
172 
174  void compute_density(std::shared_ptr<Matrix> D, const std::string& name, const std::string& type = "CUBE");
176  void compute_esp(std::shared_ptr<Matrix> D, const std::vector<double>& nuc_weights, const std::string& name, const std::string& type = "CUBE");
178  void compute_basis_functions(const std::vector<int>& indices, const std::string& name, const std::string& type = "CUBE");
180  void compute_orbitals(std::shared_ptr<Matrix> C, const std::vector<int>& indices, const std::vector<std::string>& labels, const std::string& name, const std::string& type = "CUBE");
182  void compute_LOL(std::shared_ptr<Matrix> D, const std::string& name, const std::string& type = "CUBE");
184  void compute_ELF(std::shared_ptr<Matrix> D, const std::string& name, const std::string& type = "CUBE");
185 
186 };
187 
188 } // End namespace
189 
190 #endif
double * y_
y coordinates of grid
Definition: csg.h:77
size_t npoints_
number of points of grid
Definition: csg.h:70
std::string filepath_
File path for grid storage.
Definition: csg.h:58
double * w() const
w weights (rectangular) in fast ordering
Definition: csg.h:147
void set_filepath(const std::string filepath)
Set the directory for cube file storage (defaults to &quot;./&quot;)
Definition: csg.h:120
int * N() const
Number of voxels in [x,y,z]. Number of points along each dimensions in N_i + 1.
Definition: csg.h:125
int * N_
Voxel quanta in x, y, z [(N_x+1) x (N_y + 1) x (N_z + 1) points].
Definition: csg.h:63
void build_grid()
Build grid with options overages.
Definition: csg.cc:102
Definition: csg.h:43
void write_gen_file(double *v, const std::string &name, const std::string &type)
Write a general file of the scalar field v (in fast ordering) to filepath/name.ext.
Definition: csg.cc:236
double * z() const
z points in fast ordering
Definition: csg.h:145
std::shared_ptr< BasisSet > auxiliary_
The auxiliary basisset for ESP contractions.
Definition: csg.h:56
std::string filepath() const
Filepath where grid output will be stored.
Definition: csg.h:131
void compute_orbitals(std::shared_ptr< Matrix > C, const std::vector< int > &indices, const std::vector< std::string > &labels, const std::string &name, const std::string &type="CUBE")
Compute a set of orbital-type properties and drop files corresponding to name, index, symmetry label, and type.
Definition: csg.cc:645
void compute_density(std::shared_ptr< Matrix > D, const std::string &name, const std::string &type="CUBE")
Compute a density-type property and drop a file corresponding to name and type.
Definition: csg.cc:617
virtual ~CubicScalarGrid()
Definition: csg.cc:68
size_t npoints() const
Total number of points in grid.
Definition: csg.h:136
void compute_ELF(std::shared_ptr< Matrix > D, const std::string &name, const std::string &type="CUBE")
Compute an ELF-type property and drop a file corresponding to name and type (TODO: this seems very un...
Definition: csg.cc:671
void add_LOL(double *v, std::shared_ptr< Matrix > D)
Add a LOL-type property to the scalar field.
Definition: csg.cc:557
void add_esp(double *v, std::shared_ptr< Matrix > D, const std::vector< double > &nuc_weights=std::vector< double >())
Add an ESP-type property to the scalar field (total density matrix, must set DF_BASIS_SCF option) ...
Definition: csg.cc:322
double * x() const
x points in fast ordering
Definition: csg.h:141
void add_basis_functions(double **v, const std::vector< int > &indices)
Add a basis function property for desired indices to the scalar fields in v (rows are basis functions...
Definition: csg.cc:512
size_t nxyz_
Sparsity blocking in all cardinal directions.
Definition: csg.h:72
std::shared_ptr< BasisSet > primary_
Basis set this grid is built around.
Definition: csg.h:54
std::vector< std::shared_ptr< BlockOPoints > > blocks_
Vector of blocks.
Definition: csg.h:86
void compute_esp(std::shared_ptr< Matrix > D, const std::vector< double > &nuc_weights, const std::string &name, const std::string &type="CUBE")
Compute an ESP-type property and drop a file corresponding to name and type.
Definition: csg.cc:625
void add_ELF(double *v, std::shared_ptr< Matrix > D)
Add an ELF-type property to the scalar field.
Definition: csg.cc:585
double * D() const
Voxel width in [x,y,z], in bohr.
Definition: csg.h:127
double * D_
Voxel spacing in x, y, z.
Definition: csg.h:65
void compute_LOL(std::shared_ptr< Matrix > D, const std::string &name, const std::string &type="CUBE")
Compute a LOL-type property and drop a file corresponding to name and type.
Definition: csg.cc:663
void write_cube_file(double *v, const std::string &name)
Write a Gaussian cube file of the scalar field v (in fast ordering) to filepath/name.cube.
Definition: csg.cc:244
size_t nxyz() const
Number of points.
Definition: csg.h:138
void add_density(double *v, std::shared_ptr< Matrix > D)
Add a density-type property to the scalar field.
Definition: csg.cc:308
void populate_grid()
Setup grid from info in N_, D_, O_.
Definition: csg.cc:151
void set_auxiliary_basis(std::shared_ptr< BasisSet > aux)
Set the auxiliary for ESP if desired.
Definition: csg.h:115
std::shared_ptr< BasisExtents > extents_
Points to basis extents, built internally.
Definition: csg.h:88
Definition: liboptions.h:359
const char * labels[]
Definition: petitelist.cc:1075
std::shared_ptr< Molecule > mol_
Molecule this grid is built around.
Definition: csg.h:52
void compute_basis_functions(const std::vector< int > &indices, const std::string &name, const std::string &type="CUBE")
Compute a set of basis function-type properties and drop files corresponding to name, index, and type.
Definition: csg.cc:633
double * O_
Voxel origin in x, y, z.
Definition: csg.h:67
Options & options_
Options object for overages and voxel spacing.
Definition: csg.h:50
void print_header()
Header info.
Definition: csg.cc:212
double * x_
x coordinates of grid
Definition: csg.h:75
double * y() const
y points in fast ordering
Definition: csg.h:143
indices
Definition: libdpd/dpd.h:245
void add_orbitals(double **v, std::shared_ptr< Matrix > C)
Add orbital property for desired indices to the scalar fields in v (rows are orbitals) ...
Definition: csg.cc:537
std::shared_ptr< RKSFunctions > points_
RKS points object.
Definition: csg.h:90
double * w_
w quadrature weights of grid (rectangular)
Definition: csg.h:81
CubicScalarGrid(std::shared_ptr< BasisSet > primary, Options &options)
Definition: csg.cc:49
double * z_
z coordinates of grid
Definition: csg.h:79
double * O() const
Lower-left corner of th grid, in bohr.
Definition: csg.h:129