def main(): from bem import matter # FCC atoms = [ matter.Atom('Ni', (0, 0, 0)), matter.Atom('Ni', (0.5, 0.5, 0)), matter.Atom('Ni', (0.5, 0, 0.5)), matter.Atom('Ni', (0, 0.5, 0.5)) ] # a=3.5238 a = 3.60 # this is inferred from the d-spacing values in the original fortran file alpha = 90. lattice = matter.Lattice(a=a, b=a, c=a, alpha=alpha, beta=alpha, gamma=alpha) fccNi = matter.Structure(atoms, lattice, sgid=225) compute( fccNi, tex='xqg.tex', N_RD=36, N_HD=144, out='int_samples.dat', max_hkl_index=5, ) return
import pytest pytest.importorskip("matlab") import os, numpy as np here = os.path.dirname(__file__) infile = os.path.join(here, '..', 'data', 'vdrive_filename.txt') interm = 'vulcan.intermediate' rpffile = 'vulcan.rpf' vpscfile = 'vpsc.txt' hkls = [[1,1,1], [2,0,0], [2,2,0], [2,2,2]] Rsamples_file = 'Rsamples.dat' from bem import matter # FCC atoms = [matter.Atom('Ni', (0,0,0)), matter.Atom('Ni', (0.5, 0.5, 0)), matter.Atom('Ni', (0.5,0,0.5)), matter.Atom('Ni', (0, 0.5, 0.5))] # a=3.5238 a=3.60 # this is inferred from the d-spacing values in the original fortran file alpha = 90. lattice = matter.Lattice(a=a, b=a, c=a, alpha=alpha, beta=alpha, gamma=alpha) fccNi = matter.Structure(atoms, lattice, sgid=225) def test1(): # vdrive_filename.txt -> vulcan.rpf from bem.texture.preparation.vdrive_handler import VDriveHandler from bem.texture.preparation.vdrive_to_mtex import VDriveToMtex o_vdrive = VDriveHandler(filename = infile) o_vdrive.run() o_vdrive.export(filename = interm)
#!/usr/bin/env python # Jiao Lin <*****@*****.**> interactive = False import numpy as np from bem import xscalc, diffraction, matter atoms = [ matter.Atom('Ni', (0,0,0), occupancy=0.5), matter.Atom('Ni', (0.5, 0.5, 0), occupancy=0.5), matter.Atom('Ni', (0.5,0,0.5), occupancy=0.5), matter.Atom('Ni', (0, 0.5, 0.5), occupancy=0.5), matter.Atom('Cr', (0,0,0), occupancy=0.5), matter.Atom('Cr', (0.5, 0.5, 0), occupancy=0.5), matter.Atom('Cr', (0.5,0,0.5), occupancy=0.5), matter.Atom('Cr', (0, 0.5, 0.5), occupancy=0.5), ] a=3.5238 alpha = 90. lattice = matter.Lattice(a=a, b=a, c=a, alpha=alpha, beta=alpha, gamma=alpha) NiCr = matter.Structure(atoms, lattice, sgid=225) def test(): lambdas = np.arange(0.05, 5.5, 0.001) T = 300 calc = xscalc.XSCalculator(NiCr, T, max_diffraction_index=1) assert np.isclose(calc.coh_xs, ((10.3+3.635)/2)**2*4*np.pi/100) assert np.isclose(calc.inc_xs, 4*np.pi*((10.3**2+3.635**2)/2.-((10.3+3.635)/2.)**2)/100. + (5.2+1.83)/2) return def main(): global interactive interactive = True test()
#!/usr/bin/env python # Jiao Lin <*****@*****.**> interactive = False import os, numpy as np from bem import xscalc, diffraction, matter thisdir = os.path.dirname(__file__) atoms = [ matter.Atom('Ni', (0, 0, 0), occupancy=0.5444), matter.Atom('Ni', (0.5, 0.5, 0), occupancy=0.5444), matter.Atom('Ni', (0.5, 0, 0.5), occupancy=0.5444), matter.Atom('Ni', (0, 0.5, 0.5), occupancy=0.5444), matter.Atom('Fe', (0, 0, 0), occupancy=0.20685), matter.Atom('Fe', (0.5, 0.5, 0), occupancy=0.20685), matter.Atom('Fe', (0.5, 0, 0.5), occupancy=0.20685), matter.Atom('Fe', (0, 0.5, 0.5), occupancy=0.20685), matter.Atom('Cr', (0, 0, 0), occupancy=0.22925), matter.Atom('Cr', (0.5, 0.5, 0), occupancy=0.22925), matter.Atom('Cr', (0.5, 0, 0.5), occupancy=0.22925), matter.Atom('Cr', (0, 0.5, 0.5), occupancy=0.22925), matter.Atom('Mo', (0, 0, 0), occupancy=0.01953), matter.Atom('Mo', (0.5, 0.5, 0), occupancy=0.01953), matter.Atom('Mo', (0.5, 0, 0.5), occupancy=0.01953), matter.Atom('Mo', (0, 0.5, 0.5), occupancy=0.01953) ] a = 3.61 alpha = 90. lattice = matter.Lattice(a=a, b=a, c=a, alpha=alpha, beta=alpha, gamma=alpha) mat = matter.Structure(atoms, lattice, sgid=225)