예제 #1
0
    def _generate_win_params_gaas(projections_dict=None):
        from aiida import orm
        from aiida.tools import get_kpoints_path
        from aiida_wannier90.orbitals import generate_projections
        if projections_dict is None:
            projections_dict = {'kind_name': 'As', 'ang_mtm_name': 'sp3'}
        structure = generate_structure_gaas()
        inputs = {
            'structure':
            structure,
            'kpoints':
            generate_kpoints_mesh(2),
            'kpoint_path':
            get_kpoints_path(structure, method='legacy')['parameters'],
            'parameters':
            orm.Dict(dict={
                "num_wann": 4,
                "num_iter": 12,
                "wvfn_formatted": True
            }),
            'projections':
            generate_projections(projections_dict, structure=structure)
        }

        return inputs
예제 #2
0
def get_static_inputs():
    """Return a dictionary of static inputs for this example.

    Other dynamic inputs depending on the user configuration (e.g., code names)
    are generated outside."""
    ####Input needed to run the workchain
    KpointsData = DataFactory('array.kpoints')
    StructureData = DataFactory('structure')

    # GaAs structure
    a = 5.68018817933178  # angstrom
    structure = StructureData(
        cell=[[-a / 2., 0, a / 2.], [0, a / 2., a / 2.], [-a / 2., a / 2., 0]])
    structure.append_atom(symbols=['Ga'], position=(0., 0., 0.))
    structure.append_atom(symbols=['As'], position=(-a / 4., a / 4., a / 4.))

    kpoints_scf = KpointsData()
    # 4x4x4 k-points mesh for the SCF
    kpoints_scf_mesh = 4
    kpoints_scf.set_kpoints_mesh(
        [kpoints_scf_mesh, kpoints_scf_mesh, kpoints_scf_mesh])

    kpoints_nscf = KpointsData()
    # 10x10x10 k-points mesh for the NSCF/Wannier90 calculations
    kpoints_nscf_mesh = 10
    kpoints_nscf.set_kpoints_mesh(
        [kpoints_nscf_mesh, kpoints_nscf_mesh, kpoints_nscf_mesh])

    # k-points path for the band structure
    kpoint_path = Dict(
        dict={
            'point_coords': {
                'G': [0.0, 0.0, 0.0],
                'K': [0.375, 0.375, 0.75],
                'L': [0.5, 0.5, 0.5],
                'U': [0.625, 0.25, 0.625],
                'W': [0.5, 0.25, 0.75],
                'X': [0.5, 0.0, 0.5]
            },
            'path': [('G', 'X'), ('X', 'U'), ('K',
                                              'G'), ('G',
                                                     'L'), ('L',
                                                            'W'), ('W', 'X')]
        })
    # sp^3 projections, centered on As
    projections = generate_projections(dict(position_cart=(-a / 4., a / 4.,
                                                           a / 4.),
                                            ang_mtm_l=-3,
                                            spin=None,
                                            spin_axis=None),
                                       structure=structure)

    return {
        'structure': structure,
        'kpoints_scf': kpoints_scf,
        'kpoints_nscf': kpoints_nscf,
        'kpoint_path': kpoint_path,
        'projections': projections
    }
예제 #3
0
    def inner(projections_dict={'kind_name': 'As', 'ang_mtm_name': 'sp3'}):
        from aiida.orm import DataFactory, CalculationFactory
        from aiida_wannier90.orbitals import generate_projections

        res = dict()

        a = 5.367 * pymatgen.core.units.bohr_to_ang
        structure_pmg = pymatgen.Structure(lattice=[[-a, 0, a], [0, a, a],
                                                    [-a, a, 0]],
                                           species=['Ga', 'As'],
                                           coords=[[0] * 3, [0.25] * 3])
        structure = DataFactory('structure')()
        structure.set_pymatgen_structure(structure_pmg)
        res['structure'] = structure

        res['projections'] = generate_projections(projections_dict,
                                                  structure=structure)

        KpointsData = DataFactory('array.kpoints')
        kpoints = KpointsData()
        kpoints.set_kpoints_mesh([2, 2, 2])
        res['kpoints'] = kpoints

        kpoint_path_tmp = KpointsData()
        kpoint_path_tmp.set_cell_from_structure(structure)
        kpoint_path_tmp.set_kpoints_path()
        point_coords, path = kpoint_path_tmp.get_special_points()
        kpoint_path = DataFactory('parameter')(dict={
            'path': path,
            'point_coords': point_coords,
        })
        res['kpoint_path'] = kpoint_path

        res['parameters'] = DataFactory('parameter')(
            dict=dict(num_wann=4, num_iter=12, wvfn_formatted=True))
        return res
            'L': [0.5, 0.5, 0.5],
            'U': [0.625, 0.25, 0.625],
            'W': [0.5, 0.25, 0.75],
            'X': [0.5, 0.0, 0.5]
        },
        'path': [('GAMMA',
                  'X'), ('X', 'U'), ('K', 'GAMMA'), ('GAMMA',
                                                     'L'), ('L',
                                                            'W'), ('W', 'X')]
    })

