def get_cs(): import pyasf sp = pyasf.sp np = pyasf.np delta_1 = sp.Symbol("delta_Ti", real=True) delta_2 = sp.Symbol("delta_O1", real=True) delta_3 = sp.Symbol("delta_O2", real=True) cs = pyasf.unit_cell(SpaceGroup) cs.add_atom("Sr1", (0,0,0), 1, dE=-2) cs.add_atom("Ti1", (sp.S("1/2"),sp.S("1/2"),sp.S("1/2") - delta_1), 1, dE=14.5) cs.add_atom("O1", (sp.S("1/2"),sp.S("1/2"),0 + delta_2), 1) cs.add_atom("O2", (sp.S("1/2"),0,sp.S("1/2") + delta_3), 1) cs.subs[cs.a] = 3.9998 cs.subs[cs.c] = 4.0180 cs.subs[delta_1] = 0.018 cs.subs[delta_2] = 0.016 cs.subs[delta_3] = 0.015 cs.get_tensor_symmetry() cs.build_unit_cell() return cs
def get_cs(): import pyasf sp = pyasf.sp cs = pyasf.unit_cell(SpaceGroup) delta = sp.Symbol("delta", real=True, nonnegative=True) x = sp.Symbol("x", real=True, nonnegative=True) cs.add_atom("Y", (sp.S(0.1344), sp.S(0.1687), 0), 1) cs.add_atom("FeP", (sp.S(0.3898), sp.S(0.3534), sp.S("1/2")), 0, occupancy = x*delta) # 4h pyramidal position cs.add_atom("MnP", (sp.S(0.3898), sp.S(0.3534), sp.S("1/2")), 0, occupancy = 1 - x*delta) # 4h pyramidal position cs.add_atom("FeO", (0, sp.S("1/2"), sp.S(0.251)), 0, occupancy = x * (1 - delta)) # 4f octahedral position cs.add_atom("MnO", (0, sp.S("1/2"), sp.S(0.251)), 0, occupancy = 1 - x * (1 - delta)) # 4f octahedral position cs.add_atom("O1", (0, 0, sp.S(0.260)), 1) cs.add_atom("O2", (sp.S(0.1601), sp.S(0.4417), 0), 1) cs.add_atom("O3", (sp.S(0.1523), sp.S(0.4291), sp.S("1/2")), 1) cs.add_atom("O4", (sp.S(0.3930), sp.S(0.2028), sp.S(0.2415)), 1) cs.get_tensor_symmetry() cs.build_unit_cell() cs.subs[cs.a]=7.3121 cs.subs[cs.b]=8.5397 cs.subs[cs.c]=5.7115 return cs
def get_cs(): import pyasf sp = pyasf.sp np = pyasf.np delta_1 = 0 delta_2 = 0 delta_3 = 0 cs = pyasf.unit_cell(SpaceGroup) cs.add_atom("Sr", (0,0,0), 1, dE=-4) cs.add_atom("Ti", (sp.S("1/2"),sp.S("1/2"),sp.S("1/2") - delta_1), 1, dE=14.5) cs.add_atom("O1", (sp.S("1/2"),sp.S("1/2"),0 + delta_2), 1) cs.add_atom("O2", (sp.S("1/2"),0,sp.S("1/2") + delta_3), 1) cs.subs[cs.a] = 3.905 - 1.3e-4 cs.subs[cs.c] = 3.905 + 5e-3 cs.subs[delta_1] = 0.0 cs.subs[delta_2] = 0.0 cs.subs[delta_3] = 0.0 cs.get_tensor_symmetry() cs.build_unit_cell() return cs
def get_cs(): import pyasf sp = pyasf.sp cs = pyasf.unit_cell(ciffile) cs.get_tensor_symmetry() cs.build_unit_cell() return cs
def get_cs(T = 298., LT = False): import pyasf sp = pyasf.sp if LT: ciffile = "cif/RDP_orthorhombic_146K.cif" ciffile = os.path.join(os.path.split(__file__)[0], ciffile) cs = pyasf.unit_cell(ciffile, resonant="Rb") else: ciffile = "cif/RDP_tetragonal_RT.cif" ciffile = os.path.join(os.path.split(__file__)[0], ciffile) cs = pyasf.unit_cell(ciffile, resonant="Rb") alpha_x = 0.0002262773722627715 # expansion coefficient alpha_z = 0.0004233576642335819 # expansion coefficient cs.subs[cs.a] += alpha_x * (T - 298.) cs.subs[cs.c] += alpha_z * (T - 298.) cs.get_tensor_symmetry() cs.build_unit_cell() return cs
def get_cs(): import pyasf sp = pyasf.sp x = sp.Symbol("x", real=True, unbounded=False) cs = pyasf.unit_cell(SpaceGroup) cs.add_atom("Ti", (0,0,0), 0) cs.add_atom("O", (x, x, 0), 1) cs.subs[cs.a]=4.5924 cs.subs[cs.c]=2.9575 cs.subs[x]=0.30499 cs.get_tensor_symmetry() cs.build_unit_cell() return cs
def get_cs(): import pyasf sp = pyasf.sp cs = pyasf.unit_cell(SpaceGroup) cs.add_atom("Ti", (0,0.3048,sp.S("1/2")), 0) cs.add_atom("O1", (0,0.2208,0), 1) cs.add_atom("O2", (0,0.3619,0), 1) cs.add_atom("N", (0,0, 0.230), 1) cs.get_tensor_symmetry() cs.build_unit_cell() cs.subs[cs.a]=3.7926 cs.subs[cs.b]=18.458 cs.subs[cs.c]=2.9774 return cs
def get_cs(**kwargs): sp = pyasf.sp np = pyasf.np cs = pyasf.unit_cell(SpaceGroup) cs.add_atom("Li", (0, 0, 0.2821), 1, assume_complex=True) cs.add_atom("Ta", (0, 0, 0), 0, assume_complex=True) cs.add_atom("O", (0.0534, 0.3396, 0.0695), 1, assume_complex=True) cs.subs[cs.a] = 5.15428 cs.subs[cs.c] = 13.7835 if "temperature" in kwargs: fac = TExp(kwargs["temperature"]) cs.subs[cs.a] *= fac[0,0] cs.subs[cs.c] *= fac[2,2] cs.get_tensor_symmetry() cs.build_unit_cell() return cs
def get_cs(**kwargs): import pyasf sp = pyasf.sp cs = pyasf.unit_cell(SpaceGroup) cs.add_atom("Li", (0, 0, 0.2829), 1) cs.add_atom("Nb", (0, 0, 0), 0) cs.add_atom("O", (0.0492, 0.3446, 0.0647), 1) cs.subs[cs.a] = 5.14829 cs.subs[cs.c] = 13.8631 if "temperature" in kwargs: fac = TExp(kwargs["temperature"]) cs.subs[cs.a] *= fac[0,0] cs.subs[cs.c] *= fac[2,2] cs.get_tensor_symmetry() cs.build_unit_cell() return cs
os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl data = pl.loadtxt("test13.dat") data[:, 0] = pl.radians(data[:, 0]) #pl.ion() R = 0, 0, 2 thickness = 1000 Energy = 10000 #struct = pyasf.unit_cell("1011117") struct1 = pyasf.unit_cell("1011117") #MgO struct2 = pyasf.unit_cell("1011117") struct2.subs[struct2.a] *= 1.01 #strained layer Sub = reflectivity.Substrate(struct1) v_par = sp.Matrix([3, -2, -1]) v_perp = sp.Matrix([1, 1, 1]) Sub.calc_orientation(v_par, v_perp) #Sub.set_Miller(R) layer1 = reflectivity.Epitaxial_Layer(struct2, thickness) layer1.calc_orientation(v_par, v_perp) crystal = reflectivity.Sample(Sub, layer1) crystal.set_Miller(R) #crystal.calc_layer_Miller() crystal.calc_g0_gH(Energy) thBragg = float(Sub.calc_Bragg_angle(Energy).subs(Sub.structure.subs).evalf()) angle = pl.linspace(0.99, 1.01, 501) * thBragg
os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl data = pl.loadtxt("test4.dat") data[:,0] = pl.radians(data[:,0]) #pl.ion() R = 0,0,4 thickness=1000 Energy=10000 #struct = pyasf.unit_cell("1011169") struct = pyasf.unit_cell("1011117") #MgO Sub=reflectivity.Substrate(struct) v_par=sp.Matrix([1,-1,0]) v_perp=sp.Matrix([1,1,1]) Sub.calc_orientation(v_par, v_perp) layer1=reflectivity.Epitaxial_Layer(struct, thickness) layer1.calc_orientation(v_par, v_perp) crystal=reflectivity.Sample(Sub, layer1) crystal.set_Miller(R) crystal.calc_g0_gH(Energy) thBragg= float(layer1.calc_Bragg_angle(Energy).subs(layer1.structure.subs).evalf()) angle=pl.linspace(0.997, 1.003,501)*thBragg crystal.calc_reflectivity(angle, Energy) layer1.calc_amplitudes(angle, Energy) Sub.calc_amplitudes(angle, Energy)
def my_strain_profile(strainmax, straindepth, xmax=25, npoints=501): x=np.linspace(0, xmax, 801) strain=(strainmax*np.exp(-x)*(1+x))[::-1] strain=np.delete(strain, 0) return x*straindepth, strain #pl.plot(tvector[1:], strain[::-1]) #pl.show() Energy=8000 structsub = pyasf.unit_cell("1512124") #BaTiO3 structsub.get_tensor_symmetry() structsub.build_unit_cell() structsub.subs[structsub.a] = 3.9064 Sub=reflectivity.Substrate(structsub) struct1=pyasf.unit_cell("1525437") struct1.add_atom("Sr", [0,0,0]) struct1.AU_positions.pop("Ba1") struct1.AU_formfactors.pop("Ba1") struct1.U.pop("Ba1") struct1.get_tensor_symmetry() struct1.build_unit_cell()
import os os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl data = pl.loadtxt("test8.dat") data[:,0] = pl.radians(data[:,0]) #pl.ion() R = 0,0,1 thickness=1000 Energy=10000 struct = pyasf.unit_cell("1507756") #Ba O3 Ti Sub=reflectivity.Substrate(struct) v_par=sp.Matrix([1,0,0]) v_perp=sp.Matrix([0,0,1]) Sub.calc_orientation(v_par, v_perp) layer1=reflectivity.Epitaxial_Layer(struct, thickness) layer1.calc_orientation(v_par, v_perp) crystal=reflectivity.Sample(Sub, layer1) crystal.set_Miller(R) crystal.calc_g0_gH(Energy) thBragg= float(layer1.calc_Bragg_angle(Energy).subs(layer1.structure.subs).evalf()) angle=pl.linspace(0.98, 1.02,501)*thBragg crystal.calc_reflectivity(angle, Energy) layer1.calc_amplitudes(angle, Energy) Sub.calc_amplitudes(angle, Energy)
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> import pylab import pyasf import sympy as sp # <codecell> cs = pyasf.unit_cell("LiNbO3_R3cH_Abrahams86_ICSD_61118.cif", resonant="Nb") # <codecell> cs.AU_positions # positions in asymmetric unit # <codecell> cs.AU_formfactorsDDc["Nb1"] # cartesian representation of dipole dipole form factor tensor in asymmetric unit # <codecell> cs.get_tensor_symmetry() # apply all symmetry constraints of space group to all tensors (debye waller U_ij, f_ij) # <codecell> cs.AU_formfactorsDDc["Nb1"] # now with symmetry # <codecell>
os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl data = pl.loadtxt("test7.dat") #data[:,0] = pl.radians(data[:,0]) #pl.ion() R = 0,0,2 thickness=1000 Energy=10000 #struct = pyasf.unit_cell("1011117") struct = pyasf.unit_cell("cif/MgO_52026.cif") #MgO Sub=reflectivity.Substrate(struct) v_par=sp.Matrix([3,-2,-1]) v_perp=sp.Matrix([1,1,1]) Sub.calc_orientation(v_par, v_perp) layer1=reflectivity.Epitaxial_Layer(struct, thickness) layer1.calc_orientation(v_par, v_perp) crystal=reflectivity.Sample(Sub, layer1) crystal.set_Miller(R) crystal.calc_g0_gH(Energy) thBragg= float(layer1.calc_Bragg_angle(Energy).subs(layer1.structure.subs).evalf()) angle=pl.linspace(0.988, 1.012,501)*thBragg crystal.calc_reflectivity(angle, Energy) layer1.calc_amplitudes(angle, Energy) Sub.calc_amplitudes(angle, Energy)
strain=(strainmax*np.exp(-x)*(1+x))[::-1] strain=np.delete(strain, 0) return x*straindepth, strain #pl.plot(tvector[1:], strain[::-1]) #pl.show() fields=data.fields[1::40] Energy=np.array([float(en) for en in fields]) Q=data["Q"] structsub = pyasf.unit_cell("1512124") #BaTiO3 structsub.get_tensor_symmetry() structsub.build_unit_cell() structsub.feed_feff("ti", *feff.T) structsub.subs[structsub.a] = 3.9064 Sub=reflectivity.Substrate(structsub) struct1=pyasf.unit_cell("1525437") struct1.add_atom("Sr", [0,0,0]) struct1.AU_positions.pop("Ba1") struct1.AU_formfactors.pop("Ba1") struct1.U.pop("Ba1") struct1.get_tensor_symmetry() struct1.build_unit_cell()
os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl data = pl.loadtxt("test9.dat") #data[:,0] = pl.radians(data[:,0]) #pl.ion() R = 3, 0, 0 thickness = 1000 Energy = 10000 #struct = pyasf.unit_cell("1521772") struct = pyasf.unit_cell("cif/LiNbO3_28294.cif") #Li Nb O3 Sub = reflectivity.Substrate(struct) v_par = sp.Matrix([0, 0, 1]) v_perp = sp.Matrix([1, 0, 0]) #2,1,0 Sub.calc_orientation(v_par, v_perp) layer1 = reflectivity.Epitaxial_Layer(struct, thickness) layer1.calc_orientation(v_par, v_perp) crystal = reflectivity.Sample(Sub, layer1) crystal.set_Miller(R) crystal.calc_g0_gH(Energy) thBragg = float( layer1.calc_Bragg_angle(Energy).subs(layer1.structure.subs).evalf()) angle = pl.linspace(0.9955, 1.0045, 501) * thBragg crystal.calc_reflectivity(angle, Energy) layer1.calc_amplitudes(angle, Energy)
os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl data = pl.loadtxt("test11.dat") #data[:,0] = pl.radians(data[:,0]) #pl.ion() R = 3,0,0 thickness=1000 Energy=10000 #struct = pyasf.unit_cell("1521772") struct = pyasf.unit_cell("cif/LiNbO3_28294.cif") #Li Nb O3 Sub=reflectivity.Substrate(struct) v_par=sp.Matrix([-1,1,4])#1,0,2 v_perp=sp.Matrix([1,1,0]) #1,2,0 Sub.calc_orientation(v_par, v_perp) layer1=reflectivity.Epitaxial_Layer(struct, thickness) layer1.calc_orientation(v_par, v_perp) crystal=reflectivity.Sample(Sub, layer1) crystal.set_Miller(R) crystal.calc_g0_gH(Energy) thBragg= float(layer1.calc_Bragg_angle(Energy).subs(layer1.structure.subs).evalf()) angle=pl.linspace(0.992, 1.008,501)*thBragg crystal.calc_reflectivity(angle, Energy)
R = 0,0,2 xmax=25 strainmax=0.0106 t=.62*1e4 x=np.linspace(0, xmax, 101) strain=(strainmax*np.exp(-x)*(1+x))[::-1] strain=np.delete(strain, 0) tvector=(x*t) #pl.plot(tvector[1:], strain[::-1]) #pl.show() Energy=8000 structsub = pyasf.unit_cell("1507756") #BaTiO3 structsub.subs[structsub.a] = 3.9064 structsub.subs[structsub.c] = 3.9064 Sub=reflectivity.Substrate(structsub) struct1=pyasf.unit_cell("1507756") struct1.subs[struct1.a] = 3.9064 struct1.subs[struct1.c] = 3.9064 layer1=reflectivity.Strained_Layer(struct1, tvector, c=strain) psi=0 v_perp=sp.Matrix([0,0,1]) Sub.calc_orientation_from_angle(psi, v_perp) layer1.calc_orientation_from_angle(psi, v_perp)
os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl data = pl.loadtxt("test12.dat") #data[:,0] = pl.radians(data[:,0]) #pl.ion() R = 0,0,2 thickness=1000 Energy=10000 #struct = pyasf.unit_cell("1011169") struct1 = pyasf.unit_cell("1011117") #MgO struct2 = pyasf.unit_cell("1011117") struct2.subs[struct2.a] *= 1.01 #strained layer Sub=reflectivity.Substrate(struct1) v_par=sp.Matrix([1,0,0]) v_perp=sp.Matrix([0,0,1]) Sub.calc_orientation(v_par, v_perp) layer1=reflectivity.Epitaxial_Layer(struct2, thickness) layer1.calc_orientation(v_par, v_perp) crystal=reflectivity.Sample(Sub, layer1) crystal.set_Miller(R) crystal.calc_g0_gH(Energy) thBragg= float(Sub.calc_Bragg_angle(Energy).subs(Sub.structure.subs).evalf()) angle=pl.linspace(0.975, 1.006,501)*thBragg
""" Cut of Reciprocal Space Outer Batch file for pyasf.py. Written by Carsten Richter ([email protected]) """ import itertools import pylab as pl import pyasf import time mydict = dict({"Abs":abs}) cs = pyasf.unit_cell("MyBaseFileName_9837.cif") cs.get_tensor_symmetry() cs.build_unit_cell() energy = 10000. ha = pl.linspace(-2, 2, 801)*10 la = pl.linspace(-2, 2, 801)*10 Imap = 0 * ha * la[:,pl.newaxis] cs.calc_structure_factor() I0 = abs(cs.DAFS(energy, (0,0,0), force_refresh=False))**2 def gaussian(x, x0, amp, w, y0=0): return amp*pl.exp(-(x-x0)**2/(2*w**2))+y0
data = pl.loadtxt("sto_m28_ez_8_myt1_norm.dat") R = 0, 0, 2 xmax = 25 strainmax = 0.0106 t = .62 * 1e4 x = np.linspace(0, xmax, 101) strain = (strainmax * np.exp(-x) * (1 + x))[::-1] strain = np.delete(strain, 0) tvector = (x * t) #pl.plot(tvector[1:], strain[::-1]) #pl.show() Energy = 8000 structsub = pyasf.unit_cell("1507756") #BaTiO3 structsub.subs[structsub.a] = 3.9064 structsub.subs[structsub.c] = 3.9064 Sub = reflectivity.Substrate(structsub) struct1 = pyasf.unit_cell("1507756") struct1.subs[struct1.a] = 3.9064 struct1.subs[struct1.c] = 3.9064 layer1 = reflectivity.Strained_Layer(struct1, tvector, c=strain) psi = 0 v_perp = sp.Matrix([0, 0, 1]) Sub.calc_orientation_from_angle(psi, v_perp) layer1.calc_orientation_from_angle(psi, v_perp) crystal = reflectivity.Sample(Sub, layer1) crystal.set_Miller(R)
os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl data = pl.loadtxt("test6.dat") data[:, 0] = pl.radians(data[:, 0]) #pl.ion() R = 1, 1, 3 thickness = 1000 Energy = 10000 #struct = pyasf.unit_cell("1011117") struct = pyasf.unit_cell("cif/MgO_52026.cif") #MgO Sub = reflectivity.Substrate(struct) v_par = sp.Matrix([1, -1, 0]) v_perp = sp.Matrix([1, 1, 0]) Sub.calc_orientation(v_par, v_perp) layer1 = reflectivity.Epitaxial_Layer(struct, thickness) layer1.calc_orientation(v_par, v_perp) crystal = reflectivity.Sample(Sub, layer1) crystal.set_Miller(R) crystal.calc_g0_gH(Energy) thBragg = float( layer1.calc_Bragg_angle(Energy).subs(layer1.structure.subs).evalf()) angle = pl.linspace(0.995, 1.005, 501) * thBragg crystal.calc_reflectivity(angle, Energy) layer1.calc_amplitudes(angle, Energy)
import os #os.chdir(os.path.expanduser("~/Desktop/reflectivity/dynXRD/")) import pyasf import reflectivity import sympy as sp import pylab as pl import numpy as np # Substrate structsub = pyasf.unit_cell("9008845") #GaAs Sub=reflectivity.Substrate(structsub) # Strained layers struct1=pyasf.unit_cell("9008845") #GaAs tvector=np.array([0, 3, 4.5, 5.5, 6])*1e4 strain=np.array([20, 15, 10, 5])*1e-4 layer1=reflectivity.Strained_Layer(struct1, tvector, a=strain) # Geometry of substrate and layers psi=0 v_perp=sp.Matrix([0,0,1]) Sub.calc_orientation_from_angle(psi, v_perp) layer1.calc_orientation_from_angle(psi, v_perp) # Crystal sample crystal=reflectivity.Sample(Sub, layer1) # Miller indices R = 0,0,4 crystal.set_Miller(R)
import os import pyasf import reflectivity import sympy as sp import pylab as pl import numpy as np R = 0,0,4 thickness=np.array([3, 1.5, 1, 0.5])*1e4 strain=np.array([20, 15, 10, 5])*1e-4 Energy=8048 structsub = pyasf.unit_cell("9008845") #GaAs Sub=reflectivity.Substrate(structsub) Layers=[] for i in range(4): layer=reflectivity.Epitaxial_Layer(pyasf.unit_cell("9008845"), thickness[i]) Layers.append(layer) Layers[i].structure.subs[Layers[i].structure.a]*=(1+strain[i]) psi=0 v_perp=sp.Matrix([0,0,1]) Sub.calc_orientation_from_angle(psi, v_perp) for i in range(4): Layers[i].calc_orientation_from_angle(psi, v_perp)