MADNESS 0.10.1
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
45struct 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; ///< Radius of the nucleus for the finite nucleus models (in atomic units).
59 const double nuclear_half_charge_radius; ///< Half charge radius in the Fermi Model (in atomic units).
60 const double nuclear_gaussian_exponent; ///< Exponential parameter in the Gaussian Model (in atomic units).
61
62 /// Covalent radii stolen without shame from NWChem
63 const double covalent_radius;
64};
65
66const AtomicData& get_atomic_data(unsigned int atn);
67
68unsigned int symbol_to_atomic_number(const std::string& symbol);
69
70
71class Atom {
72public:
73 double x, y, z, q; ///< Coordinates and charge in atomic units
74 unsigned int atomic_number; ///< 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
84 /// Default construct makes a zero charge ghost atom at origin
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
93std::ostream& operator<<(std::ostream& s, const Atom& atom);
94
96private:
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
102public:
103 /// Makes a MolecularEntity with zero 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_ */
double q(double t)
Definition DKops.h:18
Definition mentity.h:71
Atom(double x, double y, double z, double q, unsigned int atomic_number)
Definition mentity.h:76
double x
Definition mentity.h:73
void serialize(Archive &ar)
Definition mentity.h:90
unsigned int atomic_number
Atomic number.
Definition mentity.h:74
double q
Coordinates and charge in atomic units.
Definition mentity.h:73
Atom()
Default construct makes a zero charge ghost atom at origin.
Definition mentity.h:85
double y
Definition mentity.h:73
Atom(const Atom &a)
Definition mentity.h:80
double z
Definition mentity.h:73
Definition mentity.h:95
double nuclear_attraction_potential(double x, double y, double z) const
Definition mentity.cc:452
void print() const
Definition mentity.cc:374
void read_file(const std::string &filename, bool fractional)
Definition mentity.cc:289
std::vector< double > rsqasymptotic
Definition mentity.h:100
void add_atom(double x, double y, double z, int atn, double q)
Definition mentity.cc:355
int natom() const
Definition mentity.h:112
double total_nuclear_charge() const
Definition mentity.cc:444
double inter_atomic_distance(unsigned int i, unsigned int j) const
Definition mentity.cc:386
double bounding_cube() const
Returns the half width of the bounding cube.
Definition mentity.cc:434
void center()
Moves the center of nuclear charge to the origin.
Definition mentity.cc:413
double smallest_length_scale() const
Definition mentity.cc:403
const Atom & get_atom(unsigned int i) const
Definition mentity.cc:369
double nuclear_charge_density(double x, double y, double z) const
Definition mentity.cc:469
void serialize(Archive &ar)
Definition mentity.h:137
void set_atom_coords(unsigned int i, double x, double y, double z)
Definition mentity.cc:362
double nuclear_repulsion_energy() const
Definition mentity.cc:393
MolecularEntity()
Makes a MolecularEntity with zero atoms.
Definition mentity.h:104
std::vector< double > rcut
Definition mentity.h:99
std::vector< Atom > atoms
Definition mentity.h:98
std::ostream & operator<<(std::ostream &s, const Atom &atom)
Definition mentity.cc:264
unsigned int symbol_to_atomic_number(const std::string &symbol)
Definition mentity.cc:181
const AtomicData & get_atomic_data(unsigned int atn)
Definition mentity.cc:175
Header to declare stuff which has not yet found a home.
static const double a
Definition nonlinschro.cc:118
Definition mentity.h:45
const double covalent_radius
Covalent radii stolen without shame from NWChem.
Definition mentity.h:63
const double nuclear_radius
Radius of the nucleus for the finite nucleus models (in atomic units).
Definition mentity.h:58
const unsigned int atomic_number
Definition mentity.h:56
const double nuclear_half_charge_radius
Half charge radius in the Fermi Model (in atomic units).
Definition mentity.h:59
const char *const symbol_lowercase
Definition mentity.h:55
const char *const symbol
Definition mentity.h:54
const int isotope_number
Definition mentity.h:57
const double nuclear_gaussian_exponent
Exponential parameter in the Gaussian Model (in atomic units).
Definition mentity.h:60