1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
--- src/clipper_progs/src/intensity_target.h.orig 2010-01-21 11:27:13.236795886 -0600
+++ src/clipper_progs/src/intensity_target.h 2010-01-21 11:31:33.450686927 -0600
@@ -70,9 +70,31 @@
{
public:
//! constructor: takes the datalist against which to calc target
- TargetFn_scaleLogI1I2( const HKL_data<T1>& hkl_data1_, const HKL_data<T2>& hkl_data2_ );
+ TargetFn_scaleLogI1I2( const HKL_data<T1>& hkl_data1_, const HKL_data<T2>& hkl_data2_ )
+ {
+ hkl_data1 = &hkl_data1_;
+ hkl_data2 = &hkl_data2_;
+ }
//! return the value and derivatives of the target function
- Rderiv rderiv( const HKL_info::HKL_reference_index& ih, const ftype& intensityh ) const;
+ Rderiv rderiv( const HKL_info::HKL_reference_index& ih, const ftype& intensityh ) const
+ {
+ Rderiv result;
+ result.r = result.dr = result.dr2 = 0.0;
+ const T1& it1 = (*hkl_data1)[ih];
+ const T2& it2 = (*hkl_data2)[ih];
+ if ( !it1.missing() && !it2.missing() )
+ if ( it1.I() > 1.0e-6 && it2.I() > 1.0e-6 ) {
+ const ftype eps = ih.hkl_class().epsilon();
+ const ftype i1 = it1.I() / eps;
+ const ftype i2 = it2.I() / eps;
+ const ftype w = sqrt( i1 * i2 );
+ const ftype d = intensityh + log(i1) - log(i2);
+ result.r = w * d * d;
+ result.dr = 2.0 * w * d;
+ result.dr2 = 2.0 * w;
+ }
+ return result;
+ }
//! the type of the function: optionally used to improve convergence
FNtype type() const { return QUADRATIC; }
private:
@@ -109,33 +131,4 @@
return result;
}
- // Log I1-I2 scaling
-
- template<class T1, class T2> TargetFn_scaleLogI1I2<T1,T2>::TargetFn_scaleLogI1I2( const HKL_data<T1>& hkl_data1_, const HKL_data<T2>& hkl_data2_ )
- {
- hkl_data1 = &hkl_data1_;
- hkl_data2 = &hkl_data2_;
- }
-
- template<class T1, class T2> TargetFn_base::Rderiv TargetFn_scaleLogI1I2<T1,T2>::rderiv( const HKL_info::HKL_reference_index& ih, const ftype& intensityh ) const
- {
- Rderiv result;
- result.r = result.dr = result.dr2 = 0.0;
- const T1& it1 = (*hkl_data1)[ih];
- const T2& it2 = (*hkl_data2)[ih];
- if ( !it1.missing() && !it2.missing() )
- if ( it1.I() > 1.0e-6 && it2.I() > 1.0e-6 ) {
- const ftype eps = ih.hkl_class().epsilon();
- const ftype i1 = it1.I() / eps;
- const ftype i2 = it2.I() / eps;
- const ftype w = sqrt( i1 * i2 );
- const ftype d = intensityh + log(i1) - log(i2);
- result.r = w * d * d;
- result.dr = 2.0 * w * d;
- result.dr2 = 2.0 * w;
- }
- return result;
- }
-
-
#endif
|