This is a macro to correct for capillary specimen displacement in Debye-Scherrer geometry

Debye-Scherrer correction for a non-concentric capillary placement.
This follows the maths of K&A and describes the offset in polar coordinates.
The normal "vertical" (or "perpendicular") displacement is when sigma == 90
The normal "horizontal" (or "parallel") displacement is when sigma == 0
macro Debye-Scherrer_Specimen_Displacement { DSSD }
macro DSSD(u, u_v) { DSSD(u, u_v,,90) } ''standard displacement perpendicular to the beam
macro DSSD(u, u_v, s, s_v)
   #m_argu u ''offset of the sample from the centre of the gonio
   #m_argu s ''angle subtended from the "sample" position to the actual centre of the gonio (in deg)
   If_Prm_Eqn_Rpt(u, u_v, min =-Rs/10; max =Rs/10;) ''max offset of a tenth of a radius
   If_Prm_Eqn_Rpt(s, s_v, min =0; max =180;) ''full rotation is provided by a negative u length.
   '' You need "Rad" at the beginning, as th2_offset takes a value in degrees, and this formula is in radians
   ''This is the small angle implementation, the full one should have Arcsin() around everything after the Rad
   th2_offset = Rad (CeV(u, u_v) / Rs) Sin(2 Th - CeV(s, s_v) Deg); 

Personal Tools