MADNESS  version 0.9
jacob/molecularbasis.h
Go to the documentation of this file.
1 /*
2  This file is part of MADNESS.
3 
4  Copyright (C) 2007,2010 Oak Ridge National Laboratory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20  For more information please contact:
21 
22  Robert J. Harrison
23  Oak Ridge National Laboratory
24  One Bethel Valley Road
25  P.O. Box 2008, MS-6367
26 
27  email: harrisonrj@ornl.gov
28  tel: 865-241-3937
29  fax: 865-572-0680
30 
31  $Id$
32 */
33 #ifndef MOLECULAR_BASIS_H
34 #define MOLECULAR_BASIS_H
35 
36 #include <madness/madness_config.h>
37 #include <madness/constants.h>
38 #include <moldft/molecule.h>
40 #include <madness/tensor/tensor.h>
41 using namespace madness;
42 
43 #include <vector>
44 #include <algorithm>
45 #include <iostream>
46 #include <sstream>
47 #include <iomanip>
48 #include <cstdio>
49 
52  int type;
53  std::vector<double> coeff;
54  std::vector<double> expnt;
55  double rsqmax;
56  int numbf;
57 
58  void normalize() {
59  // nwcchem cartesian normalization conventions
60  // translation of nmcoeff.F into python and thence to c++
61  int np = coeff.size();
62  if (np == 1) coeff[0] = 1.0e0;
63 
64  double pi32=pow(madness::constants::pi,1.5);
65  int l_lim = 2*type - 1;
66  double f = 1.0e00;
67  for (int n=l_lim; n>1; n-=2) f *= n;
68 
69  for (int n=0; n<np; ++n)
70  coeff[n] *= pow(2.e0*expnt[n]/madness::constants::pi,0.75e0)*pow(4.e0*expnt[n],0.5E0*type)/sqrt(f);
71 
72  double sum = 0.0;
73  for (int n1=0; n1<np; ++n1) {
74  for (int n2=0; n2<np; ++n2) {
75  double S =pi32/pow(expnt[n1]+expnt[n2],1.5e0+type)/pow(2e0,type);
76  sum = sum + coeff[n1]*coeff[n2]*S;
77  }
78  }
79  sum *= f;
80 
81  f = 1e0/sqrt(sum);
82  for (int n=0; n<np; ++n) coeff[n] *= f;
83  }
84 
85 public:
87  : type(-1), coeff(), expnt(), rsqmax(0.0), numbf(0) {};
88 
90  const std::vector<double>& coeff,
91  const std::vector<double>& expnt,
92  bool donorm=true)
93  : type(type), coeff(coeff), expnt(expnt), numbf((type+1)*(type+2)/2) {
94  if (donorm) normalize();
95  double minexpnt = expnt[0];
96  for (unsigned int i=1; i<expnt.size(); ++i)
97  minexpnt = std::min(minexpnt,expnt[i]);
98  rsqmax = 18.4/minexpnt; // 18.4 = 8*ln(10)
99  }
100 
101 
103  double rangesq() const {
104  return rsqmax;
105  }
106 
107 
109  double eval_radial(double rsq) const {
110  if (rsq > rsqmax) return 0.0;
111  double sum = 0.0;
112  for (unsigned int i=0; i<coeff.size(); ++i) {
113  double ersq = expnt[i]*rsq;
114  if (ersq < 18.4) sum += coeff[i]*exp(-ersq);
115  }
116  return sum;
117  }
118 
119 
121  double* eval(double rsq, double x, double y, double z, double* bf) const {
122  double R = eval_radial(rsq);
123  if (fabs(R) < 1e-8) {
124  for (int i=0; i<numbf; ++i) bf[i] = 0.0;
125 
126  }
127  else {
128  switch (type) {
129  case 0:
130  bf[0] = R;
131  break;
132  case 1:
133  bf[0] = R*x;
134  bf[1] = R*y;
135  bf[2] = R*z;
136  break;
137  case 2:
138  static const double fac = 1.0; //sqrt(3.0);
139  bf[0] = R*x*x;
140  bf[1] = R*x*y*fac;
141  bf[2] = R*x*z*fac;
142  bf[3] = R*y*y;
143  bf[4] = R*y*z*fac;
144  bf[5] = R*z*z;
145  break;
146  case 3:
147  bf[0] = R*x*x*x;
148  bf[1] = R*x*x*y;
149  bf[2] = R*x*x*z;
150  bf[3] = R*x*y*y;
151  bf[4] = R*x*y*z;
152  bf[5] = R*x*z*z;
153  bf[6] = R*y*y*y;
154  bf[7] = R*y*y*z;
155  bf[8] = R*y*z*z;
156  bf[9] = R*z*z*z;
157  break;
158 
159  default:
160  throw "UNKNOWN ANGULAR MOMENTUM";
161  }
162  }
163  return bf+numbf;
164  }
165 
166 
168  int angular_momentum() const {
169  return type;
170  }
171 
173  int nbf() const {
174  return numbf;
175  }
176 
178  int nprim() const {
179  return coeff.size();
180  }
181 
183  const std::vector<double>& get_coeff() const {
184  return coeff;
185  }
186 
188  const std::vector<double>& get_expnt() const {
189  return expnt;
190  }
191 
193  const char* get_desc(int ibf) const {
194  static const char* tags[4][10] = {
195  {"s" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" } ,
196  {"px" ,"py" ,"pz" ,"" ,"" ,"" ,"" ,"" ,"" ,"" } ,
197  {"dxx" ,"dxy" ,"dxz" ,"dyy" ,"dyz" ,"dzz" ,"" ,"" ,"" ,"" } ,
198  {"fxxx","fxxy","fxxz","fxyy","fxyz","fxzz","fxzz","fyyy","fyzz","fzzz"}
199  };
200  MADNESS_ASSERT(ibf<numbf && ibf >= 0);
201  return tags[type][ibf];
202  }
203 
204  template <typename Archive>
205  void serialize(Archive& ar) {
206  ar & type & coeff & expnt & rsqmax & numbf;
207  }
208 };
209 
211 class AtomicBasis {
212  std::vector<ContractedGaussianShell> g;
213  double rmaxsq;
214  int numbf;
215  Tensor<double> dmat, avec, bvec;
216 
217 public:
218  AtomicBasis() : g(), rmaxsq(0.0), numbf(0) {};
219 
220  AtomicBasis(const std::vector<ContractedGaussianShell>& g)
221  : g(g) {
222  rmaxsq = 0.0;
223  numbf = 0;
224  for (unsigned int i=0; i<g.size(); ++i) {
225  rmaxsq = std::max(rmaxsq, g[i].rangesq());
226  numbf += g[i].nbf();
227  }
228  }
229 
230  void set_guess_info(const Tensor<double>& dmat,
231  const Tensor<double>& avec, const Tensor<double>& bvec) {
232  this->dmat = copy(dmat);
233  this->avec = copy(avec);
234  this->bvec = copy(bvec);
235  }
236 
238  int nbf() const {
239  return numbf;
240  }
241 
243  int nshell() const {
244  return g.size();
245  }
246 
248  const std::vector<ContractedGaussianShell>& get_shells() const {
249  return g;
250  };
251 
253 
257  double* eval(double x, double y, double z, double* bf) const {
258  double rsq = x*x + y*y + z*z;
259  if (rsq > rmaxsq) {
260  for (int i=0; i<numbf; ++i) bf[i] = 0.0;
261  return bf+numbf;
262  }
263 
264  double* bfstart = bf;
265  for (unsigned int i=0; i<g.size(); ++i) {
266  bf = g[i].eval(rsq, x, y, z, bf);
267  }
268  // paranoia is good
269  MADNESS_ASSERT(bf-bfstart == numbf);
270  return bf;
271  }
272 
274  double eval_guess_density(double x, double y, double z) const {
275  MADNESS_ASSERT(has_guess_info());
276  double rsq = x*x + y*y + z*z;
277  if (rsq > rmaxsq) return 0.0;
278 
279  double bf[numbf];
280  eval(x, y, z, bf);
281  const double* p = dmat.ptr();
282  double sum = 0.0;
283  for (int i=0; i<numbf; ++i, p+=numbf) {
284  double sumj = 0.0;
285  for (int j=0; j<numbf; ++j)
286  sumj += p[j]*bf[j];
287  sum += bf[i]*sumj;
288  }
289  return sum;
290  }
291 
293  const ContractedGaussianShell& get_shell_from_basis_function(int ibf, int& ibf_in_shell) const {
294  int n=0;
295  for (unsigned int i=0; i<g.size(); ++i) {
296  int nbf_in_shell = g[i].nbf();
297  if (ibf>=n && ibf<(n+nbf_in_shell)) {
298  ibf_in_shell = ibf-n;
299  return g[i];
300  }
301  else {
302  n += g[i].nbf();
303  }
304  }
305  MADNESS_EXCEPTION("AtomicBasis: get_shell_from_basis_function", ibf*100000 + nbf());
306  }
307 
308  bool has_guess_info() const {
309  return dmat.size()>0;
310  }
311 
312  const Tensor<double>& get_dmat() const {
313  return dmat;
314  };
315 
316  const Tensor<double>& get_avec() const {
317  return avec;
318  };
319 
320  const Tensor<double>& get_bvec() const {
321  return bvec;
322  };
323 
324  template <typename Archive>
325  void serialize(Archive& ar) {
326  ar & g & rmaxsq & numbf & dmat & avec & bvec;
327  }
328 
329 };
330 
332 class AtomicBasisFunction {
333 private:
334  const double xx, yy, zz; // Coordinates of the center
335  const ContractedGaussianShell& shell; // Reference to the underlying atomic shell
336  const int ibf; // Index of basis function in the shell (0, 1, ...)
337  const int nbf; // Number of functions in the shell
338 
339 public:
340  AtomicBasisFunction(double x, double y, double z,
341  const ContractedGaussianShell& shell, int ibf)
342  : xx(x), yy(y), zz(z), shell(shell), ibf(ibf), nbf(shell.nbf()) {}
343 
344 
346  : xx(aofunc.xx)
347  , yy(aofunc.yy)
348  , zz(aofunc.zz)
349  , shell(aofunc.shell)
350  , ibf(aofunc.ibf)
351  , nbf(aofunc.nbf) {}
352 
353  double operator()(double x, double y, double z) const {
354  double bf[nbf];
355  x-=xx;
356  y-=yy;
357  z-=zz;
358  double rsq = x*x + y*y + z*z;
359  shell.eval(rsq, x, y, z, bf);
360  return bf[ibf];
361  }
362 
363  void print_me(std::ostream& s) const;
364 
366  return shell;
367  }
368 
369  int get_index() const {
370  return ibf;
371  }
372 
373  const char* get_desc() const {
374  return shell.get_desc(ibf);
375  }
376 
377  void get_coords(double& x, double& y, double& z) const {
378  x=xx; y=yy; z=zz;
379  return;
380  }
381 };
382 
384 class AtomicBasisSet {
385  std::string name;
386  std::vector<AtomicBasis> ag; //< Basis associated by atomic number = 1, 2, ...; 0=Bq.
387 
388  template <typename T>
389  std::vector<T> load_tixml_vector(TiXmlElement* node, int n, const char* name) {
390  TiXmlElement* child = node->FirstChildElement(name);
391  MADNESS_ASSERT(child);
392  std::istringstream s(child->GetText());
393  std::vector<T> r(n);
394  for (int i=0; i<n; ++i) {
395  MADNESS_ASSERT(s >> r[i]);
396  }
397  return r;
398  }
399 
400  template <typename T>
401  Tensor<T> load_tixml_matrix(TiXmlElement* node, int n, int m, const char* name) {
402  TiXmlElement* child = node->FirstChildElement(name);
403  MADNESS_ASSERT(child);
404  std::istringstream s(child->GetText());
405  Tensor<T> r(n,m);
406  for (int i=0; i<n; ++i) {
407  for (int j=0; j<m; ++j) {
408  MADNESS_ASSERT(s >> r(i,j));
409  }
410  }
411  return r;
412  }
413 
414 public:
415  AtomicBasisSet() : name("unknown"), ag(110) {}
416 
417 
418  AtomicBasisSet(std::string filename) : name(""), ag(110) {
419  read_file(filename);
420  }
421 
422  void read_file(std::string filename) {
423  static const bool debug = false;
424  TiXmlDocument doc(filename);
425  if (!doc.LoadFile()) {
426  std::cout << "AtomicBasisSet: Failed loading from file " << filename
427  << " : ErrorDesc " << doc.ErrorDesc()
428  << " : Row " << doc.ErrorRow()
429  << " : Col " << doc.ErrorCol() << std::endl;
430  MADNESS_EXCEPTION("AtomicBasisSet: Failed loading basis set",0);
431  }
432  for (TiXmlElement* node=doc.FirstChildElement(); node; node=node->NextSiblingElement()) {
433  if (strcmp(node->Value(),"name") == 0) {
434  name = node->GetText();
435  if (debug) std::cout << "Loading basis set " << name << std::endl;
436  }
437  else if (strcmp(node->Value(), "basis") == 0) {
438  const char* symbol = node->Attribute("symbol");
439  if (debug) std::cout << " found basis set for " << symbol << std::endl;
440  int atn = symbol_to_atomic_number(symbol);
441  std::vector<ContractedGaussianShell> g;
442  for (TiXmlElement* shell=node->FirstChildElement(); shell; shell=shell->NextSiblingElement()) {
443  const char* type = shell->Attribute("type");
444  int nprim=-1;
445  shell->Attribute("nprim",&nprim);
446  if (debug) std::cout << " found shell " << type << " " << nprim << std::endl;
447  std::vector<double> expnt = load_tixml_vector<double>(shell, nprim, "exponents");
448  if (strcmp(type,"L") == 0) {
449  std::vector<double> scoeff = load_tixml_vector<double>(shell, nprim, "scoefficients");
450  std::vector<double> pcoeff = load_tixml_vector<double>(shell, nprim, "pcoefficients");
451  g.push_back(ContractedGaussianShell(0,scoeff,expnt));
452  g.push_back(ContractedGaussianShell(1,pcoeff,expnt));
453  }
454  else {
455  static const char* tag[] = {"S","P","D","F","G"};
456  int i;
457  for (i=0; i<5; ++i) {
458  if (strcmp(type,tag[i]) == 0) goto foundit;
459  }
460  MADNESS_EXCEPTION("Loading atomic basis set: bad shell type?",0);
461 foundit:
462  std::vector<double> coeff = load_tixml_vector<double>(shell, nprim, "coefficients");
463  g.push_back(ContractedGaussianShell(i, coeff, expnt));
464  }
465  }
466  ag[atn] = AtomicBasis(g);
467  }
468  else if (strcmp(node->Value(), "atomicguess") == 0) {
469  const char* symbol = node->Attribute("symbol");
470  if (debug) std::cout << " atomic guess info for " << symbol << std::endl;
471  int atn = symbol_to_atomic_number(symbol);
472  MADNESS_ASSERT(is_supported(atn));
473  int nbf = ag[atn].nbf();
474  Tensor<double> dmat = load_tixml_matrix<double>(node, nbf, nbf, "guessdensitymatrix");
475  Tensor<double> avec = load_tixml_matrix<double>(node, nbf, nbf, "alphavectors");
476  Tensor<double> bvec = load_tixml_matrix<double>(node, nbf, nbf, "betavectors");
477  ag[atn].set_guess_info(dmat, avec, bvec);
478  }
479  else {
480  MADNESS_EXCEPTION("Loading atomic basis set: unexpected XML element", 0);
481  }
482  }
483 
484  }
485 
486 
488  void atoms_to_bfn(const Molecule& molecule, std::vector<int>& at_to_bf, std::vector<int>& at_nbf) {
489  at_to_bf = std::vector<int>(molecule.natom());
490  at_nbf = std::vector<int>(molecule.natom());
491 
492  int n = 0;
493  for (int i=0; i<molecule.natom(); ++i) {
494  const Atom& atom = molecule.get_atom(i);
495  const int atn = atom.atomic_number;
496  MADNESS_ASSERT(is_supported(atn));
497  at_to_bf[i] = n;
498  at_nbf[i] = ag[atn].nbf();
499  n += at_nbf[i];
500  }
501  }
502 
503 
505  int basisfn_to_atom(const Molecule& molecule, int ibf) const {
506  MADNESS_ASSERT(ibf >= 0);
507  int n = 0;
508  for (int i=0; i<molecule.natom(); ++i) {
509  // Is the desired function on this atom?
510  const Atom& atom = molecule.get_atom(i);
511  const int atn = atom.atomic_number;
512  MADNESS_ASSERT(is_supported(atn));
513  const int nbf_on_atom = ag[atn].nbf();
514  if (ibf >= n && (n+nbf_on_atom) > ibf) {
515  return i;
516  }
517  else {
518  n += nbf_on_atom;
519  }
520  }
521  MADNESS_EXCEPTION("AtomicBasisSet: get_atomic_basis_function: confused?", ibf);
522  }
523 
525  AtomicBasisFunction get_atomic_basis_function(const Molecule& molecule, int ibf) const {
526  MADNESS_ASSERT(ibf >= 0);
527  int n = 0;
528  for (int i=0; i<molecule.natom(); ++i) {
529  // Is the desired function on this atom?
530  const Atom& atom = molecule.get_atom(i);
531  const int atn = atom.atomic_number;
532  MADNESS_ASSERT(is_supported(atn));
533  const int nbf_on_atom = ag[atn].nbf();
534  if (ibf >= n && (n+nbf_on_atom) > ibf) {
535  int index;
536  const ContractedGaussianShell& shell =
537  ag[atn].get_shell_from_basis_function(ibf-n, index);
538  return AtomicBasisFunction(atom.x, atom.y, atom.z, shell, index);
539  }
540  else {
541  n += nbf_on_atom;
542  }
543  }
544  MADNESS_EXCEPTION("AtomicBasisSet: get_atomic_basis_function: confused?", ibf);
545  }
546 
547 
549  int nbf(const Molecule& molecule) const {
550  int n = 0;
551  for (int i=0; i<molecule.natom(); ++i) {
552  const Atom& atom = molecule.get_atom(i);
553  const int atn = atom.atomic_number;
554  MADNESS_ASSERT(is_supported(atn));
555  n += ag[atn].nbf();
556  }
557  return n;
558  }
559 
561  void eval(const Molecule& molecule, double x, double y, double z, double *bf) const {
562  for (int i=0; i<molecule.natom(); ++i) {
563  const Atom& atom = molecule.get_atom(i);
564  const int atn = atom.atomic_number;
565  bf = ag[atn].eval(x-atom.x, y-atom.y, z-atom.z, bf);
566  }
567  }
568 
569 
571  double eval_guess_density(const Molecule& molecule, double x, double y, double z) const {
572  double sum = 0.0;
573  for (int i=0; i<molecule.natom(); ++i) {
574  const Atom& atom = molecule.get_atom(i);
575  const int atn = atom.atomic_number;
576  sum += ag[atn].eval_guess_density(x-atom.x, y-atom.y, z-atom.z);
577  }
578  return sum;
579  }
580 
581  bool is_supported(int atomic_number) const {
582  return ag[atomic_number].nbf() > 0;
583  }
584 
586  void print(const Molecule& molecule) const;
587 
588  template <typename T>
589  class AnalysisSorter {
590  const Tensor<T> v;
591  public:
592  AnalysisSorter(const Tensor<T>& v) : v(v) {}
593  bool operator()(long i, long j) const {
594  return std::abs(v[i]) > std::abs(v[j]);
595  }
596  };
597 
599 
606  template <typename T>
607  void print_anal(const Molecule& molecule, const Tensor<T>& v) {
608  const double thresh = 0.2*v.normf();
609  if (thresh == 0.0) {
610  printf(" zero vector\n");
611  return;
612  }
613  long nbf = int(v.dim(0));
614  long list[nbf];
615  long ngot=0;
616  for (long i=0; i<nbf; ++i) {
617  if (std::abs(v(i)) > thresh) {
618  list[ngot++] = i;
619  }
620  }
621  std::sort(list,list+ngot,AnalysisSorter<T>(v));
622 
623  const char* format;
624  if (molecule.natom() < 10) {
625  format = " %2s(%1d)%4s(%2ld)%6.3f ";
626  }
627  else if (molecule.natom() < 100) {
628  format = " %2s(%2d)%4s(%3ld)%6.3f ";
629  }
630  else if (molecule.natom() < 1000) {
631  format = " %2s(%3d)%4s(%4ld)%6.3f ";
632  }
633  else {
634  format = " %2s(%4d)%4s(%5ld)%6.3f ";
635  }
636  printf(" ");
637  for (long ii=0; ii<ngot; ++ii) {
638  long ibf = list[ii];
639 
640  const int iat = basisfn_to_atom(molecule, ibf);
641  const Atom& atom = molecule.get_atom(iat);
642  const AtomicBasisFunction ao = get_atomic_basis_function(molecule, ibf);
643  const char* desc = ao.get_desc();
644  const char* element = get_atomic_data(atom.atomic_number).symbol;
645 
646  // This will need wrapping in a template for a complex MO vector
647  printf(format, element, iat, desc, ibf, v[ibf]);
648  }
649  printf("\n");
650  }
651 
653  void print_all() const;
654 
655  template <typename Archive>
656  void serialize(Archive& ar) {
657  ar & name & ag;
658  }
659 };
660 
661 
662 
663 #endif
int np
Definition: tdse1d.cc:166
int nbf() const
Returns the number of basis functions on the center.
Definition: jacob/molecularbasis.h:238
double eval_radial(double rsq) const
Evaluates the radial part of the contracted function.
Definition: jacob/molecularbasis.h:109
const double thresh
Definition: dielectric.cc:185
void print_anal(const Molecule &molecule, const Tensor< T > &v)
Given a vector of AO coefficients prints an analysis.
Definition: jacob/molecularbasis.h:607
const Tensor< double > & get_dmat() const
Definition: jacob/molecularbasis.h:312
NDIM const Function< R, NDIM > & g
Definition: mra.h:2179
bool is_supported(int atomic_number) const
Definition: jacob/molecularbasis.h:581
const mpreal exp(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2234
const double pi
Mathematical constant pi.
Definition: constants.h:44
int angular_momentum() const
Returns the shell angular momentum.
Definition: jacob/molecularbasis.h:168
const double R
Definition: dielectric.cc:191
void atoms_to_bfn(const Molecule &molecule, std::vector< int > &at_to_bf, std::vector< int > &at_nbf)
Makes map from atoms to first basis function on atom and number of basis functions on atom...
Definition: jacob/molecularbasis.h:488
double eval_guess_density(const Molecule &molecule, double x, double y, double z) const
Evaluates the guess density.
Definition: jacob/molecularbasis.h:571
void serialize(Archive &ar)
Definition: jacob/molecularbasis.h:205
double rangesq() const
Returns square of the distance beyond which function is less than 1e-8.
Definition: jacob/molecularbasis.h:103
double operator()(double x, double y, double z) const
Definition: jacob/molecularbasis.h:353
ContractedGaussianShell()
Definition: jacob/molecularbasis.h:86
const mpreal pow(const mpreal &a, const unsigned int b, mp_rnd_t rnd_mode=mpreal::default_rnd)
Definition: mpreal.h:2788
void serialize(Archive &ar)
Definition: jacob/molecularbasis.h:656
double eval_guess_density(double x, double y, double z) const
Evaluates the guess atomic density at point x, y, z relative to atomic center.
Definition: jacob/molecularbasis.h:274
const bool debug
Definition: tdse1.cc:45
const ContractedGaussianShell & get_shell_from_basis_function(int ibf, int &ibf_in_shell) const
Return shell that contains basis function ibf and also return index of function in the shell...
Definition: jacob/molecularbasis.h:293
const char *const symbol
Definition: chem/atomutil.h:54
double z
Definition: chem/molecule.h:57
::std::string string
Definition: gtest-port.h:872
Defines common mathematical and physical constants.
void print_me(std::ostream &s) const
Definition: chem/molecularbasis.cc:73
double eval_radial(double rsq) const
Evaluates the radial part of the contracted function.
Definition: chem/molecularbasis.h:110
int nprim() const
Returns the number of primitives in the contraction.
Definition: jacob/molecularbasis.h:178
int nbf(const Molecule &molecule) const
Given a molecule count the number of basis functions.
Definition: jacob/molecularbasis.h:549
NDIM & f
Definition: mra.h:2179
bool operator()(long i, long j) const
Definition: jacob/molecularbasis.h:593
int nbf() const
Returns the number of basis functions in the shell.
Definition: jacob/molecularbasis.h:173
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml.cc:924
AtomicBasisFunction get_atomic_basis_function(const Molecule &molecule, int ibf) const
Returns the ibf'th atomic basis function.
Definition: chem/molecularbasis.h:474
AtomicBasis(const std::vector< ContractedGaussianShell > &g)
Definition: jacob/molecularbasis.h:220
int ErrorCol() const
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1475
AtomicBasis()
Definition: jacob/molecularbasis.h:218
Represents multiple shells of contracted gaussians on a single center.
Definition: chem/molecularbasis.h:214
void eval(const Molecule &molecule, double x, double y, double z, double *bf) const
Evaluates the basis functions.
Definition: jacob/molecularbasis.h:561
const char * get_desc(int ibf) const
Returns a string description of the basis function type.
Definition: jacob/molecularbasis.h:193
Defines and implements most of Tensor.
int natom() const
Definition: chem/molecule.h:148
Represents a single shell of contracted, Cartesian, Gaussian primitives.
Definition: chem/molecularbasis.h:52
int ErrorRow() const
Definition: tinyxml.h:1474
const AtomicData & get_atomic_data(unsigned int atomic_number)
Definition: chem/atomutil.cc:160
int nbf(const Molecule &molecule) const
Given a molecule count the number of basis functions.
Definition: chem/molecularbasis.h:498
double * eval(double rsq, double x, double y, double z, double *bf) const
Evaluates the entire shell returning the incremented result pointer.
Definition: jacob/molecularbasis.h:121
#define max(a, b)
Definition: lda.h:53
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1460
void set_guess_info(const Tensor< double > &dmat, const Tensor< double > &avec, const Tensor< double > &bvec)
Definition: jacob/molecularbasis.h:230
double * eval(double x, double y, double z, double *bf) const
Evaluates the basis functions at point x, y, z relative to atomic center.
Definition: jacob/molecularbasis.h:257
int get_index() const
Definition: jacob/molecularbasis.h:369
const std::vector< double > & get_expnt() const
Returns a const reference to the exponents.
Definition: jacob/molecularbasis.h:188
const std::vector< double > & get_coeff() const
Returns a const reference to the coefficients.
Definition: jacob/molecularbasis.h:183
const char * get_desc(int ibf) const
Returns a string description of the basis function type.
Definition: chem/molecularbasis.h:196
Used to represent one basis function from a shell on a specific center.
Definition: chem/molecularbasis.h:335
void read_file(std::string filename)
read the atomic basis set from file
Definition: chem/molecularbasis.cc:107
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence. ...
Definition: mra.h:1835
const mpreal min(const mpreal &x, const mpreal &y)
Definition: mpreal.h:2675
Definition: tinyxml.h:1386
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition: tinyxml.cc:431
AtomicBasisSet()
Definition: jacob/molecularbasis.h:415
unsigned int atomic_number
Atomic number.
Definition: chem/molecule.h:58
const char * get_desc() const
Definition: chem/molecularbasis.h:376
void get_coords(double &x, double &y, double &z) const
Definition: jacob/molecularbasis.h:377
const Tensor< double > & get_bvec() const
Definition: jacob/molecularbasis.h:320
int basisfn_to_atom(const Molecule &molecule, int ibf) const
Returns the number of the atom the ibf'th basis function is on.
Definition: chem/molecularbasis.h:454
bool is_supported(int atomic_number) const
Definition: chem/molecularbasis.h:530
const char * get_desc() const
Definition: jacob/molecularbasis.h:373
AtomicBasisFunction(double x, double y, double z, const ContractedGaussianShell &shell, int ibf)
Definition: jacob/molecularbasis.h:340
tensorT sqrt(const tensorT &s, double tol=1e-8)
Computes matrix square root (not used any more?)
Definition: DFcode/moldft.cc:446
bool has_guess_info() const
Definition: chem/molecularbasis.h:311
void read_file(std::string filename)
Definition: jacob/molecularbasis.h:422
const std::vector< ContractedGaussianShell > & get_shells() const
Returns a const reference to the shells.
Definition: jacob/molecularbasis.h:248
double x
Definition: chem/molecule.h:57
Definition: chem/molecule.h:55
const TiXmlElement * NextSiblingElement() const
Definition: tinyxml.cc:461
double * eval(double rsq, double x, double y, double z, double *bf) const
Evaluates the entire shell returning the incremented result pointer.
Definition: chem/molecularbasis.h:122
double y
Definition: chem/molecule.h:57
const mpreal sum(const mpreal tab[], unsigned long int n, mp_rnd_t rnd_mode)
Definition: mpreal.cc:241
AtomicBasisFunction(const AtomicBasisFunction &aofunc)
Definition: jacob/molecularbasis.h:345
const double m
Definition: gfit.cc:199
unsigned int symbol_to_atomic_number(const std::string &symbol)
Definition: chem/atomutil.cc:166
AtomicBasisFunction get_atomic_basis_function(const Molecule &molecule, int ibf) const
Returns the ibf'th atomic basis function.
Definition: jacob/molecularbasis.h:525
Definition: chem/molecule.h:83
Definition: DFcode/molecularbasis.h:597
const Tensor< double > & get_avec() const
Definition: jacob/molecularbasis.h:316
const char * Value() const
Definition: tinyxml.h:489
int nbf() const
Returns the number of basis functions on the center.
Definition: chem/molecularbasis.h:241
void serialize(Archive &ar)
Definition: jacob/molecularbasis.h:325
AnalysisSorter(const Tensor< T > &v)
Definition: jacob/molecularbasis.h:592
void print_all() const
Print basis info for all supported atoms.
Definition: chem/molecularbasis.cc:97
Contracted Gaussian basis.
Definition: chem/molecularbasis.h:391
double E0(double p)
Definition: gfit.cc:203
#define MADNESS_EXCEPTION(msg, value)
Definition: worldexc.h:88
int nshell() const
Returns the number of shells on the center.
Definition: jacob/molecularbasis.h:243
const char * GetText() const
Definition: tinyxml.cc:871
const mpreal fabs(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2187
AtomicBasisSet(std::string filename)
Definition: jacob/molecularbasis.h:418
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
const char * Attribute(const char *name) const
Definition: tinyxml.cc:555
const ContractedGaussianShell & get_shell() const
Definition: jacob/molecularbasis.h:365
void print(const Molecule &molecule) const
Print basis info for atoms in the molecule (once for each unique atom type)
Definition: chem/molecularbasis.cc:78
double * eval(double x, double y, double z, double *bf) const
Evaluates the basis functions at point x, y, z relative to atomic center.
Definition: chem/molecularbasis.h:260
const Atom & get_atom(unsigned int i) const
Definition: chem/molecule.cc:223
bool has_guess_info() const
Definition: jacob/molecularbasis.h:308
ContractedGaussianShell(int type, const std::vector< double > &coeff, const std::vector< double > &expnt, bool donorm=true)
Definition: jacob/molecularbasis.h:89
Definition: tinyxml.h:945
int basisfn_to_atom(const Molecule &molecule, int ibf) const
Returns the number of the atom the ibf'th basis function is on.
Definition: jacob/molecularbasis.h:505
int nbf() const
Returns the number of basis functions in the shell.
Definition: chem/molecularbasis.h:176