Exemple #1
0
def make(filename, st):
    gio = gulp.GulpIO()
    gc = gulp.GulpCaller('gulp')
    gin = gio.buckingham_input(st, ('optimise', 'conp', 'qok'))
    gout = gc.run(gin)
    energy = gio.get_energy(gout)
    relax_structure = gio.get_relaxed_structure(gout)
    print(filename, energy)
    relax_structure.to('POSCAR', filename=filename)
Exemple #2
0
    def __init__(self, header_file, potential_file, geometry):
        """
        Makes a GulpEnergyCalculator.

        Args:
            header_file: the path to the gulp header file

            potential_file: the path to the gulp potential file

            geometry: the Geometry of the search

        Precondition: the header and potential files exist and are valid
        """

        self.name = 'gulp'

        # the paths to the header and potential files
        self.header_path = header_file
        self.potential_path = potential_file

        # read the gulp header and potential files
        with open(header_file, 'r') as gulp_header_file:
            self.header = gulp_header_file.readlines()
        with open(potential_file, 'r') as gulp_potential_file:
            self.potential = gulp_potential_file.readlines()

        # for processing gulp input and output
        self.gulp_io = gulp_caller.GulpIO()

        # whether the anions and cations are polarizable in the gulp potential
        self.anions_shell, self.cations_shell = self.get_shells()

        # determine which lattice parameters should be relaxed
        # and make the corresponding flags for the input file
        #
        # relax a, b, c, alpha, beta, gamma
        if geometry.shape == 'bulk':
            self.lattice_flags = None
        # relax a, b and gamma but not c, alpha and beta
        elif geometry.shape == 'sheet':
            self.lattice_flags = ' 1 1 0 0 0 1'
        # relax c, but not a, b, alpha, beta and gamma
        elif geometry.shape == 'wire':
            self.lattice_flags = ' 0 0 1 0 0 0'
        # don't relax any of the lattice parameters
        elif geometry.shape == 'cluster':
            self.lattice_flags = ' 0 0 0 0 0 0'
Exemple #3
0
import pymatgen.command_line.gulp_caller as gc

gio = gc.GulpIO()
s: gc.Structure = gc.Structure.from_file('POSCAR')

gin = gio.buckingham_input(gc.Structure.from_file('POSCAR'), ['conv', 'opti'],
                           library='woodley.lib',
                           valence_dict={
                               gc.Element.Pb: 1,
                               gc.Element.Ti: 4
                           })
with open('gin', 'w') as f:
    f.write(gin)