def createKernel( self, **kwds ):
     Dd_over_d = self._parse( kwds['Dd_over_d'] )
     DebyeWaller_factor = self._parse( kwds['DebyeWaller_factor'] )
     
     peakspath = kwds.get('peaks-py-path')
     lazpath = kwds.get('laz-path')
     
     if peakspath:
         env = {}
         s = open(peakspath).read()
         exec s in env
         peaks = env['peaks']
         unitcell_volume = env['unitcell_volume']
         xs = env['cross_sections']
     elif lazpath:
         from mccomponents.sample.diffraction.parsers.laz import parse
         laz = parse(open(lazpath).read())
         peaks = laz.peaks
         unitcell_volume = laz.lattice.getVolume()
         xs = laz.cross_sections
     else:
         raise ValueError, "SimplePowderDiffractionKernel needs path to "\
               "the peaks datafile (laz or peaks.py)"
     
     from mccomponents.sample.diffraction import simplepowderdiffractionkernel as f
     return f(Dd_over_d, DebyeWaller_factor, peaks, 
              unitcell_volume=unitcell_volume, cross_sections=xs)
 def test1(self):
     laz = os.path.join(aluminum_dir, 'powderdiffr', 'Al.laz')
     text = open(laz).read()
     from mccomponents.sample.diffraction.parsers.laz import parse
     peaks = parse(text).peaks
     print(peaks)
     return
Example #3
0
def loadPattern(xyz, laz):
    text = open(laz).read()
    from mccomponents.sample.diffraction.parsers.laz import parse
    peaks = parse(text).peaks

    # load structure
    from sampleassembly.crystal.ioutils import xyzfile2unitcell
    structure = xyzfile2unitcell(xyz)

    # diffraction pattern
    return DiffractionPattern(structure, peaks)
Example #4
0
def loadPattern(xyz, laz):
    text = open(laz).read()
    from mccomponents.sample.diffraction.parsers.laz import parse
    peaks = parse(text).peaks
        
    # load structure
    from sampleassembly.crystal.ioutils import xyzfile2unitcell
    structure = xyzfile2unitcell(xyz)
    
    # diffraction pattern
    return DiffractionPattern(structure, peaks)
Example #5
0
    def test1(self):
        # load peaks
        laz = os.path.join(aluminum_dir, 'powderdiffr', 'Al.laz')
        text = open(laz).read()
        from mccomponents.sample.diffraction.parsers.laz import parse
        peaks = parse(text).peaks

        # load structure
        from sampleassembly.crystal.ioutils import xyzfile2unitcell
        xyz = os.path.join(aluminum_dir, 'crystal', 'Al.xyz')
        structure = xyzfile2unitcell(xyz)

        # diffraction pattern
        from mccomponents.sample.diffraction.powder import total_scattering_cross_section, DiffractionPattern
        dp = DiffractionPattern(structure, peaks)

        # compute
        for Ei in [10, 100, 1000, 10000]:
            print Ei, total_scattering_cross_section(Ei, dp)
        return
Example #6
0
 def test1(self):
     # load peaks
     laz = os.path.join(aluminum_dir, 'powderdiffr', 'Al.laz')
     text = open(laz).read()
     from mccomponents.sample.diffraction.parsers.laz import parse
     peaks = parse(text).peaks
     
     # load structure
     from sampleassembly.crystal.ioutils import xyzfile2unitcell
     xyz = os.path.join(aluminum_dir, 'crystal', 'Al.xyz')
     structure = xyzfile2unitcell(xyz)
     
     # diffraction pattern
     from mccomponents.sample.diffraction.powder import total_scattering_cross_section, DiffractionPattern
     dp = DiffractionPattern(structure, peaks)
     
     # compute
     for Ei in [10, 100, 1000, 10000]:
         print Ei, total_scattering_cross_section(Ei, dp)
     return