MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
grid.h
1//
2// grid.h
3//
4// Copyright (C) 2006 Toon Verstraelen.
5//
6// Author: Toon Verstraelen
7//
8// This file is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 2, or (at your option)
11// any later version.
12//
13// This file is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with the MPQC; see the file COPYING. If not, write to
20// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21//
22
23#ifndef _util_misc_grid_h
24#define _util_misc_grid_h
25
26#include <chemistry/molecule/molecule.h>
27#include <util/class/class.h>
28#include <util/misc/runnable.h>
29#include <util/misc/units.h>
30
31namespace sc {
32
35class Grid: public DescribedClass {
36 public:
37 int numx;
38 int numy;
39 int numz;
40 SCVector3 origin;
41 SCVector3 axisx;
42 SCVector3 axisy;
43 SCVector3 axisz;
44 Ref<Units> unit;
73 Grid(const Ref<KeyVal> &);
74 Grid(int numx = 1, int numy = 1, int numz = 1,
75 SCVector3 origin = SCVector3(0.0, 0.0, 0.0),
76 SCVector3 axisx = SCVector3(1.0, 0.0, 0.0),
77 SCVector3 axisy = SCVector3(0.0, 1.0, 0.0),
78 SCVector3 axisz = SCVector3(0.0, 0.0, 1.0),
79 Ref<Units> unit = new Units("bohr")
80 );
81};
82
85class WriteGrid: public Runnable {
86 private:
87 void wf_mpqc(std::ostream &out);
88 void wf_gaussian_cube(std::ostream &out);
89 void wf_vtk2(std::ostream &out);
90 void wf_mpqc_raw(std::ostream &out);
91 protected:
92 std::string filename_;
93 Ref<Grid> grid_;
94 std::string format_;
95 void (WriteGrid::*write_format_)(std::ostream &out);
98 virtual void initialize() = 0;
103 virtual void label(char* buffer) = 0;
107 virtual double calculate_value(SCVector3 point) = 0;
108 public:
134 void run();
135};
136
142#ifdef MPQC_NEW_FEATURES
143, virtual public DescribedXMLWritable
144#endif // MPQC_NEW_FEATURES
145{
146 public:
147 // see wf_gaussian_cube
149 virtual int operator()(int d) const {
150 return d;
151 }
152 };
153
154 private:
160 void wf_gaussian_cube(std::ostream &out, const DimensionMap& dmap);
161 protected:
162 std::string filename_;
163 Ref<Grid> grid_;
164 std::string format_;
165 void (WriteVectorGrid::*write_format_)(std::ostream &out, const DimensionMap& dmap);
166
169 virtual void initialize() = 0;
174 virtual void label(char* buffer) = 0;
178 virtual void calculate_values(const std::vector<SCVector3>& Points, std::vector<double>& Vals)=0;
180 virtual std::size_t ndim() const =0;
182 virtual const DimensionMap& dimension_map() const =0;
183 public:
203 WriteVectorGrid(const Ref<sc::Grid> & grid,
204 std::string gridformat, std::string gridfile);
206 void run();
207
208#ifdef MPQC_NEW_FEATURES
209 virtual boost::property_tree::ptree& write_xml(boost::property_tree::ptree& parent, const XMLWriter& writer);
210#endif
211};
212
213}
214
215#endif
216
217// Local Variables:
218// mode: c++
219// c-file-style: "CLJ"
220// End:
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition class.h:233
Definition xml.h:50
The Grid class defines a finite regular Carthesian grid.
Definition grid.h:35
Grid(const Ref< KeyVal > &)
The KeyVal constructor.
A template class that maintains references counts.
Definition ref.h:361
The Runnable class is a DescribedClass with a pure virtual run member.
Definition runnable.h:36
a 3-element version of SCVector
Definition vector3.h:44
The Units class is used to perform unit conversions.
Definition units.h:38
The abstract WriteGrid class provides an interface for writing the value of a scalar function evaluat...
Definition grid.h:85
WriteGrid(const Ref< KeyVal > &)
The KeyVal constructor.
virtual Ref< Molecule > get_molecule()=0
Returns the molecule around which the grid values are calculated.
virtual double calculate_value(SCVector3 point)=0
Returns the value of the scalar function at the given coordinate.
virtual void initialize()=0
Prepares some pre-caculated values before the repetitive grid calculations are perfomed.
void run()
Writes the grid data.
virtual void label(char *buffer)=0
A label that identifies the scalar function evaluated at the grid points, is written to the buffer ar...
WriteVectorGrid provides an interface for writing the value of a vector function evaluated at a given...
Definition grid.h:145
virtual void initialize()=0
Prepares some pre-calculated values before the repetitive grid calculations are perfomed.
void run()
Writes the grid data.
WriteVectorGrid(const Ref< KeyVal > &)
The KeyVal constructor.
virtual void calculate_values(const std::vector< SCVector3 > &Points, std::vector< double > &Vals)=0
Returns the value of the vector function at the given coordinate.
virtual void label(char *buffer)=0
A label that identifies the scalar function evaluated at the grid points, is written to the buffer ar...
virtual Ref< Molecule > get_molecule()=0
Returns the molecule around which the grid values are calculated.
virtual const DimensionMap & dimension_map() const =0
dimension map
virtual std::size_t ndim() const =0
number of dimensions of the vector
Definition xmlwriter.h:223
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:30 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.