There are more then one ways to calculate the diffractogram. We think that the correct one is the following:

#### Integration over Energy

##### Probably correct

Start with d^{2}σ / dΩ dE (choose to generate sig(2th,w) in rtof).

oi | We want to integrate over all energies. |

4 | |

* | We do exactly the same as a Diffractometer and integrate over all energies. |

1 | |

Now you have something like dσ / dΩ.

##### Alternatively

The following procedure calculates S(2θ). In a second step, it is transformed into S(Q). However, this step is not correct as the detectors (fixed at a certain angle) do *not* record neutrons with some special Q – Q rather depends on the energy transfer of the sample. Therefore, one would need to transform the spectra first into S(Q,ω) having the problem of a very limited ω-range.

Start with S(2θ,ω).

oi | We want to integrate over all energies. |

4 | |

0 1000 | Using this, we integrate over all energy-gain-neutrons. The problem with the energy-loss-side is that it depends on the incident wavelength. In other cases, the whole range («*») or the elastic line might be better. |

1 | |

This is S(2θ) = ∫_{-∞}^{∞} dω S(2θ,ω). So far, so good. Now comes the part which is worth discussing,

#### Conversion to Q

##### Convert x-axis explicitly

ox | We want now to get S(Q), and not S(2θ) |

* | |

ec | |

0.008726646 | to multiply by 0.5*pi/180=0.008726646 (and get theta) |

ox | |

sin | |

y | to take the sine of x |

ox | |

* | |

ec | |

5.02655 | if you have lambda=2.5, we must calculate 4*pi/lambda=5.02655 |

##### Alternatively

Trusting a build-in which sometimes works only the second time called correctly (produces reasonably-looking output the fist time also, though):

ox | |

q | Function? |

ec | 2nd argument? (this argument is the incident energy) |

2.2725 | Its name / value? (81.81/λ^{2}) |

meV | Its unit |

##### Convert y-axis

The x-axis is now converted to Q, next we have to convert also the y-axis to get a bit closer to the goal that ∫_{0}^{180} d(2θ) S(2θ) = ∫_{0}^{Qmax} d(Q) S(Q)

oy | Operate on y |

* | Multiply |

ec | We work only on one file, therefore «ef» would be equally fine |

85.944 | 45*λ/π (originally: 180/(4*π/λ) ) |

0 | no error |

85.944 | Its name / value |

1 | Its unit |

#### DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER

In the diffractograms created in this way there are more points than one per q. In order to get a value per q, please, do use **mco** in order to average points of equal q. Otherwise you can have problems with some instructions (and the graphics without mco are uglier!!!, are more noisiy, of course!)