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 <util/class/class.h>
00032 #include <util/keyval/keyval.h>
00033
00034 class Units;
00035
00039 class AtomInfo: public SavableState {
00040 private:
00041 enum { MaxZ = 107+1 };
00042
00043 struct atomname
00044 {
00045 char *name;
00046 char *symbol;
00047 };
00048
00049 static struct atomname names_[MaxZ];
00050 double mass_[MaxZ];
00051 double atomic_radius_[MaxZ];
00052 double vdw_radius_[MaxZ];
00053 double bragg_radius_[MaxZ];
00054 double maxprob_radius_[MaxZ];
00055 double rgb_[MaxZ][3];
00056 double atomic_radius_scale_;
00057 double vdw_radius_scale_;
00058 double bragg_radius_scale_;
00059 double maxprob_radius_scale_;
00060
00061 char *overridden_values_;
00062
00063 void load_library_values();
00064 void override_library_values(const Ref<KeyVal> &keyval);
00065 void load_values(const Ref<KeyVal>& keyval, int override);
00066 void load_values(double *array, double *scale, const char *keyword,
00067 const Ref<KeyVal> &keyval, int override,
00068 const Ref<Units> &);
00069 void load_values(double array[][3], const char *keyword,
00070 const Ref<KeyVal> &keyval, int override);
00071 void add_overridden_value(const char *assignment);
00072 public:
00073 AtomInfo();
00074 AtomInfo(const Ref<KeyVal>&);
00075 AtomInfo(StateIn&);
00076 ~AtomInfo();
00077 void save_data_state(StateOut& s);
00078
00080 double vdw_radius(int Z) const { return vdw_radius_[Z]*vdw_radius_scale_; }
00081 double bragg_radius(int Z) const { return bragg_radius_[Z]*bragg_radius_scale_; }
00082 double atomic_radius(int Z) const { return atomic_radius_[Z]*atomic_radius_scale_; }
00083 double maxprob_radius(int Z) const { return maxprob_radius_[Z]*maxprob_radius_scale_; }
00084
00086 double vdw_radius_scale() const { return vdw_radius_scale_; }
00088 double bragg_radius_scale() const { return bragg_radius_scale_; }
00090 double atomic_radius_scale() const { return atomic_radius_scale_; }
00092 double maxprob_radius_scale() const { return maxprob_radius_scale_; }
00093
00096 double rgb(int Z, int color) const { return rgb_[Z][color]; }
00097 double red(int Z) const { return rgb_[Z][0]; }
00098 double green(int Z) const { return rgb_[Z][1]; }
00099 double blue(int Z) const { return rgb_[Z][2]; }
00100
00102 double mass(int Z) const { return mass_[Z]; }
00103
00105 static const char *name(int Z) { return names_[Z].name; }
00107 static const char *symbol(int Z) { return names_[Z].symbol; }
00108
00110 static int string_to_Z(const char *, int allow_exceptions = 1);
00111 };
00112
00113
00114 #endif
00115
00116
00117
00118
00119