Exemplo n.º 1
0
def iter_bond(x_min, x_max, step=5):
    import numpy as np
    import matplotlib.pyplot as plt
    #from matplotlib.pyplot import plot

    from diffpy.Structure import Structure, Atom, Lattice
    from diffpy.srreal.pdfcalculator import DebyePDFCalculator

    dbc = DebyePDFCalculator()
    dbc.qmax = 20
    dbc.qmin = 0.5
    dbc.rmax = 20
    
    iter_range = np.linspace(x_min, x_max, step)
    fig_dim = len(iter_range)
    
    acs = Atom('Cs', [0, 0, 0])
    acl = Atom('Cl', [0.5, 0.5, 0.5])
    plt.figure()
    for ind, val in enumerate(iter_range):
        cscl = Structure(atoms=[acs, acl],
			lattice=Lattice(val, val, val, 90, 90, 90))
        dbc.setStructure(cscl)
        (r,g) = dbc()
        print(val)
        plt.subplot(fig_dim, 1, ind+1)
        plt.plot(r,g)
        plt.title('bond length = %s' % str(val))
Exemplo n.º 2
0
def dbc_iter(struc_f, iter_range):
    '''change different range'''
    
    import numpy as np
    import matplotlib.pyplot as plt
    from diffpy.srreal.pdfcalculator import DebyePDFCalculator
    from diffpy.Structure import loadStructure
    
    struc = loadStructure(struc_f)
    dbc = DebyePDFCalculator()
    dbc.setStructure(struc)
    dbc.qmax = 20
    dbc.qmin = 0.5
    dbc.rmax = 20
    #par = eval(para)
    #print(dbc.par)
    for step in iter_range:
        (r,g) = dbc(delta2 = step)
        plt.plot(r,g)
Exemplo n.º 3
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()
Exemplo n.º 4
0
    # stru.loadStrufile('CdS.cif', 'diffpy', periodic=True)
    stru.loadStrufile('cd35se20.xyz', 'diffpy', periodic=False)
    stru.parseDiffpyStru()

    struparaset = StructureExtParSet('test', stru)
    # a = np.zeros_like(struparaset.xyz.value)
    # struparaset.xyz = a

    # b = np.zeros_like(struparaset.occ.value)
    # struparaset.occ = b

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

    pc1 = DebyePDFCalculator()
    pc1.rmax = 20
    pc1.qmin = 1.0
    r1, g1 = pc1(struparaset._getSrRealStructure())
    plot(r1, g1)

    # xyz = np.array(struparaset.xyz.value)
    # struparaset.xyz = xyz * 1.1
    # uij = np.array(struparaset.uij.value)
    # struparaset.uij = uij * 3.0
    struparaset.zoomscale = 1.1
    r2, g2 = pc1(struparaset._getSrRealStructure())
    plot(r2, g2)

    show()