00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _chemistry_molecule_atominfo_h
00029 #define _chemistry_molecule_atominfo_h
00030
00031 #include <string>
00032 #include <map>
00033 #include <vector>
00034
00035 #include <util/class/class.h>
00036 #include <util/keyval/keyval.h>
00037
00038 namespace sc {
00039
00040 class Units;
00041
00045 class AtomInfo: public SavableState {
00046 private:
00047 enum { Nelement = 118, DefaultZ = 0 };
00048
00049 struct atom
00050 {
00051 int Z;
00052 char *name;
00053 char *symbol;
00054 };
00055
00056 static struct atom elements_[Nelement];
00057
00058 std::map<std::string,int> name_to_Z_;
00059 std::map<std::string,int> symbol_to_Z_;
00060 std::map<int,std::string> Z_to_names_;
00061 std::map<int,std::string> Z_to_symbols_;
00062 std::map<int,double> Z_to_mass_;
00063 std::map<int,double> Z_to_atomic_radius_;
00064 std::map<int,double> Z_to_vdw_radius_;
00065 std::map<int,double> Z_to_bragg_radius_;
00066 std::map<int,double> Z_to_maxprob_radius_;
00067 std::map<int,std::vector<double> > Z_to_rgb_;
00068 std::map<int,double> Z_to_ip_;
00069 double atomic_radius_scale_;
00070 double vdw_radius_scale_;
00071 double bragg_radius_scale_;
00072 double maxprob_radius_scale_;
00073
00074 char *overridden_values_;
00075
00076 void load_library_values();
00077 void override_library_values(const Ref<KeyVal> &keyval);
00078 void load_values(const Ref<KeyVal>& keyval, int override);
00079 void load_values(std::map<int,double>&,
00080 double *scale, const char *keyword,
00081 const Ref<KeyVal> &keyval, int override,
00082 const Ref<Units> &);
00083 void load_values(std::map<int,std::vector<double> >&,
00084 const char *keyword,
00085 const Ref<KeyVal> &keyval, int override);
00086 void add_overridden_value(const char *assignment);
00087 void initialize_names();
00088 double lookup_value(const std::map<int,double>& values, int Z) const;
00089 double lookup_array_value(const std::map<int,std::vector<double> >& values,
00090 int Z, int i) const;
00091 public:
00092 AtomInfo();
00093
00173 AtomInfo(const Ref<KeyVal>&);
00174 AtomInfo(StateIn&);
00175 ~AtomInfo();
00176 void save_data_state(StateOut& s);
00177
00179 double vdw_radius(int Z) const;
00180 double bragg_radius(int Z) const;
00181 double atomic_radius(int Z) const;
00182 double maxprob_radius(int Z) const;
00183
00185 double ip(int Z) const;
00186
00188 double vdw_radius_scale() const { return vdw_radius_scale_; }
00190 double bragg_radius_scale() const { return bragg_radius_scale_; }
00192 double atomic_radius_scale() const { return atomic_radius_scale_; }
00194 double maxprob_radius_scale() const { return maxprob_radius_scale_; }
00195
00198 double rgb(int Z, int color) const;
00199 double red(int Z) const;
00200 double green(int Z) const;
00201 double blue(int Z) const;
00202
00204 double mass(int Z) const;
00205
00207 std::string name(int Z);
00209 std::string symbol(int Z);
00210
00212 int string_to_Z(const std::string &, int allow_exceptions = 1);
00213 };
00214
00215 }
00216
00217 #endif
00218
00219
00220
00221
00222