atominfo.h

00001 //
00002 // atominfo.h
00003 //
00004 // Copyright (C) 1996 Limit Point Systems, Inc.
00005 //
00006 // Author: Curtis Janssen <cljanss@limitpt.com>
00007 // Maintainer: LPS
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
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     AtomInfo(const Ref<KeyVal>&);
00094     AtomInfo(StateIn&);
00095     ~AtomInfo();
00096     void save_data_state(StateOut& s);
00097 
00099     double vdw_radius(int Z) const;
00100     double bragg_radius(int Z) const;
00101     double atomic_radius(int Z) const;
00102     double maxprob_radius(int Z) const;
00103 
00105     double ip(int Z) const;
00106 
00108     double vdw_radius_scale() const { return vdw_radius_scale_; }
00110     double bragg_radius_scale() const { return bragg_radius_scale_; }
00112     double atomic_radius_scale() const { return atomic_radius_scale_; }
00114     double maxprob_radius_scale() const { return maxprob_radius_scale_; }
00115 
00118     double rgb(int Z, int color) const;
00119     double red(int Z) const;
00120     double green(int Z) const;
00121     double blue(int Z) const;
00122 
00124     double mass(int Z) const;
00125 
00127     std::string name(int Z);
00129     std::string symbol(int Z);
00130 
00132     int string_to_Z(const std::string &, int allow_exceptions = 1);
00133 };
00134 
00135 }
00136 
00137 #endif
00138 
00139 // Local Variables:
00140 // mode: c++
00141 // c-file-style: "CLJ"
00142 // End:

Generated at Sun Dec 10 18:20:42 2006 for MPQC 2.3.0 using the documentation package Doxygen 1.4.7.