Exemplo n.º 1
0
    def test_decimal(self):
        struct = Structure.from_str(
            """Mg2 Al4 O8
        1.0
        5.003532 0.000000 2.888790
        1.667844 4.717375 2.888790
        0.000000 0.000000 5.777581
        O Mg Al
        8 2 4
        direct
        0.736371 0.736371 0.736371 O
        0.263629 0.263629 0.709114 O
        0.263629 0.709114 0.263629 O
        0.709114 0.263629 0.263629 O
        0.736371 0.290886 0.736371 O
        0.290886 0.736371 0.736371 O
        0.263629 0.263629 0.263629 O
        0.736371 0.736371 0.290886 O
        0.125000 0.125000 0.125000 Mg
        0.875000 0.875000 0.875000 Mg
        0.500000 0.500000 0.000000 Al
        0.500000 0.500000 0.500000 Al
        0.000000 0.500000 0.500000 Al
        0.500000 0.000000 0.500000 Al""",
            fmt="poscar",
        )

        bp = BuckinghamPotential(bush_lewis_flag="bush")
        gio = GulpIO()
        input = gio.buckingham_input(struct, ["relax conp"])
        caller = GulpCaller()
        gout = caller.run(input)
Exemplo n.º 2
0
    def test_run(self):
        mgo_latt = [[4.212, 0, 0], [0, 4.212, 0], [0, 0, 4.212]]
        mgo_specie = ["Mg"] * 4 + ["O"] * 4
        mgo_frac_cord = [
            [0, 0, 0],
            [0.5, 0.5, 0],
            [0.5, 0, 0.5],
            [0, 0.5, 0.5],
            [0.5, 0, 0],
            [0, 0.5, 0],
            [0, 0, 0.5],
            [0.5, 0.5, 0.5],
        ]
        mgo_uc = Structure(mgo_latt, mgo_specie, mgo_frac_cord, True, True)
        gio = GulpIO()
        gin = gio.keyword_line("optimise", "conp")
        gin += gio.structure_lines(mgo_uc, symm_flg=False)
        # gin += self.gc.gulp_lib('catlow.lib')
        gin += "species\nMg    core  2.00000\nO core  0.86902\nO shel -2.86902\n"
        gin += "buck\n"
        gin += "Mg core O shel   946.627 0.31813  0.00000 0.0 10.0\n"
        gin += "O  shel O shel 22764.000 0.14900 27.87900 0.0 12.0\n"
        gin = gin
        gc = GulpCaller()

        """Some inherent checks are in the run_gulp function itself.
        They should be suffcient for raising errors."""
        gout = gc.run(gin)
Exemplo n.º 3
0
from pymatgen import MPRester, Structure
from pymatgen.command_line.gulp_caller import GulpCaller, GulpIO
from matplotlib import pyplot

mpr = MPRester()
mono: Structure = mpr.get_structure_by_material_id('mp-352')
ortho: Structure = mpr.get_structure_by_material_id('mp-685097')
tetra: Structure = mpr.get_structure_by_material_id('mp-1018721')
gio = GulpIO()
gc = GulpCaller()
for i in [mono, ortho, tetra]:
    arr = []
    arr2 = []
    i.apply_strain(-.05)
    for j in range(15):
        gin = gio.buckingham_input(i, ['conv'], library='morse.lib', alib=True)
        gout = gc.run(gin)
        arr.append(i.density)
        arr2.append(gio.get_energy(gout))
        i.apply_strain(-.01)
    i.to('POSCAR', i.get_space_group_info()[0].replace('/', '_') + '.vasp')
    if i.get_space_group_info()[0] == 'P4_2/nmc':
        pyplot.plot(arr, [r * 2 for r in arr2],
                    label=i.get_space_group_info()[0])
    else:
        pyplot.plot(arr, arr2, label=i.get_space_group_info()[0])
pyplot.legend()
pyplot.show()
Exemplo n.º 4
0
from pymatgen.command_line.gulp_caller import GulpCaller, GulpIO
from pymatgen import Structure
import numpy as np
import matplotlib.pyplot as plt


def get_energy(dis):
    gin = f'''conv
cart
Zn core 0 0 0
O  core 0 0 {dis}

library ABOP.lib
'''
    gout = gc.run(gin)
    return gio.get_energy(gout)


if __name__ == '__main__':
    gc = GulpCaller('/opt/gulp-5.1/Src/gulp')
    gio = GulpIO()
    arr = []
    for i in np.linspace(1, 2.5, 20):
        arr.append(get_energy(i))
        print(arr[-1])
    plt.plot(np.linspace(1, 2.5, 20), arr)
    plt.show()
Exemplo n.º 5
0
from pymatgen.command_line.gulp_caller import GulpCaller, GulpIO
from matplotlib import pyplot
import numpy as np

gio = GulpIO()
gc = GulpCaller()
arr = []
for i in np.linspace(0.5, 1, 100):
    body = f'''conv
#cell
#1 1 10 90 90 90
cart
O core 0 0 -{i}
O core 0 0 {i}
Hf core 0 0 0
species
Hf core  2.4
O  core -1.2
general 0 12
Hf core O core 0 0 1.0 1.
'''
    gout = gc.run(body)
    e = gio.get_energy(gout)
    arr.append(e)
pyplot.plot(arr)
pyplot.show()