• Keine Ergebnisse gefunden

3.3 Minimum Example

4.1.2 Numerical and Analytical Derivatives

I also calculated and sampled the complete derivative vector for all atoms in the relevant part of conformational space. The results of the analytical derivative was compared with the result of an alternatively implemented, but very slow, numerical derivative. The match between analytical and numerical derivative is fulfilled in all situations. All the previous plots of analytical derivatives (figs. 4.4-4.7, 10.1-10.4) can be reproduced using the numerical derivative.

Here, a simple example for the agreement between numerical and analytical derivative is given. In contrast to the plots of the previous section, using a single peak and a single mixing time, here two mixing times and three cross peaks for each mixing time are used.

The numerical gradient was calculated using symmetric finite differences following this equation for all atoms i along the Cartesian axes x,y and z:

∂EINPH

with h = 0.005 Å. As any finite difference derivative will evaluate the derivative more or less in the middle of an interval the symmetric finite difference delivers a rather accurate estimation for the derivative atx0i. The calculation of this numerical gradient requires the evaluation of two INPHARMA energies for a single entry of the gradient and 6 evaluations for every atom. Each time the effective relaxation matrix needs to be diag-onalized. For a small 6-atom test system this time is negligible. For larger systems having matrix sizes above 1000×1000, more than 6000 diagonal-izations are required and the numerical evaluation of the gradient becomes almost prohibitively slow or at least impractical. Considering a typical computation time of 0.6s for a single energy evaluation, using a cutoff of 8.5 Å and a matrix size of 1000 the calculation of the numerical derivative would require 60 minutes. In contrast, the calculation of the corresponding analytical derivative would only require 0.6 s, being 6000 times faster.

The finite difference gradient only depends on thevalues of the energy func-tionEINPH. It does not require any knowledge about the energy’s functional dependence on the coordinates, in contrast to the calculation of the ana-lytical gradient. Thus the numerical gradient can be used to check if the analytical gradient is correct for a particular set of coordinates and param-eters.

To compare the numerical and analytical gradients, atom 4 (ligand 1, bound)

of the 6-spin system was picked and moved along the x-axis in the range from -5 to 5 Å. At the position x= 0 Å it has its reference position and at x= 2 Å its neighbor atom is placed.

These peak volumes for two mixing times were used:

VOLUmes

ADD "A1" "A1" 0.57002E+01 0.57002E+00 0.48891E+01 0.48891E+00 ADD "A1" "B1" 0.30432E+00 0.30432E-01 0.12202E+01 0.12202E+00 ADD "B1" "B1" 0.37764E+01 0.37764E+00 0.26114E+01 0.26114E+00 END

The used protocol can be found in the appendix (ch. 10.1.3, p. 161).

In the following figures (fig. 4.8-4.12) the INPHARMA energy EINPH and gradients or functions of them along the x-coordinate of the moved atom are given.

EINPH/(kcalmol-1 ) dEINPH/dx/(kcalmol-1 1010 m-1 )

x/(10-10m) EINPH

dEINPH/dx, analytical dEINPH/dx, numerical

Figure 4.8: Plot of the INPHARMA energy EINPH (red) and the numerical (yellow) and analytical (green) derivatives along the x-coordinate of the moved atom (see text). There are no apparent differences between the analytical and numerical deviates and both lines lie just on top of each other. Two mixing times and three peaks for each mixing time were used. It can be seen that the energy as a function of atom coordinate is smooth, having a continuous derivative.

Nevertheless, the derivative has kinks where the second derivative of the energy suddenly changes.

-2 -1 0 1 2 3

-5 -4 -3 -2 -1 0 1 2 3 4 5-0.02

-0.01 0 0.01 0.02 0.03

dE/dx=dEINPH/dx,analytical dEINPH/dx/(kcalmol-1 1010 m-1 )

x/(10-10m)

dE/dx=dEINPH/dx, analytical dE/dx(anal.)-dE/dx(num.), right hand axis dE/dx(anal.)-dE/dx(num.), left hand axis

/(kcalmol-1 1010 m-1 )

Figure 4.9: The analytical derivative, as in fig.4.8, and the absolute difference of analytical and numerical derivative are plotted. The blue line is the difference in the same scale as the derivative itself. Here the differences seem small compared to the range of values of the derivative itself (red line). The green line plots the absolute differences on a smaller scale making them more visible. The maximum absolute difference is about 0.017kcal mol−1Å−1 while the maximum derivate itself has a 100 times bigger value of about1.7 kcal mol−1Å−1

-2

dE/dx=dEINPH/dx, analytical (dE/dx(anal.)-dE/dx(num.))/dE/dx(anal.)

/(kcalmol-1 1010 m-1 )

Figure 4.10: Here the numerical derivative (green) and its relative difference to the analytical derivative (red) are given. The maximum relative difference is 1.2 = 120%. Again, the difference is biggest when the value of the derivate is very small and mainly in places where a kink in the derivative is present.

-2

dE/dx=dEINPH/dx, analytical (dE/dx(anal.)-dE/dx(num.))/dE/dx(anal.)

dE/dx=dEINPH/dx,analytical /(kcalmol-1 1010 m-1 )

Figure 4.11: Here, the numerical derivative (green) and the relative difference of the analytical derivative (red) are given just as in figure 4.10. Here, the scale of the difference axis has been reduced. It can be seen that the relative difference of the numerical to the analytical derivative is normally well below0.02 = 2%.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8

1.96 1.97 1.98 1.99 2 2.01 2.02 2.03 2.04-2e-06 -1.5e-06 -1e-06 -5e-07

0 5e-07 1e-06 1.5e-06 2e-06

EINPH/(kcalmol-1 ) dEINPH/dx/(kcalmol-1 1010 m-1 )

x/(10-10m)

EINPH dEINPH/dx, analytical dEINPH/dx, numerical

Figure 4.12: The INPHARMA energy (red), the numerical (blue) and analytical (green) derivatives are plotted in an area around x = 2 Å. Here a large relative difference of the derivatives of about 100% is visible. These differences, on an absolute scale, are still virtually invisible. The largest relative difference is actually due to the following absolute valuesgradanal.= 0.157·10−08and gradnum.0.302· 10−08.

It can be seen that the absolute difference between numerical and analytical gradient is small (fig. 4.8, 4.9) . The relative difference of the gradients (gradanalytical−gradnumerical)/gradanalytical can reach up to a factor of 1.2 = 120% (fig. 4.10, 4.11). Nevertheless, this only happens where the absolute value of the gradient is almost zero, and so are the absolute differences, and preferably in positions where the derivative is not differentiable and so has a kink (fig. 4.12). Here the numerical derivative does not give reliable estimates for the actual derivative.

The agreement of the numerical and analytical derivate is very good. The remaining differences probably come from the technical drawbacks of the numerical derivative or numerical inaccuracies. No severe differences be-tween numerical or analytical derivative have been found, neither in the presented test case nor in other tested cases (data not shown).

From this, it is concluded that the theoretical derivation of the analyti-cal gradient of the INPHARMA energy as well as its implementation into XPLOR-NIH are correct and can be applied to structural refinement.