1 /* 2 3 Copyright (C) 2007 Lucas K. Wagner 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License along 16 with this program; if not, write to the Free Software Foundation, Inc., 17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 19 */ 20 21 #ifndef CONVERTER_H_INCLUDED 22 #define CONVERTER_H_INCLUDED 23 #include <string> 24 #include <vector> 25 #include <iostream> 26 #include <cassert> 27 #include <complex> 28 #include <cstdio> 29 30 typedef double doublevar; 31 typedef std::complex <doublevar> dcomplex; 32 33 //http://www.mindcracker.com/mindcracker/c_cafe/stl/PartingSTLStrings.asp 34 void split 35 (std::string & text, std::string & separators, std::vector<std::string> & words); 36 37 38 void append_number(std::string & str, int num); 39 40 41 //Make a uniform grid out of a nonuniform one 42 void make_uniform(std::vector <double> & r, 43 std::vector <double> & vals, 44 std::vector <double> & ur, 45 std::vector <double> & uvals, 46 double spacing, 47 double cutoff=-1) ; 48 49 50 51 52 class Atom { 53 public: 54 std::vector <double> pos; 55 std::string name; 56 double charge; 57 int basis; //basis set number Atom()58 Atom() { 59 pos.push_back(0); 60 pos.push_back(0); 61 pos.push_back(0); 62 } print_atom(std::ostream & os)63 void print_atom(std::ostream & os) { 64 os.precision(10); 65 os << "ATOM { " << name << " " 66 << charge << " COOR " 67 << pos[0] << " " << pos[1] 68 << " " << pos[2] << " } " << std::endl; 69 } 70 }; 71 72 void find_unique_atoms(const std::vector<Atom> & atoms, std::vector<std::string> & unique_atoms); 73 74 class Center { 75 public: 76 std::vector <double> pos; 77 std::string name; 78 int equiv_atom; //equivalent atom 79 int basis; //basis set# Center()80 Center() { 81 for(int i=0; i< 3; i++) pos.push_back(0); 82 } print_center(std::ostream & os)83 void print_center(std::ostream & os) { 84 os << name << " "; 85 for(int i=0; i< 3; i++) os << pos[i] << " "; 86 os << std::endl; 87 } 88 }; 89 90 91 void print_orbitals(std::ostream & os, 92 std::vector <Center> & centers, 93 std::vector <int> & nbasis, 94 std::vector < std::vector < double > > & mo_coeff); 95 96 void print_orbitals(std::ostream & os, 97 std::vector <Center> & centers, 98 std::vector <int> & nbasis, 99 std::vector < std::vector < dcomplex > > & mo_coeff); 100 101 102 103 void print_centers(std::ostream & os, std::vector <Center> & centers); 104 105 void print_vmc_section(std::ostream & os, 106 std::string & outputname, double eref); 107 108 void print_opt_section(std::ostream & os, 109 std::string & outputname, double eref); 110 111 void print_dmc_section(std::ostream & os, 112 std::string & outputname, double eref); 113 114 115 double find_centers(std::vector <double> & origin, 116 std::vector <std::vector <double> > & latvec, 117 std::vector <Atom> & atoms, 118 std::vector <Center> & centers ); 119 120 121 bool compare_mo(std::vector <std::vector < double> > & oldMOCoeff, 122 std::vector <std::vector < double> > & moCoeff, 123 std::vector <int> & compare_list ); 124 125 double find_basis_cutoff(std::vector <std::vector <double> > & latvec); 126 127 const double pi=3.1415926535897932385; 128 129 130 #endif 131 132 //#ifndef uint 133 //#define uint unsigned int 134 //#endif 135 136 137 138