haslib package¶
Submodules¶
haslib.CC module¶
-
haslib.CC.
CC_2D_old
(h, a, D, xi, Ei, theta_i, G1, G2, G_ope=-1, G_clo=0, sta_z=-7.000000000000001e-10, end_z=2e-09, st_p_wl=150, CC_border=1e-07, write_P=False, maxrad=20, verbose=False, m=5.0082343984338715e-27)[source]¶ One-dimensional scattering intensity calculation Integrating the CC equations using the Fox-Goodwin integrator
The potential functions is assumed to be a Morse function
Parameters: - h – Corrugation parameter
- a – 1D lattice constant (in meter)
- D – depth of the surface averaged interaction potential (in joule)
- xi – stiffness parameter of the surface averaged interaction potential (in m**-1)
- Ei – energy of the impinging helium beam (in joule)
- theta_i – incident scattering angle of the helium beam with respect to the surface normal (in degrees)
- G1 – reciprocal lattice vector 1 (in m**-1)
- G2 – reciprocal lattice vector 2 (in m**-1)
- G_ope – number of open channels to be considered in the calculation (-1 for all)
- G_clo – number of closed channels to be considered in the calculation (-1 for all)
- sta_z – z-position where the integration should start (in meter)
- end_z – z-position where the integration should end (in meter)
- st_p_wl – number of iteration steps to be done within the shortest occuring wavelength
- CC_border – lowest value for a coupling factor to be considered
- write_P – boolean value stating if the wavefunctions should be kept and returned (not fully implemented)
Returns: Scattering intensities listed by channels following the scheme:
[[Gx1, Gy1, I1, kz2_1] [Gx2, Gy2, I2, kz2_2] [Gx3, Gy3, I3, kz2_3] [... ... ... ... ]]
(only listing open channels)
or an array containing the values of the channel’s wavefunctions is returned if write_P was set to ‘TRUE’ (not implemented yet)
Return type: array
-
haslib.CC.
calc_coupl_2d_hex
(a, h, xi, G1, G2, div=1.0)[source]¶ Calculate coupling factors
Parameters: - a – Edge length of the primitive cell hexagon (in meters)
- h – Corrugation parameter of the cosine corrugation function
- xi – Stiffnes parameter of the corrugated morse parameter (in m**-1)
- G1 – First index of G-Vector to the channel
- G2 – Second index of G-Vector to the channel
- div – divison parameter - The solution will be divided by this number
Returns: Coupling factor from (0,0) to (G1,G2)
Return type: scalar
haslib.apparatus_class module¶
-
class
haslib.apparatus_class.
Apparatus
(sample, nozzletemp=75.0, TSD=91.5, xcd=1.643, xcs=0.529, xsd=1.114, m=6.646473561503999e-27)[source]¶ Bases:
object
-
analyze_elastic
(El_obj, zoom=10.0, resplflag=True, useaxes=None, elastic_only=False, fontsize=10)[source]¶ Function to plot the outcome of an elastic measurement with the calculated resonance positions
-
analyze_tof
(Tof_obj, ret_fig=False, upper=0, textpos=0, useaxes=None, mode='new')[source]¶ Function to plot the TOF measurement with the calculated resonance positions
-
phonlog
(Tofobj)[source]¶ Measurement routine to fit and log the positions of phonon peaks in a TOF energy signature. The given Object must be a transformed TOF measurement.
-
predict_boundstates
(angles, direction)[source]¶ Calculate boundstate energies
Parameters: - angles – List of angles where SARs are found in degree
- direction – Tuple of two indexes in the direction of
- measurement (the) –
Yields: scalar – bound state energy in meV
-
prettyprint_analyze_tof
(TOF_obj, path_to_structuregraph=None, ylim=30, samplename='Bi$_2$Se$_3$(111)')[source]¶ Function to plot the TOF measurements according to Prof. Benedek’s wishes
-
sim_elastic_measurement
(G1, G2, resflag=False, plotit=True, fullout=False)[source]¶ Simulate an elastic measurement in the <G1, G2> direction.
Parameters: - G2 (G1,) – Direction in which the measurement should
- performed (be) –
- resflag – Boolean Flag to turn the calculation of resonance
- on and off (positions) –
- plotit – Boolean Flag to turn the plot off
- fullout – Boolean Flag to turn the output of expected angles on
-
sim_tof_measurement
(G1, G2, angin, resflag=True, plotit=False, fullout=True)[source]¶ Simulate inelastic TOF measurement in the <G1, G2> direction
Parameters: - resflag – Boolean flag to turn the calculation of resonance
- on and off. Without this, only the (positions) –
- position of the diffuse elastic peak (expected) –
- calculated (is) –
- G2 (G1,) – Reciprocal orientation of the crystal
- angin – Angle of the incoming beam
- plotit – Boolean flag to turn plotting on and off
- fullout – Boolean flag to turn
-
haslib.azimuthal_scan module¶
-
class
haslib.azimuthal_scan.
AzimuthalScan
[source]¶ Bases:
object
-
rotate
(ang, vec)[source]¶ rotate the 2D vector vec by angle ang
Parameters: - ang – angle in radians
- vec – 2D vector
Returns: rotated vector
Return type: array
-
run
(e, phi, theta, pot, cpus=1, **ccargs)[source]¶ calculate the spec intensity for a grid of e und phi
Parameters: - e – energy
- phi – phi in degrees
- theta – theta in degrees
- pot – Potential (class:Morse)
- cpus – cpus to use for Pool call
- **ccargs – optional iCC parameters(see icc_2d_2)
Returns: array with energy, azimuthal angle and intensity.
[[energy_1,angle_1,intensity_1], [energy_2,angle_2,intensity_2], ... [energy_n,angle_n,intensity_n]]
every row ist calculated by the worker method
Return type: array
-
-
haslib.azimuthal_scan.
worker
(p_arr)[source]¶ Simulate a specific point using the given arguments
Parameters: p_arr – tuple containing the following parameters(in order)
- energy: energy of the beam
- phi: azimuth angle
- g_x: reciprical vector 1
- g_y: recpiprical vector 2
- pot: potential class (Morse)
- theta: incident angle
- kwargs: extra arguments for iCC_2D_2
Returns: array with one row containing energy, azimuthal angle and scattered intensity Return type: array
haslib.cc2d_ext module¶
-
haslib.cc2d_ext.
CC_2D_e
(Ei, theta_i, G1, G2, potential, z, G_ope=-1, G_clo=0, write_P=False)[source]¶ One-dimensional scattering intensity calculation Integrating the CC equations using the Fox-Goodwin integrator
The potential functions is assumed to be a Morse function
Parameters: - Ei – energy of the impinging helium beam (in joule)
- theta_i – incident scattering angle of the helium beam
- respect to the surface normal (with) –
- G1 – reciprocal lattice vector 1 (in m**-1)
- G2 – reciprocal lattice vector 2 (in m**-1)
- G_ope – number of open channels to be considered in the
- calculation (-1 for all) –
- G_clo – number of closed channels to be considered in the
- calculation –
- potential –
- z – array containing z values
- write_P – boolean value stating if the wavefunctions should
- kept and returned (be) –
Returns: Scattering intensities listed by channels following the scheme:
[[Gx1, Gy1, I1, kz2_1] [Gx2, Gy2, I2, kz2_2] [Gx3, Gy3, I3, kz2_3] [... ... ... ... ]]
(only listing open channels) or array containing the values of the channel’s wavefunctions, if write_P was set to ‘TRUE’ (not implemented yet)
Return type: array
haslib.cc2d_new module¶
-
haslib.cc2d_new.
CC_2D
(h, a, D, xi, Ei, theta_i, G1, G2, G_ope=-1, G_clo=0, sta_z=-7.000000000000001e-10, end_z=2e-09, st_p_wl=150, CC_border=1e-07, write_P=False, verbose=False, maxrad=20, m=5.0082343984338715e-27)[source]¶ One-dimensional scattering intensity calculation Integrating the CC equations using the Fox-Goodwin integrator
The potential functions is assumed to be a Morse function
Parameters: - h – Corrugation parameter
- a – 1D lattice constant (in meter)
- D – depth of the surface averaged interaction potential (in joule)
- xi – stiffness parameter of the surface averaged interaction potential (in m**-1)
- Ei – energy of the impinging helium beam (in joule)
- theta_i – incident scattering angle of the helium beam with respect to the surface normal (in degrees)
- G1 – reciprocal lattice vector 1 (in m**-1)
- G2 – reciprocal lattice vector 2 (in m**-1)
- G_ope – number of open channels to be considered in the calculation (-1 for all)
- G_clo – number of closed channels to be considered in the calculation (-1 for all)
- sta_z – z-position where the integration should start (in meter)
- end_z – z-position where the integration should end (in meter)
- st_p_wl – number of iteration steps to be done within the shortest occuring wavelength
- CC_border – lowest value for a coupling factor to be considered
- write_P – boolean value stating if the wavefunctions should be kept and returned (not fully implemented)
Returns: Scattering intensities listed by channels following the scheme:
[[Gx1, Gy1, I1, kz2_1], [Gx2, Gy2, I2, kz2_2], [Gx3, Gy3, I3, kz2_3]]
(only listing open channels)
or an array containing the values of the channel’s wavefunctions, returned if write_P was set to ‘TRUE’ (not implemented yet)
Return type: array
-
haslib.cc2d_new.
calc_coupl_2d_hex
(a, h, xi, G1, G2, div=1.0)[source]¶ Calculate coupling factors between (0,0) and (G1,G2)
Parameters: - a – Edge length of the primitive cell hexagon (in meters)
- h – Corrugation parameter of the cosine corrugation function
- xi – Stiffnes parameter of the corrugated morse parameter (in m**-1)
- G1 – First index of G-Vector to the channel
- G2 – Second index of G-Vector to the channel
- div – divison parameter - The solution will be divided by this number
Returns: Coupling factor from (0,0) to (G1,G2)
Return type: scalar
haslib.convergence module¶
-
haslib.convergence.
auto_conv
(D, xi, h, beam, theta, crystal, maxrad=20, cpus=1, m=6.646473561503999e-27, error=1e-07, gclosemax=70, st_p_wl_max=120, zrange=(20, 50), peak=(0, 0), verbose=False, rel=False)[source]¶ Find convergent parameter z, gclose and steps per wavelength
Parameters: - D – potentialdepth in meV
- xi – stiffness in 1/A
- h – corrugation
- beam – beam energy in meV
- theta – in degrees
- crystal – Crystal class see haslib.crystal_class
- maxrad – max radius(Default: 20)
- cpus – cpus to use in worker Pool(Default: 1)
- m – beam mass(Default: m_He4)
- error – minimum accuracy(Default: 1e-7)
- gclosemax – maximum closed channels to check(Default: 70)
- st_p_wl_max – maximum steps per wavelength to check(Default: 120)
- zrange – tuple of (start_z, end_z) to check in A(Default: (20, 50))
- peak – tuple of two indices for g1 and g2(Default: (0, 0))
- verbose – show results for each iteration(Default: False)
- rel – use error as relative error(Default: False)
Returns: array(peak_intensity, gclose, end_z, start_z, st_p_wl)
Return type: array
haslib.corrugation module¶
-
haslib.corrugation.
get_alpha
(D, E, theta, slope, m, TSD)[source]¶ calculate Td**2 * M from Deybe Waller measurement for a given D
-
haslib.corrugation.
sigma_area
(param)[source]¶ calculate error function between measurement and simulation
-
haslib.corrugation.
signal_per_spectrum
(spectrum, D, xi, h, a, z, gclose, alpha, m, TSD, st_p_wl)[source]¶ Calculate signal for each peak in a spectrum
Parameters: - spectrum – Spectrum class
- D – Depth of the Potential
- xi – Potential parameter
- h – corrugation
- a – lattice constant
- z – (min, max)
- gclose – closed channels cc
- alpha – Mass_sample * debye temp ** 2
- m – mass of the beam
- TSD – angle between source and detector
- st_p_wl – steps per wavelength
Returns: array each row containing the g1, g2, corrected signal and peak.area
Return type: array
haslib.crystal_class module¶
-
class
haslib.crystal_class.
Crystal
(a1, a2, ang, name='set sample name in crystal class')[source]¶ Bases:
object
-
givevec
(G1, G2)[source]¶ Function to return the x and y coordinates of a Gvec in the current orientation
-
haslib.elas_class module¶
haslib.icc_2d module¶
-
haslib.icc_2d.
calc_gauss_legendre
(wD, n)[source]¶ calculate positions and width for gauss legendre integration wD Integrate from -wD to wD n order of Legendre polynomial to use return array of phonon ernergies
-
haslib.icc_2d.
get_iCC_elastics
(phon_E, h, AP, a, D, xi, Ei, theta_i, G1, G2, G_ope, G_clos, floq=1, sta_z=-7.000000000000001e-10, end_z=2e-09, st_p_wl=150, CC_border=1e-07, write_P=False, verbose=False, only_int=True)[source]¶
-
haslib.icc_2d.
get_iCC_specs
(phon_E, h, AP, a, D, xi, Ei, theta_i, G1, G2, G_ope, G_clos, floq=1, sta_z=-7.000000000000001e-10, end_z=2e-09, st_p_wl=150, CC_border=1e-07, write_P=False, verbose=False, only_int=True)[source]¶ return array of specular intensites for every floque block
-
haslib.icc_2d.
iCC_2D
(h, AP, a, D, xi, Ei, theta_i, G1, G2, Gope=-1, Gclo=0, phon=[0, 0, 0], floq=1, sta_z=-7.000000000000001e-10, end_z=2e-09, st_p_wl=150, CC_border=1e-07, write_P=False, verbose=False, m=5.0082343984338715e-27, maxrad=20)[source]¶ Two-dimensional calculation of scattering intensities, taking inelastic contributions into account. The CC-calculation is done using a Fox-Goodwin integrator The potential function is assumed to be a Corrugated Morse shape
Patrick Kraus 06.Feb.2014 email: patrick.kraus@tugraz.at
Parameters: - h – Corrugation Parameter
- AP – Inelastic coupling Parameter
- a – 1D lattice constant (in meter)
- D – Potential depth (in joule)
- xi – Potential stiffnes of the central morse potential (in m**-1)
- Ei – Incident helium energy (in joule)
- theta_i – Incident angle of the scattering (in degrees)
- G1 – Reciprocal lattice vector 1 (in m**-1)
- G2 – Reciprocal lattice vector 2 (in m**-1)
- Gope – Number of open channels to be considered - (Standard Value “-1” - all the channels)
- Gclo – Number of closed channels to be considered - (Standard Value “0”)
- phon – Array carrying the phonon values array([Kval_x, Kval_y, Eval])
- floq – Number of Floquet Blocks on both sides - default value is 1
- sta_z – starting value of the numerov interation (in meter) - (Standard Value “7.0*A”)
- end_z – terminal value of the numerov interation (in meter) - (Standard Value “20.0*A”)
- st_p_wl – Number of steps to be performed in the interation within the length of the shortest calculated wavelength - (Standard Value “150”)
- CC_border – Minimum value for the coupling parameters to be considered - (Standard Value “1E-7”)
- write_P – Boolean Flag to determine if the wavefunctions will be written and returned (Standard Value - “False”)
- verbose – Boolean Flag to signal if Parameter Information should be displayed - (Standard Value “False”)
Returns: Scattering Intensities sorted by channels and Floquet Blocks (basically by energy)
[[Gx1 , Gx2 , Gx3 , ...], [Gy1 , Gy2 , Gy3 , ...], [F1 , F2 , F3 , ...], [Kx1 , Kx2 , Kx3 , ...], [Ky1 , Ky2 , Ky3 , ...], [Kz2_1, Kz2_2, Kz2_3, ...], [I1 , I2 , I3 , ...]]
Only considering open channels or array, holding the wavefunctions of the open channels in its rows, if the “write_P” Flag is set.
Return type: array
References
[1] A.S. Sanz and S. Miret-Artes - Selective Adsorption Resonances: Quantum And Stochastic Approaches, Phys. Rep. 451 (2007), 37-154 [2] - Miret-Artes - Multiphonon contributions to diffracted intensities and resonance profiles in atom-surface scattering, Surf. Sci. 366 (1996), L681-L684
[3] - Miret-Artes - Resonant inelastic scattering of atoms from surfaces, Surf. Sci. 339 (1995), 205-220
-
haslib.icc_2d.
integr_el_intensity
(h, AP, a, D, xi, Ei, theta_i, G1, G2, G_ope, G_clo, floq=1, sta_z=-7.000000000000001e-10, end_z=2e-09, st_p_wl=150, CC_border=1e-07, write_P=False, verbose=False, wD=1.6021766207999999e-21, n_leg=10)[source]¶
-
haslib.icc_2d.
integrate_GL
(a, b, f, n=10, cpus=None, args=[])[source]¶ integrate f from a to b using n net points Method: Gauss-Legendre quadrature
f can return a 2d array and the integration will be per element
-
haslib.icc_2d.
integrate_spec_int
(h, AP, a, D, xi, Ei, theta_i, G1, G2, G_ope, G_clo, floq=1, sta_z=-7.000000000000001e-10, end_z=2e-09, st_p_wl=150, CC_border=1e-07, write_P=False, verbose=False, wD=1.6021766207999999e-21, n_leg=10)[source]¶
-
haslib.icc_2d.
two_D_el_coupling
(a, h, xi, G1, G2, div=1.0)[source]¶ Calculate coupling factor
Parameters: - a – Edge length of the primitive cell hexagon (in meters)
- h – Corrugation Parameter of the cosine corrugation function
- xi – Stiffnes parameter of the corrugated morse parameter (in m**-1)
- G1 – First index of G-Vector to the channel
- G2 – Second index of G-Vector to the channel
- div – divison parameter - The solution will be divided by this number
- Results:
- scalar: Coupling factor from (0,0) to (G1,G2)
haslib.icc_2d_2 module¶
-
haslib.icc_2d_2.
centr_pot_dev
()¶
-
haslib.icc_2d_2.
iCC_2D_2
()¶ Two-dimensional calculation of scattering intensities, taking inelastic contributions into account. The CC-calculation is done using a Fox-Goodwin integrator The potential function is assumed to be a Corrugated Morse shape
Patrick Kraus 06.Feb.2014 email: patrick.kraus@tugraz.at
Parameters: - h – Corrugation Parameter
- AP – Inelastic coupling Parameter
- a – 1D lattice constant (in meter)
- D – Potential depth (in joule)
- xi – Potential stiffnes of the central morse potential (in m**-1)
- Ei – Incident helium energy (in joule)
- theta_i – Incident angle of the scattering (in degrees)
- G1 – Reciprocal lattice vector 1 (in m**-1)
- G2 – Reciprocal lattice vector 2 (in m**-1)
- Gope – Number of open channels to be considered - (Standard Value “-1” - all the channels)
- Gclo – Number of closed channels to be considered - (Standard Value “0”)
- phon – Array carrying the phonon values array([Kval_x, Kval_y, Eval])
- floq – Number of Floquet Blocks on both sides - default value is 1
- sta_z – starting value of the numerov interation (in meter) - (Standard Value “7.0*A”)
- end_z – terminal value of the numerov interation (in meter) - (Standard Value “20.0*A”)
- st_p_wl – Number of steps to be performed in the interation within the length of the shortest calculated wavelength - (Standard Value “150”)
- CC_border – Minimum value for the coupling parameters to be considered - (Standard Value “1E-7”)
- write_P – Boolean Flag to determine if the wavefunctions will be written and returned (Standard Value - “False”)
- verbose – Boolean Flag to signal if Parameter Information should be displayed - (Standard Value “False”)
- Results:
array: Scattering Intensities sorted by channels and Floquet Blocks (basically by energy)
[[Gx1 , Gx2 , Gx3 , ...], [Gy1 , Gy2 , Gy3 , ...], [F1 , F2 , F3 , ...], [Kx1 , Kx2 , Kx3 , ...], [Ky1 , Ky2 , Ky3 , ...], [Kz2_1, Kz2_2, Kz2_3, ...], [I1 , I2 , I3 , ...]]
(Only considering open channels)
or Array, holding the wavefunctions of the open channels in its rows, if the “write_P” Flag is set.
References
[1] A.S. Sanz and S. Miret-Artes - Selective Adsorption Resonances: Quantum And Stochastic Approaches, Phys. Rep. 451 (2007), 37-154 [2] - Miret-Artes - Multiphonon contributions to diffracted intensities and resonance profiles in atom-surface scattering, Surf. Sci. 366 (1996), L681-L684
[3] - Miret-Artes - Resonant inelastic scattering of atoms from surfaces, Surf. Sci. 339 (1995), 205-220
haslib.morse module¶
-
class
haslib.morse.
Morse
(crystal, h, xi, D)[source]¶ Bases:
object
-
calc_coupl_2d_hex
(a, h, xi, G1, G2, div=1.0)[source]¶ Calculate coupling factor
Parameters: - a – Edge length of the primitive cell hexagon (in meters)
- h – Corrugation parameter of the cosine corrugation function
- xi – Stiffnes parameter of the corrugated morse parameter (in m**-1)
- G1 – First index of G-Vector to the channel
- G2 – Second index of G-Vector to the channel
- div – divison parameter - The solution will be divided by this number
Returns: Coupling factor from (0,0) to (G1,G2)
Return type: scalar
-
haslib.science_basics module¶
basic variables
-
haslib.science_basics.
A
= 1e-10¶ Angstroem in meters
-
haslib.science_basics.
gigagauss
(p, sectx)[source]¶ Funktion to model a more complex signal using a threshold, a peak at dE=0 and several gauss functions given in p
-
haslib.science_basics.
gigagauss_generic
(p, sectx)[source]¶ Funktion to model a more complex signal using only several gauss functions given in p
-
haslib.science_basics.
prettyprint_elas
(CONTAINER)[source]¶ prettyprint(CONTAINER)
CONTAINER … output of sim_elastic measurement
Function to provide easy-to-read access to the relevant elastic positions Patrick Kraus, 11.09.2012
-
haslib.science_basics.
scanc
(TN, theta, GG=14583570019.449413, TSD=91.75, m=6.646473561503999e-27)[source]¶ calculate the scancurve @param TN: Nozzle Temp in K @param theta: incident angle in degrees @param GG: Brillouin zone boundary in 1/m @param TSD: Source detector angle in degrees @param m: beam mass im kg @return: tuple of Q and E in 1e9 1/m and meV