1 // 2 // BAGEL - Brilliantly Advanced General Electronic Structure Library 3 // Filename: grid.h 4 // Copyright (C) 2013 Toru Shiozaki 5 // 6 // Author: Toru Shiozaki <shiozaki@northwestern.edu> 7 // Maintainer: NU theory 8 // 9 // This file is part of the BAGEL package. 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 3 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 22 // along with this program. If not, see <http://www.gnu.org/licenses/>. 23 // 24 25 #ifndef __SRC_KS_GRID_H 26 #define __SRC_KS_GRID_H 27 28 #include <array> 29 #include <memory> 30 #include <src/molecule/molecule.h> 31 #include <src/util/math/xyzfile.h> 32 33 namespace bagel { 34 35 class Grid { 36 protected: 37 const std::shared_ptr<const Molecule> mol_; 38 const std::shared_ptr<const Matrix> data_; // x,y,z,weight 39 40 // basis functions and derivaties on this grid 41 std::shared_ptr<Matrix> basis_; 42 std::shared_ptr<Matrix> gradx_; 43 std::shared_ptr<Matrix> grady_; 44 std::shared_ptr<Matrix> gradz_; 45 46 public: Grid(std::shared_ptr<const Molecule> g,std::shared_ptr<const Matrix> & o)47 Grid(std::shared_ptr<const Molecule> g, std::shared_ptr<const Matrix>& o) 48 : mol_(g), data_(o) { assert(data_->ndim() == 4); } 49 basis()50 std::shared_ptr<const Matrix> basis() const { return basis_; } gradx()51 std::shared_ptr<const Matrix> gradx() const { return gradx_; } grady()52 std::shared_ptr<const Matrix> grady() const { return grady_; } gradz()53 std::shared_ptr<const Matrix> gradz() const { return gradz_; } weight(const size_t i)54 const double& weight(const size_t i) const { return data_->element(3,i); } size()55 size_t size() const { return data_->mdim(); } data()56 std::shared_ptr<const Matrix> data() const { return data_; } 57 58 std::array<std::shared_ptr<Matrix>,6> compute_grad2() const; 59 60 void init(); 61 62 }; 63 64 } 65 66 #endif 67