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
53namespace clipper
54{
55 enum ScatteringFactorsType
56 {
57 SF_WAASMAIER_KIRFEL,
58 SF_ELECTRON,
59// SF_X_RAY,
60// SF_NEUTRON
61 };
62
64 {
65 ftype64 a[6];
66 ftype64 b[6];
67 };
68
69 template<ScatteringFactorsType TYPE>
71 {
72 public:
73
74 static const ScatteringFactorsData& sf(const String& element, int charge = 0);
75
76 private:
77
78 static const struct SFData data_s[];
79 };
80
82 {
83 public:
84
85 static void selectScattteringFactorsType(ScatteringFactorsType type);
86 static ScatteringFactors& instance();
87
88 const ScatteringFactorsData& operator[](const String& element) const;
89
90 private:
91
92 ScatteringFactors(ScatteringFactorsType type)
93 : type_(type) {}
94
95 static ScatteringFactors* instance_s;
96
97 ScatteringFactorsType type_;
98// static Mutex mutex;
99 };
100
102
118 {
119 public:
120 enum TYPE { X, Y, Z, Uiso, Occ, U11, U22, U33, U12, U13, U23 };
124 AtomShapeFn( const Atom& atom );
126 AtomShapeFn( const Coord_orth& xyz, const String& element, const ftype u_iso = 0.0, const ftype occ = 1.0 );
128 AtomShapeFn( const Coord_orth& xyz, const String& element, const U_aniso_orth& u_aniso, const ftype occ = 1.0 );
130 void init( const Atom& atom );
132 void init( const Coord_orth& xyz, const String& element, const ftype u_iso = 0.0, const ftype occ = 1.0 );
134 void init( const Coord_orth& xyz, const String& element, const U_aniso_orth& u_aniso, const ftype occ = 1.0 );
135
137 ftype f( const Coord_reci_orth& rfl ) const;
139 ftype rho( const Coord_orth& xyz ) const;
140
142 bool rho_grad( const Coord_orth& xyz, ftype& rho, std::vector<ftype>& grad ) const;
144 bool rho_curv( const Coord_orth& xyz, ftype& rho, std::vector<ftype>& grad, Matrix<ftype>& curv ) const;
145
147 bool rho_grad( const Coord_orth& xyz, std::vector<ftype>& grad ) const;
148
150 ftype f( const ftype& invresolsq ) const;
152 ftype rho( const ftype& rsq ) const;
153
155 std::vector<TYPE>& agarwal_params() { return params; }
156 private:
158 void init( const String& element, const ftype& u_iso );
159 // members
160 Coord_orth coord_;
161 U_aniso_orth u_aniso_;
162 ftype u_iso_, occ_;
163 ftype a[6], b[6];
164 ftype aw[6], bw[6];
165 std::vector<Mat33sym<> > uaninv;
166 bool is_iso;
167 std::vector<TYPE> params;
168 };
169
170
172
175 class AtomSF : private AtomShapeFn
176 {
177 public:
178 AtomSF( const String& type, const ftype u_iso = 0.0, const ftype occ = 1.0 );
179 AtomSF( const String& type, const U_aniso_orth& u_aniso, const ftype occ = 1.0 );
180 void init( const String& type, const ftype u_iso = 0.0, const ftype occ = 1.0 );
181 void init( const String& type, const U_aniso_orth& u_aniso, const ftype occ = 1.0 );
182 ftype f_iso( const ftype& s ) const;
183 ftype f_aniso( const Coord_reci_orth& rfl ) const;
184 ftype rho_iso( const ftype& d2 ) const;
185 ftype rho_aniso( const Coord_orth& uvw ) const;
186 };
187
188
189} // namespace clipper
190
191#endif
Atomic scattering factor object.
Definition: atomsf.h:176
Atomic shape function object.
Definition: atomsf.h:118
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:673
void init(const Atom &atom)
initialiser: from atom object
Definition: atomsf.cpp:469
AtomShapeFn()
null constructor
Definition: atomsf.h:122
ftype rho(const Coord_orth &xyz) const
return electron density as a function of coordinate
Definition: atomsf.cpp:546
ftype f(const Coord_reci_orth &rfl) const
return scattering factor as a function of reflection posn
Definition: atomsf.cpp:532
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:590
std::vector< TYPE > & agarwal_params()
define parameters for Agarwal gradient/curvature calcs
Definition: atomsf.h:155
Atom class.
Definition: coords.h:621
orthogonal (Angstrom) coordinates
Definition: coords.h:303
orthogonal reciprocal coordinate (length of which is invresolsq)
Definition: coords.h:187
General matrix class: like Array2d but with numerical methods.
Definition: clipper_types.h:397
Definition: atomsf.h:71
Definition: atomsf.h:82
String extension with simple parsing methods.
Definition: clipper_types.h:65
Anisotropic orthogonal atomic displacement parameters.
Definition: coords.h:427
ftype64 ftype
ftype definition for floating point representation
Definition: clipper_precision.h:58
Definition: atomsf.cpp:49
Definition: atomsf.h:64