# sp^3 projections, centered on As
projections = generate_projections([
    {
        'position_cart': (-a / 4., a / 4., a / 4.),
        'ang_mtm_l_list': -3,
        'spin': None,
    },
],
                                   structure=structure)

# Load the workflow
MinimalW90WorkChain = WorkflowFactory('wannier90.minimal')

# Run the workflow
run(MinimalW90WorkChain,
    pw_code=pw_code,
    wannier_code=wannier_code,
    pw2wannier90_code=pw2wannier90_code,
    pseudo_family=Str(pseudo_family_name),
    structure=structure,
    kpoints_scf=kpoints_scf,
예제 #5
0
def test_spin_projections(  #pylint: disable=too-many-locals
        fixture_sandbox, generate_calc_job, generate_common_inputs_gaas,
        file_regression):
    """Test a `Wannier90Calculation` with various advanced combinations of the projections
    when using also spin.
    
    For instance, using both diffusivity and radial_nodes, or diffusivity only, 
    and in combination with/without zaxis and xaxis."""
    from aiida.orm import Dict
    from aiida_wannier90.orbitals import generate_projections

    seedname = 'aiida'
    inputs = generate_common_inputs_gaas(inputfolder_seedname=seedname)

    # Replace projections
    projections_dict_list = [
        {
            'kind_name': 'As',
            'ang_mtm_name': 's',
            'spin': 'u'
        },
        {
            'kind_name': 'As',
            'ang_mtm_name': 's',
            'zona': 2,
            'spin': 'd'
        },  # only diffusivity
        {
            'kind_name': 'As',
            'ang_mtm_name': 's',
            'radial': 3,
            'spin': 1
        },  # only radial_nodes
        {
            'kind_name': 'As',
            'ang_mtm_name': 's',
            'zona': 2,
            'radial': 3,
            'spin': -1
        },  # both diffusivity and radial_nodes
        {
            'kind_name': 'Ga',
            'ang_mtm_name': 's',
            'xaxis': [0, -1, 0],
            'spin': 'U',
            'spin_axis': [0, 1, 0]
        },
        {
            'kind_name': 'Ga',
            'ang_mtm_name': 's',
            'zaxis': [-1, 0, 0],
            'spin': 'D',
            'spin_axis': [0, 1, 0]
        },  # only diffusivity
        {
            'kind_name': 'Ga',
            'ang_mtm_name': 's',
            'xaxis': [0, -1, 0],
            'zaxis': [-1, 0, 0],
            'zona': 2,
            'spin': 'U',
            'spin_axis': [0, -1, 0]
        },  # only radial_nodes
        {
            'kind_name': 'Ga',
            'ang_mtm_name': 's',
            'zona': 2,
            'radial': 3,
            'spin': 'D',
            'spin_axis': [0, -1, 0]
        },  # both diffusivity and radial_nodes
    ]
    inputs['projections'] = generate_projections(projections_dict_list,
                                                 structure=inputs['structure'])

    param_dict = inputs['parameters'].get_dict()
    param_dict['spinors'] = True
    inputs['parameters'] = Dict(dict=param_dict)

    generate_calc_job(folder=fixture_sandbox,
                      entry_point_name=ENTRY_POINT_NAME,
                      inputs=inputs)

    with fixture_sandbox.open('{}.win'.format(seedname)) as handle:
        input_written = handle.read()

    file_regression.check(input_written, encoding='utf-8', extension='.win')
예제 #6
0
def create_builder(code, input_folder=None, submit_test=False):
    """Return a dictionary of inputs to be passed to `run` or `submit`.

    :param code: a `wannier90.wannier90` code.
    :param input_folder: an input folder. It can be `None`, in which case
        this function assumes this is a pre-process step. Or it can be either
        a RemoteData node, or a FolderData local node.
    :param submit_test: if True, runs a submit test (dry run, and with store_provenance=False)
    """
    exclude_bands = [1, 2, 3, 4, 5]
    parameter = Dict(
        dict={
            'bands_plot': False,
            'num_iter': 300,
            'guiding_centres': True,
            'num_wann': 4,
            'exclude_bands': exclude_bands,
            # 'wannier_plot':True,
            # 'wannier_plot_list':[1]
        })

    # in angstrom; it was 5.367 * 2 bohr; this is the lattice parameter
    a = 5.68018817933178
    structure = StructureData(
        cell=[[-a / 2., 0, a / 2.], [0, a / 2., a / 2.], [-a / 2., a / 2., 0]])
    structure.append_atom(symbols=['Ga'], position=(0., 0., 0.))
    structure.append_atom(symbols=['As'], position=(-a / 4., a / 4., a / 4.))

    kpoints = KpointsData()
    kpoints.set_kpoints_mesh([2, 2, 2])

    kpoint_path = Dict(
        dict={
            'point_coords': {
                'G': [0.0, 0.0, 0.0],
                'K': [0.375, 0.375, 0.75],
                'L': [0.5, 0.5, 0.5],
                'U': [0.625, 0.25, 0.625],
                'W': [0.5, 0.25, 0.75],
                'X': [0.5, 0.0, 0.5]
            },
            'path': [('G', 'X'), ('X', 'W'), ('W', 'K'), ('K', 'G'), (
                'G', 'L'), ('L', 'U'), ('U', 'W'), ('W', 'L'), ('L',
                                                                'K'), ('U',
                                                                       'X')]
        })

    builder = code.get_builder()
    builder.metadata.options.max_wallclock_seconds = 30 * 60  # 30 min
    builder.metadata.options.resources = {"num_machines": 1}

    #Two methods to define projections are available
    #Method 1
    projections = generate_projections(
        dict(
            position_cart=(1, 2, 0.5),
            radial=2,
            ang_mtm_l_list=2,
            ang_mtm_mr_list=5,
            spin=None,
            #zona=1.1,
            zaxis=(0, 1, 0),
            xaxis=(0, 0, 1),
            spin_axis=None),
        structure=structure)

    ## Method 1bis, when you want to complete missing orbitals with random ones
    ## This converts instead the 'projections' OrbitalData object to a list of strings, and passes
    ## directly to Wannier90. DISCOURAGED: better to pass the OrbitalData object,
    ## that contains 'parsed' information and is easier to query, and set
    ## random_projections = True in the input 'settings' Dict node.
    #from aiida_wannier90.io._write_win import _format_all_projections
    #projections_list = List()
    #projections_list.extend(_format_all_projections(projections, random_projections=True))
    #projections = projections_list

    ## Method 2
    #projections = List()
    #projections.extend(['As:s','As:p'])
    #projections.extend(['random','As:s'])

    do_preprocess = (input_folder is None)

    if not do_preprocess:
        if isinstance(input_folder, FolderData):
            builder.local_input_folder = input_folder
        elif isinstance(input_folder, RemoteData):
            builder.remote_input_folder = input_folder
        else:
            raise TypeError(
                "Unknown type for the input_folder, it can only be a RemoteData or a FolderData"
            )
    builder.structure = structure
    builder.projections = projections
    builder.parameters = parameter
    builder.kpoints = kpoints
    builder.kpoint_path = kpoint_path

    settings_dict = {'random_projections': True}
    if do_preprocess:
        settings_dict.update(
            {'postproc_setup':
             True})  # for setup calculation (preprocessing, -pp flag)
    builder.settings = Dict(dict=settings_dict)

    if submit_test:
        builder.metadata.dry_run = True
        builder.metadata.store_provenance = False

    return builder
예제 #7
0
    'path': path,
    'point_coords': point_coords,
})

calc = code.new_calc()
calc.set_max_wallclock_seconds(30 * 60)  # 30 min
calc.set_resources({"num_machines": 1})

#Two methods to define projections are available
#Method 1
projections = generate_projections(
    dict(
        position_cart=(1, 2, 0.5),
        radial=2,
        ang_mtm_l=2,
        ang_mtm_mr=5,
        spin=None,
        #zona=1.1,
        zaxis=(0, 1, 0),
        xaxis=(0, 0, 1),
        spin_axis=None),
    structure=structure)

## Method 1bis, when you want to complete missing orbitals with random ones
## This converts instead the 'projections' OrbitalData object to a list of strings, and passes
## directly to Wannier90. DISCOURAGED: better to pass the OrbitalData object,
## that contains 'parsed' information and is easier to query, and set
## random_projections = True in the input 'settings' ParameterData node.
#from aiida_wannier90.io._write_win import _format_all_projections
#projections_list = List()
#projections_list.extend(_format_all_projections(projections, random_projections=True))
#projections = projections_list