コード例 #1
0
ファイル: calculations.py プロジェクト: sikisis/pymatgen
def bandstructure(workdir, runmode, structure, pseudos, scf_kppa, nscf_nband,
                  ndivsm, accuracy="normal", spin_mode="polarized",
                  smearing="fermi_dirac:0.1 eV", charge=0.0, scf_solver=None,
                  dos_kppa=None):

    scf_ksampling = KSampling.automatic_density(structure, scf_kppa,
                                                chksymbreak=0)

    scf_strategy = ScfStrategy(structure, pseudos, scf_ksampling,
                               accuracy=accuracy, spin_mode=spin_mode,
                               smearing=smearing, charge=charge,
                               scf_solver=scf_solver)

    nscf_ksampling = KSampling.path_from_structure(ndivsm, structure)

    nscf_strategy = NscfStrategy(scf_strategy, nscf_ksampling, nscf_nband)

    dos_strategy = None

    if dos_kppa is not None:
        raise NotImplementedError("DOS must be tested")
        dos_ksampling = KSampling.automatic_density(structure, kppa,
                                                    chksymbreak=0)
        dos_strategy = NscfStrategy(scf_strategy, dos_ksampling, nscf_nband,
                                    nscf_solver=None)

    return BandStructure(workdir, runmode, scf_strategy, nscf_strategy,
                         dos_strategy=dos_strategy)
コード例 #2
0
ファイル: calculations.py プロジェクト: isayev/pymatgen
def bandstructure(workdir, runmode, structure, pseudos, scf_kppa, nscf_nband,
                  ndivsm, accuracy="normal", spin_mode="polarized",
                  smearing="fermi_dirac:0.1 eV", charge=0.0, scf_solver=None,
                  dos_kppa=None):
    """
    Returns a Work object that computes that bandstructure of the material.

    Args:
        workdir:
            Working directory.
        runmode:
            `RunMode` instance.
        structure:
            Pymatgen structure.
        pseudos:
            List of `Pseudo` objects.
        scf_kppa:
            Defines the sampling used for the SCF run.
        nscf_nband:
            Number of bands included in the NSCF run.
        ndivs:
            Number of divisions used to sample the smallest segment of the k-path.
        accuracy:
            Accuracy of the calculation.
        spin_mode:
            Spin polarization.
        smearing:
            Smearing technique.
        charge:
            Electronic charge added to the unit cell.
        scf_solver:
            Algorithm used for solving of the SCF cycle.
        dos_kppa
            Defines the k-point sampling used for the computation of the DOS 
            (None if DOS is not wanted).
    """
    scf_ksampling = KSampling.automatic_density(structure, scf_kppa,
                                                chksymbreak=0)

    scf_strategy = ScfStrategy(structure, pseudos, scf_ksampling,
                               accuracy=accuracy, spin_mode=spin_mode,
                               smearing=smearing, charge=charge,
                               scf_solver=scf_solver)

    nscf_ksampling = KSampling.path_from_structure(ndivsm, structure)

    nscf_strategy = NscfStrategy(scf_strategy, nscf_ksampling, nscf_nband)

    dos_strategy = None

    if dos_kppa is not None:
        raise NotImplementedError("DOS must be tested")
        dos_ksampling = KSampling.automatic_density(structure, kppa,
                                                    chksymbreak=0)
        dos_strategy = NscfStrategy(scf_strategy, dos_ksampling, nscf_nband,
                                    nscf_solver=None)

    return BandStructure(workdir, runmode, scf_strategy, nscf_strategy,
                         dos_strategy=dos_strategy)
