# 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
    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 // Local Variables:
    00220 // mode: c++
    00221 // c-file-style: "CLJ"
    00222 // End: