Exemplo n.º 1
0
from core.lattice import Lattice
import numpy as np
import pylab as pl

Sm227 = Lattice([10.3],'F d -3 m')

r = [0,0,0]
q = [2,0,0]

rTemp = (np.dot(Sm227.Symmetry.symOp, r) + Sm227.Symmetry.symTr) % 1

#T = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 0.5]])

#b = np.exp(2j * np.pi * np.einsum('i,ji->j', q, (Sm227.Symmetry.symTr + np.dot(Sm227.Symmetry.symOp, r))))
#a = np.einsum('mij,jk,mlk->mil', Sm227.Symmetry.symOp, T, Sm227.Symmetry.symOp)
#Fk = np.einsum('ijk,i->jk', a, b)
#print(Fk)

b = np.exp(2j * np.pi * np.einsum('i,ji->j', q, (Sm227.Symmetry.symTr + np.dot(Sm227.Symmetry.symOp, r))))

print(np.exp(2j * np.pi * np.dot(q,[.0, 0, .0])))
print(np.exp(2j * np.pi * np.dot(q,[.0, 0.75, .75])))
print(np.exp(2j * np.pi * np.dot(q,[.75, 0, .75])))
print(np.exp(2j * np.pi * np.dot(q,[.75, .75, .0])))

#print(b[0:16:4])
#print(rTemp[0:16:3])



#(0, 0, 0) 2: (0, .75, .75)   3: (.75, 0, .75)   4: (.75, .75, 0)
Exemplo n.º 2
0
from core.lattice import Lattice
# ---- Eu2Ir2O7 powder diffraction ----- #

# create lattice
Eu227 = Lattice([10.3], 'F d -3 m')

# atomic positions
Eu227.add_atom('Eu', [0.5, 0.5, 0.5])
Eu227.add_atom('Ir', [0.0, 0.0, 0.0])
Eu227.add_atom('O', [0.375, 0.375, 0.375])
Eu227.add_atom('O', [0.332, 0.125, 0.125])

# diffraction setup
Eu227.diffraction(11217)

# plot powder pattern
Eu227.diffract.powder()
Exemplo n.º 3
0
from core.lattice import Lattice
# ---- Ca2RuO4 REXS ----- #

# create lattice and symmetry
Ca214 = Lattice([5.38,5.630,11.722],'P b c a')

r    = [0,0,0]
q    = [0,1,3]
MS   = [0,1,0]

# generate ATS and magnetic tensors
Fats = Ca214.genTensor(r,q)
Fm   = Ca214.xrmsTensor(MS)
print(Fats," ",Fm)

# setup diffraction experiment
n    = [0,0,1] # crystal surface
E    = 2967    # energy
pol  = [1,0]   # incident polarisation
azir = [0,1,0] # azimuthal reference

Ca214.diffraction(E,pol,n,azir)

# simulate azimuthal scan
Ca214.diffract.aziScan(Fats+0.5*Fm,q)
Exemplo n.º 4
0
from core.lattice import Lattice

Ca227 = Lattice([7.21, 10.1, 7.39, 90, 90, 90], 'C m c m')

n = [1, 1, 1]

r = [0.25, 0.25, 0.25]
q = [1, 9, 0]
E = 10872
azir = [1, 0, 0]
MS = [0, 0, 1]

Fats = Ca227.genTensor(r, q)
print(Fats)

Ca227.diffraction(E, [1, 0], n, azir)
Ca227.diffract.aziScan(Fats, q)

# * Make sure call to genOp is minimized, keep operators in mem.
# * Generalise rotTensor for hexagonal, monoclinic and triclinic -
# * this requires transforming to an orthogonal basis first
# * Restructure OO?
Exemplo n.º 5
0
 def __init__(self):
     self._lattice = Lattice()
     self._orbit = Orbit()
     self._twiss = Twiss()
     self._photons = Photons()
Exemplo n.º 6
0
class Generator():
    """
    The main Synchrotron Radiation generator.
    """
    def __init__(self):
        self._lattice = Lattice()
        self._orbit = Orbit()
        self._twiss = Twiss()
        self._photons = Photons()


    def initialize(self):
        # get settings
        self._start = Settings()['generator']['orbit']['start']
        self._stop = Settings()['generator']['orbit']['stop']
        self._show_progress = Settings()['application']['progress_bar']

        # load the lattice
        self._lattice.load([os.path.join(Settings()['application']['conf_path'],
                            fname) for fname in Settings()['machine']['lattice']])

        # initialise the sub-systems
        self._orbit.initialize(self._lattice)
        self._twiss.initialize(self._lattice)
        self._photons.initialize(self._lattice)
        
        # initialise step and beam
        self._step = self._orbit.create_step()
        self._beam = self._twiss.create_beam()

        # output
        self._output_lattice = Output('regions')
        self._output_orbit = Output('orbit_parameters')
        self._output_twiss = Output('twiss_parameters')
        self._output_num_photons = Output('radiated_number_photons')
        self._output_spectrum = Output('spectrum_lut')
        self._output_lattice.open()
        self._output_orbit.open()
        self._output_twiss.open()
        self._output_num_photons.open()
        self._output_spectrum.open()

        # hepevt output
        self._hepevt = Hepevt()
        self._hepevt.open()



    def run(self):
        # write lattice and spectrum
        self._lattice.write(self._output_lattice)
        self._photons.write_spectrum(self._output_spectrum)

        # progress bar
        if self._show_progress:
            progress_ds = 0.0
            progress = ProgressBar(widgets=['Stepping: ', Percentage(),
                                            ' ', Bar(), ' ', ETA()],
                                   maxval=math.fabs(self._stop - self._start)).start()

        # first ideal orbit step
        self._orbit.step_ideal_orbit(self._step)

        # step through the lattice until the stop point is reached
        while self._orbit.valid(self._step):

            # step the actual orbit and evolve the twiss parameters
            self._orbit.step_actual_orbit(self._step)
            self._twiss.evolve(self._step, self._beam)

            # integrate over the beam profile and create the photons
            self._photons.create(self._step, self._beam,
                                 self._output_num_photons,
                                 self._hepevt)

            # write orbit and twiss parameters to file
            self._step.write(self._output_orbit)
            self._beam.write(self._step, self._output_twiss)

            # update progress bar
            if self._show_progress:
                progress_ds += math.fabs(self._step.ds)
                progress.update(progress_ds)

            # next ideal orbit step
            self._orbit.step_ideal_orbit(self._step)

        if self._show_progress:
            progress.finish()


    def terminate(self):
        self._output_lattice.close()
        self._output_orbit.close()
        self._output_twiss.close()
        self._output_num_photons.close()
        self._output_spectrum.close()
        self._hepevt.close()
Exemplo n.º 7
0
from core.lattice import Lattice
# ---- Pyrite ATS tensor ----- #

FeS2 = Lattice([5.417],'P a -3')

r = [0,0,0]
q = [0,1,1]
Fats = FeS2.genTensor(r,q)

print(Fats)