Exemplo n.º 1
0
 def __init__(self, name = "pdf"):
     """Initialize the generator.
     """
     from diffpy.srreal.pdfcalculator import DebyePDFCalculator
     BasePDFGenerator.__init__(self, name)
     self._setCalculator(DebyePDFCalculator())
     return
Exemplo n.º 2
0
    def __init__(self, name = "pdf"):
        """Initialize the generator.

        """
        BasePDFGenerator.__init__(self, name)
        self._setCalculator(DebyePDFCalculator())
        return
Exemplo n.º 3
0
 def setUp(self):
     self.pc = PDFCalculator()
     self.dbpc = DebyePDFCalculator()
     self.pwm = MyPWM()
     self.pc.peakwidthmodel = self.pwm
     self.dbpc.peakwidthmodel = self.pwm
     return
Exemplo n.º 4
0
def test_fq(nisph20):
    sc = SASCalculator(rmax=22)
    dbpc = DebyePDFCalculator(rmax=sc.rmax, qmax=sc.qmax, qstep=sc.qstep)
    sc.eval(nisph20)
    dbpc.eval(nisph20)
    assert numpy.array_equal(dbpc.qgrid, sc.qgrid)
    assert numpy.allclose(dbpc.fq, sc.fq)
    return
Exemplo n.º 5
0
 def setUp(self):
     self.dpdfc = DebyePDFCalculator()
     if not TestDebyePDFCalculator.bucky:
         TestDebyePDFCalculator.bucky = (
             loadDiffPyStructure('C60bucky.stru'))
     if not TestDebyePDFCalculator.tio2rutile:
         TestDebyePDFCalculator.tio2rutile = (
             loadDiffPyStructure('TiO2_rutile-fit.stru'))
     return
Exemplo n.º 6
0
 def test_picking_owned(self):
     '''verify pickling of envelopes owned by PDF calculators.
     '''
     pc = PDFCalculator()
     dbpc = DebyePDFCalculator()
     ltb = LocalTable()
     ltb.setCustomAs('Na', 'Na', 37)
     ltb.foo = 'bar'
     pc.scatteringfactortable = ltb
     dbpc.scatteringfactortable = ltb
     self.assertIs(ltb, pc.scatteringfactortable)
     self.assertIs(ltb, dbpc.scatteringfactortable)
     pc2 = pickle.loads(pickle.dumps(pc))
     dbpc2 = pickle.loads(pickle.dumps(dbpc))
     self.assertEqual('localtable', pc2.scatteringfactortable.type())
     self.assertEqual('localtable', dbpc2.scatteringfactortable.type())
     self.assertEqual(37, pc2.scatteringfactortable.lookup('Na'))
     self.assertEqual(37, dbpc2.scatteringfactortable.lookup('Na'))
     self.assertEqual('bar', pc2.scatteringfactortable.foo)
     self.assertEqual('bar', dbpc2.scatteringfactortable.foo)
     return
Exemplo n.º 7
0
#            'rmin' : 0,
#            'rmax' : 70,
#            'rstep': 0.01}
#
#cfg_dpc3 = {'qmax' : 100,
#            'qmin' : 0,
#             'rmin' : 0,
#            'rmax' : 100,
#            'rstep': 0.01}

# calculate PDF by real-space summation
pc0 = PDFCalculator(**cfg_pc)
r0, g0 = pc0(nkl_crystal)

# calcualte PDF by DPC
pc1 = DebyePDFCalculator(**cfg_dpc1)
r1, g1 = pc1(nkl_crystal)

#pc2 = DebyePDFCalculator(**cfg_dpc2)
#r2, g2 = pc2(nkl_crystal)
#
#pc3 = DebyePDFCalculator(**cfg_dpc3)
#r3, g3 = pc3(nkl_crystal)
rou = 4 / 3.52**3  ## atomic density

plt.plot(r0, g0, "b-", lw=2, label="PC")
plt.plot(r1, g1, "r-", lw=2, label="DPC, rmax = 40 A")
plt.plot(r1, g1 - 4 * np.pi * rou * r1, "k-", label="DPC, minus 4*pi*rou*r")
#plt.plot(r2, g2 + 60, "k-", lw=2, label = "DPC, rmax = 70 A")
#plt.plot(r3, g3 + 90, "m-", lw=2, label = "DPC, rmax = 100 A")
Exemplo n.º 8
0
nkl_crystal.Uisoequiv = 0.005

cfg_pc = {'rmin': 0, 'rmax': 20, 'rstep': 0.01}

cfg_dpc1 = {'qmax': 100, 'qmin': 0, 'rmin': 0, 'rmax': 40, 'rstep': 0.01}

cfg_dpc2 = {'qmax': 100, 'qmin': 0, 'rmin': 0, 'rmax': 70, 'rstep': 0.01}

cfg_dpc3 = {'qmax': 100, 'qmin': 0, 'rmin': 0, 'rmax': 100, 'rstep': 0.01}

# calculate PDF by real-space summation
pc0 = PDFCalculator(**cfg_pc)
r0, g0 = pc0(nkl_crystal)

# calcualte PDF by DPC
pc1 = DebyePDFCalculator(**cfg_dpc1)
r1, g1 = pc1(nkl_crystal)

pc2 = DebyePDFCalculator(**cfg_dpc2)
r2, g2 = pc2(nkl_crystal)

pc3 = DebyePDFCalculator(**cfg_dpc3)
r3, g3 = pc3(nkl_crystal)

plt.plot(r0, g0, "b-", lw=2, label="PC")
plt.plot(r1, g1 + 30, "r-", lw=2, label="DPC, rmax = 40 A")
plt.plot(r2, g2 + 60, "k-", lw=2, label="DPC, rmax = 70 A")
plt.plot(r3, g3 + 90, "m-", lw=2, label="DPC, rmax = 100 A")

plt.legend(loc=0)
plt.xlabel("Radial Distance (r)", fontsize=15)
Exemplo n.º 9
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from diffpy.Structure import loadStructure
from diffpy.srreal.pdfcalculator import DebyePDFCalculator
from matplotlib.pyplot import plot, show

c60 = loadStructure('c60.stru')
dpc = DebyePDFCalculator()
dpc.qmax = 20
dpc.rmax = 20
r3, g3 = dpc(c60, qmin=0)
r4, g4 = dpc(c60, qmin=1)

plot(r3, g3, r4, g4)
show()