Пример #1
0
def vasp_vol_relax():
    Al = bulk('Al', 'fcc', a=4.5, cubic=True)
    calc = Vasp(xc='LDA',
                isif=7,
                nsw=5,
                ibrion=1,
                ediffg=-1e-3,
                lwave=False,
                lcharg=False)
    calc.calculate(Al)

    # Explicitly parse atomic position output file from Vasp
    CONTCAR_Al = io.read('CONTCAR', format='vasp')

    print('Stress after relaxation:\n', calc.read_stress())

    print('Al cell post relaxation from calc:\n', calc.get_atoms().get_cell())
    print('Al cell post relaxation from atoms:\n', Al.get_cell())
    print('Al cell post relaxation from CONTCAR:\n', CONTCAR_Al.get_cell())

    # All the cells should be the same.
    assert (calc.get_atoms().get_cell() == CONTCAR_Al.get_cell()).all()
    assert (Al.get_cell() == CONTCAR_Al.get_cell()).all()

    return Al
def test_vasp_relax():
    slab = create_slab_with_constraints()
    calc = Vasp(xc='LDA',
                isif=0,
                nsw=3,
                ibrion=1,
                ediffg=-1e-3,
                lwave=False,
                lcharg=False)
    calc.calculate(slab)

    init_slab = create_slab_with_constraints()
    res = read('OUTCAR')
    assert np.allclose(res.positions[0], init_slab.positions[0])
    assert not np.allclose(res.positions[2], init_slab.positions[2])