# Obtaining RDF from provided structure factor

I have a test structure factor dataset from water O-O pairs and I am trying to get the $$g_{OO}(r)$$.

q     Norm2     err_norm2
0     7.027826 -0.323588  3.433183e-06
1     7.120845 -0.324964  3.401932e-06
2     7.213864 -0.326260  3.386715e-06
3     7.306882 -0.327475  3.385868e-06
4     7.399901 -0.328610  3.397331e-06
..         ...       ...           ...
995  99.581420  0.007117  9.849377e-07
996  99.674430  0.006839  9.836154e-07
997  99.767450  0.006558  9.822502e-07
998  99.860470  0.006274  9.808368e-07
999  99.953490  0.005988  9.793699e-07

$$q$$ is the scattering vector in nm$$^{-3}$$ and Norm2 is the scattering factor (with normalization factor II; not sure if relevant at all). Using python

dataFile="ref_sfac_OO.csv"

the plot is:

I am trying to recreate the $$g_{OO}(r)$$ RDF using the following expression from Skinner2013 equation 9:

$$g(r)=1+\frac{1}{2\pi^2\rho r}\int^{Q_{Max}}_0 \text{Lorch}(q)\times q [S(q)-1]\times \sin(q r)dq$$

where $$\text{Lorch}(q)$$ is a Lorch-type normalization factor which I have kept as 1 for testing and $$\rho=0.0033\,Å^{−3}$$.

The python code for the above expression is:

qArray = np.array(refDataDf.q)/10 # converting to angstrom
rArray = 2*np.pi/refDataDf.q*10 # converting to angstrom
dq = qArray[1] - qArray[0]
But I am unable to get the correct behavior of the $$g_{OO}(r)$$ RDF (incorrect 1st RDF height peak, almost absent second and beyond peaks). Does anyone have any suggestions on whether my formulation above is correct or should I use a different idea?