Ejemplo n.º 1
0
def make_hex_lattice_input(path,
                           atomic_sep,
                           kpointdivs,
                           comment,
                           forbid_symmetry=True):

    pb = hexagonal_unitcell('C', atomic_sep, layersep=25.)

    incar = Incar()
    incar['SYSTEM'] = comment
    incar['ALGO'] = 'Fast'
    incar['NSW'] = 1000
    incar['IBRION'] = 2
    incar['EDIFF'] = 1E-8
    if forbid_symmetry:
        incar['ISYM'] = 0

    kpoints = Kpoints.gamma_automatic(kpointdivs, [0, 0, 0])

    metadata = {'atomic_sep': atomic_sep, 'kpointdivs': kpointdivs}

    ws = VaspInput(
        poscar=pb.poscar(comment=comment),
        potcar=pb.potcar(functional='PBE'),
        incar=incar,
        kpoints=kpoints,
        # additional files
        metadata=json.dumps(metadata),
    )

    ws.write_input(path)
Ejemplo n.º 2
0
def make_vasp_input(path, *, kpointdivs, comment, forbid_symmetry, functional,
                    perturb_dist, **kwargs):
    assert hasattr(kpointdivs, '__iter__')
    assert isinstance(comment, str)
    assert isinstance(forbid_symmetry, bool)
    assert isinstance(perturb_dist, float)

    pb = carbon_chain_poxcar(**kwargs)

    incar = Incar()
    incar['SYSTEM'] = comment
    incar['ALGO'] = 'Fast'
    incar['NSW'] = 1000
    incar['NPAR'] = 4
    incar['IBRION'] = 2
    incar['EDIFF'] = 1E-8
    incar['EDIFFG'] = -0.001
    if forbid_symmetry:
        incar['ISYM'] = 0

    kpoints = Kpoints.gamma_automatic(kpointdivs, [0, 0, 0])

    metadata = {
        'kpointdivs': kpointdivs,
        'functional': functional,
        'perturb_dist': perturb_dist,
        'forbid_symmetry': forbid_symmetry,
    }

    # FIXME FIXME FIXME
    # Here, we insert all structure parameters into the metadata.  The purpose is because
    #  oftentimes those parameters are the ones we're most interested in (such as scale).
    #
    # However, this is all kinds of bad:
    #  * Not all structure arguments are necessarily desirable to have in the metadata.
    #  * What if we want a structure argument to be of a non JSON-encodable type?
    #  * It creates a dependency between names of function arguments in code, and the output file.
    # In other words, madness.
    metadata = dict_union(metadata, kwargs)

    ws = VaspInput(
        poscar=pb.poscar(
            perturb_dist=perturb_dist,
            comment=comment,
        ),
        potcar=pb.potcar(functional=functional, ),
        incar=incar,
        kpoints=kpoints,

        # additional files
        metadata=json.dumps(metadata),
    )

    ws.write_input(path)