コード例 #3
0
ファイル: fw_workflows_old.py プロジェクト: gmrigna/abipy
    def __init__(self, structure, pseudos, ksampling=1000, relax_algo="atoms_and_cell", accuracy="normal",
                 spin_mode="polarized", smearing="fermi_dirac:0.1 eV", charge=0.0, scf_algorithm=None,
                 use_symmetries=True, ksampling_band=8, nscf_bands=None, nscf_algorithm=None, autoparal=False,
                 folder=None, **extra_abivars):

        # workflow to obtain the density
        if relax_algo in relaxation_methods.keys():
            if relax_algo == "atoms_and_cell":
                dens_wf = RelaxFWWorkflow(structure=structure, pseudos=pseudos, ksampling=ksampling, accuracy=accuracy,
                                          spin_mode=spin_mode, smearing=smearing, charge=charge,
                                          scf_algorithm=scf_algorithm, autoparal=autoparal, folder=folder,
                                          **extra_abivars)
                last_task = dens_wf.ioncell_task
            else:
                dens_wf = RelaxAtomsFWWorkflow(structure=structure, pseudos=pseudos, ksampling=ksampling,
                                               accuracy=accuracy, spin_mode=spin_mode, smearing=smearing, charge=charge,
                                               scf_algorithm=scf_algorithm, autoparal=autoparal, folder=folder,
                                               **extra_abivars)
                last_task = dens_wf.task
            deps = {id(last_task): 'DEN structure'}
        else:
            if relax_algo not in (None, 'scf', 'scf_only', 'no_relax'):
                logger.warning('relax_algo value "%s" not recognized. Perorming a scf calculation.' % relax_algo)

            dens_wf = ScfFWWorkflow(structure=structure, pseudos=pseudos, ksampling=ksampling, accuracy=accuracy,
                                    spin_mode=spin_mode, smearing=smearing, charge=charge, scf_algorithm=scf_algorithm,
                                    use_symmetries=use_symmetries, autoparal=autoparal, folder=folder, **extra_abivars)
            last_task = dens_wf.task
            deps = {id(last_task): 'DEN'}

        # Create the ksampling based on high symmetry lines of the structure
        if isinstance(ksampling_band, int):
            # ksampling_band = KSampling.automatic_density(structure, 100)
            ksampling_band = KSampling.path_from_structure(ksampling_band, structure)

        # Create the nscf FW
        nscf_task = NscfStrategyFireTask(scf_task=last_task, ksampling=ksampling_band, nscf_bands=nscf_bands,
                                         nscf_algorithm=nscf_algorithm, deps=deps, **extra_abivars)

        spec = {'create_file': 'band_structure'}
        if folder:
            spec['_launch_dir'] = os.path.join(folder, 'band_structure')

        nscf_fw = Firework(nscf_task, spec=spec)

        # Expand the first part to get the proper list of FWs and links
        fws, links = parse_workflow([dens_wf.wf, nscf_fw], {dens_wf.wf: [nscf_fw]})

        self.wf = Workflow(fws, links)
コード例 #4
0
ファイル: calculations.py プロジェクト: hgfb/pymatgen
def bandstructure(structure, pseudos, scf_kppa, nscf_nband,
                  ndivsm, accuracy="normal", spin_mode="polarized",
                  smearing="fermi_dirac:0.1 eV", charge=0.0, scf_algorithm=None,
                  dos_kppa=None, workdir=None, manager=None, **extra_abivars):
    """
    Returns a Work object that computes that bandstructure of the material.

    Args:
        structure:
            Pymatgen structure.
        pseudos:
            List of `Pseudo` objects.
        scf_kppa:
            Defines the sampling used for the SCF run.
        nscf_nband:
            Number of bands included in the NSCF run.
        ndivs:
            Number of divisions used to sample the smallest segment of the
            k-path.
        accuracy:
            Accuracy of the calculation.
        spin_mode:
            Spin polarization.
        smearing:
            Smearing technique.
        charge:
            Electronic charge added to the unit cell.
        scf_algorithm:
            Algorithm used for solving of the SCF cycle.
        dos_kppa:
            Defines the k-point sampling used for the computation of the DOS 
            (None if DOS is not wanted).
        workdir:
            Working directory.
        manager:
            `TaskManager` instance.
        extra_abivars:
            Dictionary with extra variables passed to ABINIT.
    """
    # SCF calculation.
    scf_ksampling = KSampling.automatic_density(structure, scf_kppa, chksymbreak=0)

    scf_strategy = ScfStrategy(structure, pseudos, scf_ksampling,
                               accuracy=accuracy, spin_mode=spin_mode,
                               smearing=smearing, charge=charge,
                               scf_algorithm=scf_algorithm, **extra_abivars)

    # Band structure calculation.
    nscf_ksampling = KSampling.path_from_structure(ndivsm, structure)

    nscf_strategy = NscfStrategy(scf_strategy, nscf_ksampling, nscf_nband, **extra_abivars)

    # DOS calculation.
    dos_strategy = None
    if dos_kppa is not None:
        raise NotImplementedError("DOS must be tested")
        dos_ksampling = KSampling.automatic_density(structure, dos_kppa, chksymbreak=0)
        #dos_ksampling = KSampling.monkhorst(dos_ngkpt, shiftk=dos_shiftk, chksymbreak=0)

        dos_strategy = NscfStrategy(scf_strategy, dos_ksampling, nscf_nband, nscf_solver=None, **extra_abivars)

    return BandStructureWorkflow(scf_strategy, nscf_strategy, dos_inputs=dos_strategy, 
                                 workdir=workdir, manager=manager)
