コード例 #1
0
def test_kgrid():
    # `h` is very small, just to make all `size` entries odd
    cell = np.diag([3, 4, 5])  # Angstrom
    size = crys.kgrid(cell, h=0.23)
    assert (np.array(size) == np.array([9, 7, 5])).all()
    size = crys.kgrid(cell, h=0.23, even=True)
    assert (np.array(size) == np.array([10, 8, 6])).all()
    size, spacing = crys.kgrid(cell, h=0.23, fullout=True)
    assert np.allclose(spacing, crys.kgrid(cell, size=size))
    # big cell, assert Gamma = [1,1,1] or better
    size = crys.kgrid(cell * 100, h=0.23, minpoints=2)
    assert (np.array(size) == np.array([2, 2, 2])).all()
コード例 #2
0
def test_kgrid():
    # `h` is very small, just to make all `size` entries odd
    cell = np.diag([3,4,5]) # Angstrom
    size = crys.kgrid(cell, h=0.23)
    assert (np.array(size) == np.array([9,7,5])).all()
    size = crys.kgrid(cell, h=0.23, even=True)
    assert (np.array(size) == np.array([10,8,6])).all()
    size, spacing = crys.kgrid(cell, h=0.23, fullout=True)
    assert np.allclose(spacing, crys.kgrid(cell, size=size))
    # big cell, assert Gamma = [1,1,1] or better
    size = crys.kgrid(cell*100, h=0.23, minpoints=2)
    assert (np.array(size) == np.array([2,2,2])).all()
コード例 #3
0
ファイル: cif2any.py プロジェクト: elcorto/pwtools
general crystal information
{bar}

reciprocal cell [1/Bohr]:
{rcell_bohr}

reciprocal cell [1/Ang]:
{rcell_ang}

relation of recip. vector lengths (a:b:c)
{rrel}

kpoint grids for some h [1/Ang] resolutions
{kpoints}
"""

cell_ang = struct.cell * Bohr/Angstrom
kpoints = ''
for h in np.arange(.2, 1, .1):
    kpoints += "h = %.3f  size = %s\n" \
        %(h, str_arr(crys.kgrid(cell_ang, h=h), fmt='%i'))

rules = {'bar': bar,
         'rcell_bohr': str_arr(rcell),
         'rcell_ang': str_arr(rcell / Bohr * Angstrom),
         'rrel': str_arr(norms/norms.min()),
         'kpoints': kpoints,
         }

print out.format(**rules)
コード例 #4
0
ファイル: cif2any.py プロジェクト: zari277/pwtools
{bar}

reciprocal cell [1/Bohr]:
{rcell_bohr}

reciprocal cell [1/Ang]:
{rcell_ang}

relation of recip. vector lengths (a:b:c)
{rrel}

kpoint grids for some h [1/Ang] resolutions
{kpoints}
"""

cell_ang = struct.cell * Bohr / Angstrom
kpoints = ''
for h in np.arange(.2, 1, .1):
    kpoints += "h = %.3f  size = %s\n" \
        %(h, str_arr(crys.kgrid(cell_ang, h=h), fmt='%i'))

rules = {
    'bar': bar,
    'rcell_bohr': str_arr(rcell),
    'rcell_ang': str_arr(rcell / Bohr * Angstrom),
    'rrel': str_arr(norms / norms.min()),
    'kpoints': kpoints,
}

print(out.format(**rules))