Beispiel #1
0
nphcrystal.AddScatterer(nphmol)
nphmol.X, nphmol.Y, nphmol.Z = xyzf.mean(axis=0)

pdfcntb = PDFContribution('pdfcntb')
pdfcntb.loadData('naphthalene.gr')
pdfcntb.qdamp = 0.06
pdfcntb.setCalculationRange(1.1, 25)
pdfcntb.addStructure('nphmol', nphmol, periodic=False)
pdfcntb.addStructure('widecrystal', nphcrystal, periodic=True)
pdfcntb.addStructure('widemolecule', nphcrystal, periodic=False)
pdfcntb.widecrystal._calc.peakwidthmodel = ConstantPeakWidth()
pdfcntb.widemolecule._calc.peakwidthmodel = ConstantPeakWidth()
from naphthalene_functions import fixpeakwidthparameters
fixpeakwidthparameters(pdfcntb)

pdfcntb.setEquation('scale * (nphmol + widecrystal - widemolecule)')

nphfit = FitRecipe()
nphfit.clearFitHooks()
nphfit.addContribution(pdfcntb)

nphfit.addVar(pdfcntb.scale, name='scale')
pcrystal = pdfcntb.widecrystal.phase
# unit cell parameters
nphfit.addVar(pcrystal.a)
nphfit.addVar(pcrystal.b)
nphfit.addVar(pcrystal.c)
# cell-angle beta is in radians in ObjCryst Crystal
# we will refine angle in degrees.
nphfit.newVar('beta', value=np.degrees(pcrystal.beta.value))
nphfit.constrain(pcrystal.beta, 'radians(beta)')
nphcrystal.AddScatterer(nphmol)
nphmol.X, nphmol.Y, nphmol.Z = xyzf.mean(axis=0)

pdfcntb = PDFContribution('pdfcntb')
pdfcntb.loadData('naphthalene.gr')
pdfcntb.qdamp = 0.06
pdfcntb.setCalculationRange(1.1, 25)
pdfcntb.addStructure('nphmol', nphmol, periodic=False)
pdfcntb.addStructure('widecrystal', nphcrystal, periodic=True)
pdfcntb.addStructure('widemolecule', nphcrystal, periodic=False)
pdfcntb.widecrystal._calc.peakwidthmodel = ConstantPeakWidth()
pdfcntb.widemolecule._calc.peakwidthmodel = ConstantPeakWidth()
from naphthalene_functions import fixpeakwidthparameters
fixpeakwidthparameters(pdfcntb)

pdfcntb.setEquation('scale * (nphmol + widecrystal - widemolecule)')

nphfit = FitRecipe()
nphfit.clearFitHooks()
nphfit.addContribution(pdfcntb)

nphfit.addVar(pdfcntb.scale, name='scale')
pcrystal = pdfcntb.widecrystal.phase
# unit cell parameters
nphfit.addVar(pcrystal.a)
nphfit.addVar(pcrystal.b)
nphfit.addVar(pcrystal.c)
# cell-angle beta is in radians in ObjCryst Crystal
# we will refine angle in degrees.
nphfit.newVar('beta', value=np.degrees(pcrystal.beta.value))
nphfit.constrain(pcrystal.beta, 'radians(beta)')