Clipper
atomsf.h
Go to the documentation of this file.
1 
5 //C Copyright (C) 2000-2006 Kevin Cowtan and University of York
6 //L
7 //L This library is free software and is distributed under the terms
8 //L and conditions of version 2.1 of the GNU Lesser General Public
9 //L Licence (LGPL) with the following additional clause:
10 //L
11 //L `You may also combine or link a "work that uses the Library" to
12 //L produce a work containing portions of the Library, and distribute
13 //L that work under terms of your choice, provided that you give
14 //L prominent notice with each copy of the work that the specified
15 //L version of the Library is used in it, and that you include or
16 //L provide public access to the complete corresponding
17 //L machine-readable source code for the Library including whatever
18 //L changes were used in the work. (i.e. If you make changes to the
19 //L Library you must distribute those, but you do not need to
20 //L distribute source or object code to those portions of the work
21 //L not covered by this licence.)'
22 //L
23 //L Note that this clause grants an additional right and does not impose
24 //L any additional restriction, and so does not affect compatibility
25 //L with the GNU General Public Licence (GPL). If you wish to negotiate
26 //L other terms, please contact the maintainer.
27 //L
28 //L You can redistribute it and/or modify the library under the terms of
29 //L the GNU Lesser General Public License as published by the Free Software
30 //L Foundation; either version 2.1 of the License, or (at your option) any
31 //L later version.
32 //L
33 //L This library is distributed in the hope that it will be useful, but
34 //L WITHOUT ANY WARRANTY; without even the implied warranty of
35 //L MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36 //L Lesser General Public License for more details.
37 //L
38 //L You should have received a copy of the CCP4 licence and/or GNU
39 //L Lesser General Public License along with this library; if not, write
40 //L to the CCP4 Secretary, Daresbury Laboratory, Warrington WA4 4AD, UK.
41 //L The GNU Lesser General Public can also be obtained by writing to the
42 //L Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
43 //L MA 02111-1307 USA
44 
45 
46 #ifndef CLIPPER_ATOMSF
47 #define CLIPPER_ATOMSF
48 
49 
50 #include "coords.h"
51 
52 
53 namespace clipper
54 {
55 
57 
73  {
74  public:
75  enum TYPE { X, Y, Z, Uiso, Occ, U11, U22, U33, U12, U13, U23 };
79  AtomShapeFn( const Atom& atom );
81  AtomShapeFn( const Coord_orth& xyz, const String& element, const ftype u_iso = 0.0, const ftype occ = 1.0 );
83  AtomShapeFn( const Coord_orth& xyz, const String& element, const U_aniso_orth& u_aniso, const ftype occ = 1.0 );
85  void init( const Atom& atom );
87  void init( const Coord_orth& xyz, const String& element, const ftype u_iso = 0.0, const ftype occ = 1.0 );
89  void init( const Coord_orth& xyz, const String& element, const U_aniso_orth& u_aniso, const ftype occ = 1.0 );
90 
92  ftype f( const Coord_reci_orth& rfl ) const;
94  ftype rho( const Coord_orth& xyz ) const;
95 
97  bool rho_grad( const Coord_orth& xyz, ftype& rho, std::vector<ftype>& grad ) const;
99  bool rho_curv( const Coord_orth& xyz, ftype& rho, std::vector<ftype>& grad, Matrix<ftype>& curv ) const;
100 
102  bool rho_grad( const Coord_orth& xyz, std::vector<ftype>& grad ) const;
103 
105  ftype f( const ftype& invresolsq ) const;
107  ftype rho( const ftype& rsq ) const;
108 
110  std::vector<TYPE>& agarwal_params() { return params; }
111  private:
113  void init( const String& element, const ftype& u_iso );
114  // members
115  Coord_orth coord_;
116  U_aniso_orth u_aniso_;
117  ftype u_iso_, occ_;
118  ftype a[6], b[6];
119  ftype aw[6], bw[6];
120  std::vector<Mat33sym<> > uaninv;
121  bool is_iso;
122  std::vector<TYPE> params;
123  };
124 
125 
127 
130  class AtomSF : private AtomShapeFn
131  {
132  public:
133  AtomSF( const String& type, const ftype u_iso = 0.0, const ftype occ = 1.0 );
134  AtomSF( const String& type, const U_aniso_orth& u_aniso, const ftype occ = 1.0 );
135  void init( const String& type, const ftype u_iso = 0.0, const ftype occ = 1.0 );
136  void init( const String& type, const U_aniso_orth& u_aniso, const ftype occ = 1.0 );
137  ftype f_iso( const ftype& s ) const;
138  ftype f_aniso( const Coord_reci_orth& rfl ) const;
139  ftype rho_iso( const ftype& d2 ) const;
140  ftype rho_aniso( const Coord_orth& uvw ) const;
141  };
142 
143 
144 } // namespace clipper
145 
146 #endif
Atomic shape function object.
Definition: atomsf.h:72
std::vector< TYPE > & agarwal_params()
define parameters for Agarwal gradient/curvature calcs
Definition: atomsf.h:110
orthogonal (Angstrom) coordinates
Definition: coords.h:302
bool rho_curv(const Coord_orth &xyz, ftype &rho, std::vector< ftype > &grad, Matrix< ftype > &curv) const
return Agarwal density gradient/curvature as a function of coordinate
Definition: atomsf.cpp:716
ftype64 ftype
ftype definition for floating point representation
Definition: clipper_precision.h:58
ftype rho(const Coord_orth &xyz) const
return electron density as a function of coordinate
Definition: atomsf.cpp:589
Atom class.
Definition: coords.h:620
String extension with simple parsing methods.
Definition: clipper_types.h:64
bool rho_grad(const Coord_orth &xyz, ftype &rho, std::vector< ftype > &grad) const
return Agarwal density gradients as a function of coordinate
Definition: atomsf.cpp:633
Anisotropic orthogonal atomic displacement parameters.
Definition: coords.h:426
ftype f(const Coord_reci_orth &rfl) const
return scattering factor as a function of reflection posn
Definition: atomsf.cpp:575
void init(const Atom &atom)
initialiser: from atom object
Definition: atomsf.cpp:512
General matrix class: like Array2d but with numerical methods.
Definition: clipper_types.h:396
AtomShapeFn()
null constructor
Definition: atomsf.h:77
Atomic scattering factor object.
Definition: atomsf.h:130
orthogonal reciprocal coordinate (length of which is invresolsq)
Definition: coords.h:186