コード例 #5
0
def bandstructure(structure, pseudos, scf_kppa, nscf_nband,
                  ndivsm, accuracy="normal", spin_mode="polarized",
                  smearing="fermi_dirac:0.1 eV", charge=0.0, scf_algorithm=None,
                  dos_kppa=None, workdir=None, manager=None, **extra_abivars):
    """
    Returns a Work object that computes that bandstructure of the material.

    Args:
        structure:
            Pymatgen structure.
        pseudos:
            List of `Pseudo` objects.
        scf_kppa:
            Defines the sampling used for the SCF run.
        nscf_nband:
            Number of bands included in the NSCF run.
        ndivs:
            Number of divisions used to sample the smallest segment of the
            k-path.
        accuracy:
            Accuracy of the calculation.
        spin_mode:
            Spin polarization.
        smearing:
            Smearing technique.
        charge:
            Electronic charge added to the unit cell.
        scf_algorithm:
            Algorithm used for solving of the SCF cycle.
        dos_kppa:
            Defines the k-point sampling used for the computation of the DOS 
            (None if DOS is not wanted).
        workdir:
            Working directory.
        manager:
            `TaskManager` instance.
        extra_abivars:
            Dictionary with extra variables passed to ABINIT.
    """
    # SCF calculation.
    scf_ksampling = KSampling.automatic_density(structure, scf_kppa, chksymbreak=0)

    scf_strategy = ScfStrategy(structure, pseudos, scf_ksampling,
                               accuracy=accuracy, spin_mode=spin_mode,
                               smearing=smearing, charge=charge,
                               scf_algorithm=scf_algorithm, **extra_abivars)

    # Band structure calculation.
    nscf_ksampling = KSampling.path_from_structure(ndivsm, structure)

    nscf_strategy = NscfStrategy(scf_strategy, nscf_ksampling, nscf_nband, **extra_abivars)

    # DOS calculation.
    dos_strategy = None
    if dos_kppa is not None:
        raise NotImplementedError("DOS must be tested")
        dos_ksampling = KSampling.automatic_density(structure, dos_kppa, chksymbreak=0)
        #dos_ksampling = KSampling.monkhorst(dos_ngkpt, shiftk=dos_shiftk, chksymbreak=0)

        dos_strategy = NscfStrategy(scf_strategy, dos_ksampling, nscf_nband, nscf_solver=None, **extra_abivars)

    return BandStructureWorkflow(scf_strategy, nscf_strategy, dos_inputs=dos_strategy, 
                                 workdir=workdir, manager=manager)
コード例 #6
0
ファイル: fw_workflows_old.py プロジェクト: gmrigna/abipy
    def __init__(self,
                 structure,
                 pseudos,
                 ksampling=1000,
                 relax_algo="atoms_and_cell",
                 accuracy="normal",
                 spin_mode="polarized",
                 smearing="fermi_dirac:0.1 eV",
                 charge=0.0,
                 scf_algorithm=None,
                 use_symmetries=True,
                 ksampling_band=8,
                 nscf_bands=None,
                 nscf_algorithm=None,
                 autoparal=False,
                 folder=None,
                 **extra_abivars):

        # workflow to obtain the density
        if relax_algo in relaxation_methods.keys():
            if relax_algo == "atoms_and_cell":
                dens_wf = RelaxFWWorkflow(structure=structure,
                                          pseudos=pseudos,
                                          ksampling=ksampling,
                                          accuracy=accuracy,
                                          spin_mode=spin_mode,
                                          smearing=smearing,
                                          charge=charge,
                                          scf_algorithm=scf_algorithm,
                                          autoparal=autoparal,
                                          folder=folder,
                                          **extra_abivars)
                last_task = dens_wf.ioncell_task
            else:
                dens_wf = RelaxAtomsFWWorkflow(structure=structure,
                                               pseudos=pseudos,
                                               ksampling=ksampling,
                                               accuracy=accuracy,
                                               spin_mode=spin_mode,
                                               smearing=smearing,
                                               charge=charge,
                                               scf_algorithm=scf_algorithm,
                                               autoparal=autoparal,
                                               folder=folder,
                                               **extra_abivars)
                last_task = dens_wf.task
            deps = {id(last_task): 'DEN structure'}
        else:
            if relax_algo not in (None, 'scf', 'scf_only', 'no_relax'):
                logger.warning(
                    'relax_algo value "%s" not recognized. Perorming a scf calculation.'
                    % relax_algo)

            dens_wf = ScfFWWorkflow(structure=structure,
                                    pseudos=pseudos,
                                    ksampling=ksampling,
                                    accuracy=accuracy,
                                    spin_mode=spin_mode,
                                    smearing=smearing,
                                    charge=charge,
                                    scf_algorithm=scf_algorithm,
                                    use_symmetries=use_symmetries,
                                    autoparal=autoparal,
                                    folder=folder,
                                    **extra_abivars)
            last_task = dens_wf.task
            deps = {id(last_task): 'DEN'}

        # Create the ksampling based on high symmetry lines of the structure
        if isinstance(ksampling_band, int):
            # ksampling_band = KSampling.automatic_density(structure, 100)
            ksampling_band = KSampling.path_from_structure(
                ksampling_band, structure)

        # Create the nscf FW
        nscf_task = NscfStrategyFireTask(scf_task=last_task,
                                         ksampling=ksampling_band,
                                         nscf_bands=nscf_bands,
                                         nscf_algorithm=nscf_algorithm,
                                         deps=deps,
                                         **extra_abivars)

        spec = {'create_file': 'band_structure'}
        if folder:
            spec['_launch_dir'] = os.path.join(folder, 'band_structure')

        nscf_fw = Firework(nscf_task, spec=spec)

        # Expand the first part to get the proper list of FWs and links
        fws, links = parse_workflow([dens_wf.wf, nscf_fw],
                                    {dens_wf.wf: [nscf_fw]})

        self.wf = Workflow(fws, links)