qzhu2017 / XRD

X-ray diffraction calculations
MIT License
7 stars 6 forks source link

Weight function in similarity calculation #13

Closed qzhu2017 closed 4 years ago

qzhu2017 commented 4 years ago

@sayred1 Right now, the triangle function is used.

image

l in the above equation should be consistent to r_range values. Why did you set 0.6 here?. https://github.com/qzhu2017/XRD/blob/ca73701349c440f171eb290c52553613d1f40cc3/similarity.py#L10

However, triangle function is not smooth. I suggest you also add the cosine function used in our PyXtal_FF

image

This can ensure that the function smoothly goes to zero when r is approaching to r_cut.

sayred1 commented 4 years ago

@qzhu2017 I chose the value of 0.6 based off of the de Gelder paper.

"The parameter l defines the width (degrees 2θ) of the neighborhood taken into account. This function extracts information from the central part of the crosscorrelation function with a weight that decreases proportionally to the distance from the origin (r=0). After a number of experiments it was found that values of l between 0.6 and 3.0 lead to stable and comparable results for the powder diffractions patterns of the 20 complexes."

However since our defined range of r may differ from theirs (which they do not mention), we should test our own values of l/R_cut?

qzhu2017 commented 4 years ago

@sayred1 Yes, but I meant to say that if you set +/-1 for r_range, then l should be 1 (not 0.6). Don't mess up the relation. In this case, I suggest we don't use dictionary to denote weight, just use string.

def __init__(self, f, g, N = None, x_range = None, r_range = None, weight = 'triangle'):
qzhu2017 commented 4 years ago

@sayred1 I just fixed it in commit 69758650c6b65877233c10ae05cdcdca1f5c553b