MSpin-JCoupling  2.1
atom.h
1 /***************************************************************************
2  atom.h - description
3  -------------------
4  author : Armando Navarro-Vazquez
5  email : armando.deus@gmail.com
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef MAGNES_ATOM_H
18 #define MAGNES_ATOM_H
19 
20 
21 #include <string>
22 #include <vector>
23 #include <list>
24 #include <map>
25 #include "coordinate.h"
26 #include "coreexport.h"
27 
31 namespace magnes
32 {
33  class PDBResidue;
34 
39  class MAGNES_CORE_API Atom
40  {
41  public:
42  class MAGNES_CORE_API IsotopeData
43  {
51  public:
52  IsotopeData(double mass, double abundance, int mult, double lambda, double q) : _mass(mass), _abundance(abundance), _mult(mult), _lambda(lambda), _q(q) {}
53  double Mass() const { return _mass; }
54  double Abundance() const { return _abundance; }
55  int Multiplicity() const { return _mult; }
56  double MagnetoGyricRatio() const { return _lambda; }
57  double Quadrupole() const { return _q; }
58  private:
60  double _mass;
62  double _abundance;
64  int _mult;
66  double _lambda;
68  double _q;
69  };
70 
75  class MAGNES_CORE_API AtomData
76  {
77  public:
78 
80  class rgb
81  {
82  public:
83  rgb ( int lr, int lg, int lb ) : r ( lr ) , g ( lg ) ,b ( lb ) {}
84  int r; int g; int b;
85  };
95  AtomData ( int z, double m, double w, double r, double el, rgb c,const std::map<const int,const IsotopeData>* idata=NULL ) :
96  _Z ( z ), _mass ( m ), _vdw ( w ), _cr ( r ), _Pel ( el ), _color ( c ) , _idata(idata) {}
97 
99  int _Z;
101  double _mass;
103  double _vdw;
105  double _cr;
107  double _Pel;
111  const std::map<const int, const IsotopeData>* _idata;
112  };
113 
115  enum hybridization { UNKNOWN=0, SP, SP2, SP3 };
116  Atom();
117  ~Atom();
118 
123  Atom ( const std::string& symbol ) { SetSymbol ( symbol ); m_residue=NULL; }
128  Atom ( int z ) { SetZ ( z ); m_residue=NULL; }
130  double AtomicMass() const { return m_data->second._mass; }
132  void Color ( float* r, float* g, float* b ) const;
134  int Z() const { return m_data->second._Z; }
136  double VdW() const { return m_data->second._vdw; }
138  double CovalentRadius() const { return m_data->second._cr; }
140  double PaulingElectronegativity() const { return m_data->second._Pel; }
142  const std::string& Symbol() const { return m_data->first; }
144  void SetSymbol ( const std::string& symbol );
146  void SetZ ( int z );
148  void SetPDBResidue(PDBResidue* r) { m_residue=r; }
150  PDBResidue* Residue() { return m_residue; }
152  const PDBResidue* Residue() const { return m_residue; }
154  void SetPDBName(const std::string& name) { m_pdbname=name; }
156  const std::string& PDBName() const { return m_pdbname; }
158  const std::pair<const int,const IsotopeData>* NMRIsotope() const;
160  void SetCurrentNMRIsotope(int m);
162  const std::map<const int,const IsotopeData>& NMRIsotopes() const { return *m_data->second._idata; }
164  size_t MMType() const { return m_mmtype; }
166  void SetMMType(size_t mmtype) { m_mmtype=mmtype; }
167  private:
168  double GetAtomicMass() const;
169  const std::pair<const std::string,const AtomData>* m_data;
170  const std::pair<const int,const IsotopeData>* m_isotope;
171  PDBResidue* m_residue;
172  std::string m_pdbname;
173  size_t m_mmtype;
174 
175  };
176 
177  MAGNES_CORE_API typedef std::map<const std::string, const magnes::Atom::AtomData> PeriodicTable;
178 
180  MAGNES_CORE_API const PeriodicTable& GetPeriodicTable();
181 
182  MAGNES_CORE_API void BuildPeriodicTable();
183 
185  MAGNES_CORE_API int ZFromSymbol(const std::string& symbol);
186 
188  MAGNES_CORE_API std::string SymbolFromZ(int z);
189 
191  MAGNES_CORE_API const std::pair<const int,const Atom::IsotopeData>* DefaultNMRProperties(const std::string& symbol);
192 }
193 
194 #endif // MAGNES_ATOM_H
double _cr
Definition: atom.h:105
AtomData(int z, double m, double w, double r, double el, rgb c, const std::map< const int, const IsotopeData > *idata=NULL)
Definition: atom.h:95
IsotopeData(double mass, double abundance, int mult, double lambda, double q)
Definition: atom.h:52
double PaulingElectronegativity() const
Definition: atom.h:140
size_t MMType() const
Definition: atom.h:164
rgb _color
Definition: atom.h:109
basic atomic data (Z, mass, electronegativity...)
Definition: atom.h:75
the global magnes namespace
Definition: ccchequation.h:38
MAGNES_CORE_API const PeriodicTable & GetPeriodicTable()
const PDBResidue * Residue() const
Definition: atom.h:152
const std::map< const int, const IsotopeData > & NMRIsotopes() const
Definition: atom.h:162
MAGNES_CORE_API int ZFromSymbol(const std::string &symbol)
hybridization
Definition: atom.h:115
Definition: atom.h:42
representation of an atom
Definition: atom.h:39
double _mass
Definition: atom.h:101
const std::map< const int, const IsotopeData > * _idata
Definition: atom.h:111
PDBResidue * Residue()
Definition: atom.h:150
double AtomicMass() const
Definition: atom.h:130
Atom(int z)
Definition: atom.h:128
double VdW() const
Definition: atom.h:136
void SetPDBName(const std::string &name)
Definition: atom.h:154
Definition: pdbtools.h:26
Atom(const std::string &symbol)
Definition: atom.h:123
void SetPDBResidue(PDBResidue *r)
Definition: atom.h:148
double _vdw
Definition: atom.h:103
MAGNES_CORE_API std::string SymbolFromZ(int z)
double _Pel
Definition: atom.h:107
const std::string & PDBName() const
Definition: atom.h:156
int Z() const
Definition: atom.h:134
Definition: atom.h:80
double CovalentRadius() const
Definition: atom.h:138
void SetMMType(size_t mmtype)
Definition: atom.h:166
const std::string & Symbol() const
Definition: atom.h:142
MAGNES_CORE_API const std::pair< const int, const Atom::IsotopeData > * DefaultNMRProperties(const std::string &symbol)
int _Z
Definition: atom.h:99