MADNESS  version 0.9
mentity.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 MENTITY_H_
34 
35 #include <vector>
36 #include <string>
37 #include <iostream>
38 #include <fstream>
39 #include <sstream>
40 #include <algorithm>
41 #include <ctype.h>
42 #include <cmath>
43 #include <madness/misc/misc.h>
44 
45 struct AtomicData {
46  // !!! The order of declaration here must match the order in the initializer !!!
47 
48  // Nuclear info from L. Visscher and K.G. Dyall, Dirac-Fock
49  // atomic electronic structure calculations using different
50  // nuclear charge distributions, Atom. Data Nucl. Data Tabl., 67,
51  // (1997), 207.
52  //
53  // http://dirac.chem.sdu.dk/doc/FiniteNuclei/FiniteNuclei.shtml
54  const char* const symbol;
55  const char* const symbol_lowercase;
56  const unsigned int atomic_number;
57  const int isotope_number;
58  const double nuclear_radius;
59  const double nuclear_half_charge_radius;
60  const double nuclear_gaussian_exponent;
61 
63  const double covalent_radius;
64 };
65 
66 const AtomicData& get_atomic_data(unsigned int atn);
67 
68 unsigned int symbol_to_atomic_number(const std::string& symbol);
69 
70 
71 class Atom {
72 public:
73  double x, y, z, q;
74  unsigned int atomic_number;
75 
76  Atom(double x, double y, double z, double q, unsigned int atomic_number)
77  : x(x), y(y), z(z), q(q), atomic_number(atomic_number)
78  {}
79 
80  Atom(const Atom& a)
81  : x(a.x), y(a.y), z(a.z), q(a.q), atomic_number(a.atomic_number)
82  {}
83 
85  Atom()
86  : x(0), y(0), z(0), q(0), atomic_number(0)
87  {}
88 
89  template <typename Archive>
90  void serialize(Archive& ar) {ar & x & y & z & q & atomic_number;}
91 };
92 
93 std::ostream& operator<<(std::ostream& s, const Atom& atom);
94 
96 private:
97  // If you add more fields don't forget to serialize them
98  std::vector<Atom> atoms;
99  std::vector<double> rcut; // Reciprocal of the smoothing radius
100  std::vector<double> rsqasymptotic; // Value of r*r beyond which the potential is asymptotic 1/r
101 
102 public:
104  MolecularEntity() : atoms() {};
105 
106  MolecularEntity(const std::string& filename, bool fractional);
107 
108  void read_file(const std::string& filename, bool fractional);
109 
110  void add_atom(double x, double y, double z, int atn, double q);
111 
112  int natom() const {return atoms.size();};
113 
114  void set_atom_coords(unsigned int i, double x, double y, double z);
115 
116  double bounding_cube() const;
117 
118  const Atom& get_atom(unsigned int i) const;
119 
120  void print() const;
121 
122  double inter_atomic_distance(unsigned int i,unsigned int j) const;
123 
124  double nuclear_repulsion_energy() const;
125 
126  double smallest_length_scale() const;
127 
128  void center();
129 
130  double total_nuclear_charge() const;
131 
132  double nuclear_attraction_potential(double x, double y, double z) const;
133 
134  double nuclear_charge_density(double x, double y, double z) const;
135 
136  template <typename Archive>
137  void serialize(Archive& ar) {ar & atoms & rcut & rsqasymptotic;}
138 };
139 
140 #define MENTITY_H_
141 
142 
143 #endif /* MENTITY_H_ */
void serialize(Archive &ar)
Definition: mentity.h:137
double z
Definition: DFcode/molecule.h:56
double nuclear_repulsion_energy() const
Definition: mentity.cc:393
double inter_atomic_distance(unsigned int i, unsigned int j) const
Definition: mentity.cc:386
Header to declare stuff which has not yet found a home.
const char *const symbol_lowercase
Definition: DFcode/atomutil.h:54
::std::string string
Definition: gtest-port.h:872
double x
Definition: DFcode/molecule.h:56
void print() const
Definition: mentity.cc:374
Atom(double x, double y, double z, double q, unsigned int atomic_number)
Definition: mentity.h:76
void add_atom(double x, double y, double z, int atn, double q)
Definition: mentity.cc:355
void set_atom_coords(unsigned int i, double x, double y, double z)
Definition: mentity.cc:362
Atom()
Default construct makes a zero charge ghost atom at origin.
Definition: mentity.h:85
unsigned int symbol_to_atomic_number(const std::string &symbol)
Definition: chem/atomutil.cc:166
double q
Coordinates and charge in atomic units.
Definition: DFcode/molecule.h:56
const double covalent_radius
Covalent radii stolen without shame from NWChem.
Definition: DFcode/atomutil.h:62
double total_nuclear_charge() const
Definition: mentity.cc:444
std::ostream & operator<<(std::ostream &s, const Atom &atom)
Definition: DFcode/molecule.cc:64
Definition: mentity.h:95
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
Definition: DFcode/atomutil.h:44
Atom(const Atom &a)
Definition: mentity.h:80
void center()
Moves the center of nuclear charge to the origin.
Definition: mentity.cc:413
void read_file(const std::string &filename, bool fractional)
Definition: mentity.cc:289
const double nuclear_radius
Radius of the nucleus for the finite nucleus models (in atomic units).
Definition: DFcode/atomutil.h:57
double nuclear_attraction_potential(double x, double y, double z) const
Definition: mentity.cc:452
MolecularEntity()
Makes a MolecularEntity with zero atoms.
Definition: mentity.h:104
const Atom & get_atom(unsigned int i) const
Definition: mentity.cc:369
Abstract Atom class.
Definition: DFcode/molecule.h:54
double smallest_length_scale() const
Definition: mentity.cc:403
const unsigned int atomic_number
Definition: DFcode/atomutil.h:55
double y
Definition: DFcode/molecule.h:56
double bounding_cube() const
Returns the half width of the bounding cube.
Definition: mentity.cc:434
const double nuclear_gaussian_exponent
Exponential parameter in the Gaussian Model (in atomic units).
Definition: DFcode/atomutil.h:59
const double nuclear_half_charge_radius
Half charge radius in the Fermi Model (in atomic units).
Definition: DFcode/atomutil.h:58
const char *const symbol
Definition: DFcode/atomutil.h:53
double nuclear_charge_density(double x, double y, double z) const
Definition: mentity.cc:469
const AtomicData & get_atomic_data(unsigned int atn)
Definition: chem/atomutil.cc:160
unsigned int atomic_number
Atomic number.
Definition: DFcode/molecule.h:57
void serialize(Archive &ar)
Definition: mentity.h:90
int natom() const
Definition: mentity.h:112
const int isotope_number
Definition: DFcode/atomutil.h:56