Beispiel #1
0
def test__no_charges():
    filename = os.path.join(
            'test__simulation_cell_to_phonts_string',
            'Si_dia_unit.relax.gga.vasp')
    poscar = Poscar()
    poscar.read(filename=filename)

    from pypospack.io.phonts import simulation_cell_to_phonts_string
    simulation_cell_to_phonts_string(
            simulation_cell=poscar)
Beispiel #2
0
from pypospack.io.vasp import Poscar
from pypospack.crystal import make_super_cell

_bulk_filename = "Ni_fcc_111_unit.gga.relaxed.vasp"
_bulk_poscar = Poscar()
_bulk_poscar.read(_bulk_filename)
_isf_filename = "Ni_fcc_isf.vasp"
print('a1', _bulk_poscar.a1)
print('a1', _bulk_poscar.a2)
print('a1', _bulk_poscar.a3)

_isf_sc = [1, 1, 5]
_isf_sc = Poscar(make_super_cell(_bulk_poscar, _isf_sc))
import numpy as np
_isf_sc.H[2, 2] = _isf_sc.H[2, 2] * 0.933333
for a in _isf_sc.atomic_basis:
    a.position[2] = a.position[2] / 0.933333
_isf_sc.write(_isf_filename)
Beispiel #3
0
    # Basic idea = triple loop over all nearby image, pick shortest relative vector.
    # This is horribly slow, and for very skewed cells, n has to become very large.
    result = None
    n = 2
    for i0 in range(-n, n+1):
        for i1 in range(-n, n+1):
            for i2 in range(-n, n+1):
                rp = r+np.dot(a0*H.T, [i0,i1,i2])
                d = np.linalg.norm(rp)
                if (result is None) or (result[1] > d):
                    result = (rp, d)
    return result[0]

poscar_filename = 'Ni_fcc_unit.gga.relaxed.vasp'
cell_poscar = Poscar()
cell_poscar.read(poscar_filename)
cell_poscar.normalize_h_matrix()
cell_sc = make_super_cell(structure=cell_poscar,sc=[3,3,3])
_positions = [a.position for a in cell_sc.atomic_basis]
_n_atoms = len(_positions)
min_distances = []
for i in range(1,_n_atoms):
    r1 = np.array(_positions[0])
    r2 = np.array(_positions[i])
    r = r2-r1
    r_min = brute_minimum_image_convention(r=r,H=cell_sc.H,a0=cell_sc.a0)
    d = np.linalg.norm(r_min)
    min_distances.append(d*cell_poscar.a0*cell_poscar.a1)
min_distances = np.array(min_distances)
distances = np.linspace(
        np.min(min_distances),
Beispiel #4
0
import argparse
from pypospack.io.vasp import Poscar
_description = 'Normalizes the H-matrix'
_parser = argparse.ArgumentParser(description=_description)
_parser.add_argument('--in', action='store', dest='filename_in', type=str)
_parser.add_argument('--out', action='store', dest='filename_out', type=str)

_args = _parser.parse_args()
_filename_in = _args.filename_in
_filename_out = _args.filename_out

print('filename_in:{}'.format(_filename_in))
_poscar = Poscar()
_poscar.read(_filename_in)
print('a0:{}'.format(_poscar.a0))
print('H:\n{}'.format(_poscar.H))
print('filename_out:{}'.format(_filename_out))
_poscar.normalize_h_matrix()
print(80 * '-')
print('a0:{}'.format(_poscar.a0))
print('H:\n{}'.format(_poscar.H))
_poscar.write(_filename_out)
Beispiel #5
0
def test__setup__can_read_poscar_file():
    filename = os.path.join(
            'test__simulation_cell_to_phonts_string',
            'Si_dia_unit.relax.gga.vasp')
    poscar = Poscar()
    poscar.read(filename=filename)
Beispiel #6
0
def test__setup__can_read_poscar_file():
    filename = os.path.join(
            'test__simulation_cell_to_phonts_string',
            'Si_dia_unit.relax.gga.vasp')
    poscar = Poscar()
    poscar.read(filename=filename)

def test__no_charges():
    filename = os.path.join(
            'test__simulation_cell_to_phonts_string',
            'Si_dia_unit.relax.gga.vasp')
    poscar = Poscar()
    poscar.read(filename=filename)

    from pypospack.io.phonts import simulation_cell_to_phonts_string
    simulation_cell_to_phonts_string(
            simulation_cell=poscar)

if __name__ == "__main__":
    # creating tests for formatting is difficult.
    # it's better to do integration tests later to determine if
    # file created is valid.
    from pypospack.io.phonts import simulation_cell_to_phonts_string
    poscar = Poscar()
    poscar.read(filename='Si_dia_unit.relax.gga.vasp')
    cell_str= simulation_cell_to_phonts_string(
            simulation_cell=poscar)
    print(cell_str)