示例#1
0
    dataroot = sys.argv[2]
else:
    dataroot = os.path.join(os.path.dirname(__file__), 'data')

fullfilename = os.path.join(dataroot, fname)

dbf = DataBase(fullfilename)
dbf.Create('elementdata',
           'Database with elemental data from XOP and Kissel databases')

init_material_db(dbf)

# add a dummy element, this is useful not only for testing and should be
# kept in future! It can be used for structure factor calculation tests, and
# shows how the a database entry can be generated manually
dbf.SetMaterial('dummy')
dbf.SetF0([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])  # atomic structure factors
dbf.SetF1F2((0, 1e5), (0, 0), (0, 0))  # zero dispersion correction

add_mass_from_NIST(dbf, os.path.join(dataroot, 'nist_atom.dat'), verbose)
add_color_from_JMOL(dbf, os.path.join(dataroot, 'colors.dat'), verbose)
add_radius_from_WIKI(dbf, os.path.join(dataroot, 'atomic_radius.dat'), verbose)

# add F0(Q) for every element
# with lzma.open(os.path.join('data', 'f0_xop.dat.xz'), 'r') as xop:
#    add_f0_from_xop(dbf, xop, verbose)
with lzma.open(os.path.join(dataroot, 'f0_InterTables.dat.xz'), 'r') as itf:
    add_f0_from_intertab(dbf, itf, verbose)

# add F1 and F2 from database
with lzma.open(os.path.join(dataroot, 'f1f2_asf_Kissel.dat.xz'), 'r') as kf:
示例#2
0
    fname = sys.argv[1]
if len(sys.argv) > 2:
    dataroot = sys.argv[2]
else:
    dataroot = os.path.join(os.path.dirname(__file__), 'data')

dbf = DataBase(fname)
dbf.Create('elementdata',
           'Database with elemental data from XOP and Kissel databases')

init_material_db(dbf)

# add a dummy element, this is useful not only for testing and should be
# kept in future! It can be used for structure factor calculation tests, and
# shows how the a database entry can be generated manually
dbf.SetMaterial('Dummy')
dbf.SetF0([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])  # atomic structure factors
dbf.SetF1F2((0, 1e5), (0, 0), (0, 0))  # zero dispersion correction
dbf.SetWeight(atomic_mass)
dbf.SetRadius(1)

add_mass_from_NIST(dbf, os.path.join(dataroot, 'nist_atom.dat'), verbose)
add_color_from_JMOL(dbf, os.path.join(dataroot, 'colors.dat'), verbose)
add_radius_from_WIKI(dbf, os.path.join(dataroot, 'atomic_radius.dat'), verbose)

# add F0(Q) for every element
# with lzma.open(os.path.join('data', 'f0_xop.dat.xz'), 'r') as xop:
#    add_f0_from_xop(dbf, xop, verbose)
with lzma.open(os.path.join(dataroot, 'f0_InterTables.dat.xz'), 'r') as itf:
    add_f0_from_intertab(dbf, itf, verbose)