コード例 #1
0
ファイル: conftest.py プロジェクト: kjappelbaum/aiida-qeq
def ionization_file(aiida_profile):  # pylint: disable=unused-argument
    from aiida.plugins import DataFactory
    import aiida_qeq.data as data
    SinglefileData = DataFactory('singlefile')

    return SinglefileData(file=os.path.join(
        data.DATA_DIR, data.eqeq.DEFAULT_IONIZATION_FILE_NAME))
コード例 #2
0
ファイル: conftest.py プロジェクト: kjappelbaum/aiida-qeq
def hkust1_cif(aiida_profile):  # pylint: disable=unused-argument
    from aiida.plugins import DataFactory
    from aiida_qeq.tests import TEST_DIR
    CifData = DataFactory('cif')

    return CifData(file=os.path.join(TEST_DIR, 'HKUST1.cif'),
                   parse_policy='lazy')
コード例 #3
0
def main(code_string, datafiles, parameters):
    """Main method to setup the calculation."""

    # First, we need to fetch the AiiDA datatypes which will
    # house the inputs to our calculation
    dict_data = DataFactory('dict')

    # Then, we set the workchain we would like to call
    workchain = WorkflowFactory('logger.gc_example')

    # Set inputs for the following WorkChain execution
    inputs = AttributeDict()
    # inputs.metadata = {'options': {'resources': {'num_machines': 1, 'num_mpiprocs_per_machine': 1},
    #                                'parser_name': 'logger',
    #                                'withmpi': False,
    #                                'output_filename': 'logger.out'}}
    # Set code
    inputs.code = Code.get_from_string(code_string)
    # Set datafiles
    inputs.datafiles = datafiles
    # Set parameters
    inputs.parameters = dict_data(dict=parameters)
    # Set workchain related inputs, in this case, give more explicit output to report
    inputs.verbose = Bool(True)
    # Submit the requested workchain with the supplied inputs
    run(workchain, **inputs)
コード例 #4
0
 def test_neworder_potential_wf(self):
     from numpy import loadtxt
     from aiida.orm import load_node
     from aiida.plugins import DataFactory
     from aiida_kkr.tools.common_workfunctions import neworder_potential_wf
     from aiida.tools.importexport import import_data
     Dict = DataFactory('dict')
     import_data('files/db_dump_kkrflex_create.tar.gz')
     GF_host_calc = load_node(
         'baabef05-f418-4475-bba5-ef0ee3fd5ca6').outputs
     neworder_pot1 = [
         int(i) for i in
         loadtxt(GF_host_calc.retrieved.open('scoef'), skiprows=1)[:, 3] - 1
     ]
     settings_dict = {
         'pot1': 'out_potential',
         'out_pot': 'potential_imp',
         'neworder': neworder_pot1
     }
     settings = Dict(dict=settings_dict)
     startpot_imp_sfd = neworder_potential_wf(
         settings_node=settings,
         parent_calc_folder=GF_host_calc.remote_folder)
     assert startpot_imp_sfd.get_object_content(
         startpot_imp_sfd.filename
     )[::
       1000] == u'C12807143D556463084.6+55 7D117 9D-87 0+25\n20.70351.75\n0521259.2+491.0-462. 02621D74112D03547T00 4D02116D502 6D39\n96.20261.50941.4944.7+30 98-29 .5-3625D07193.58104D0773D27252285417D341 9.506544D548447094.9+38 91063 54-08 6D28277.60909.98111'
コード例 #5
0
def get_structure():
    """
    Set up Si primitive cell

    Si
       5.431
         0.0000000000000000    0.5000000000000000    0.5000000000000000
         0.5000000000000000    0.0000000000000000    0.5000000000000000
         0.5000000000000000    0.5000000000000000    0.0000000000000000
    Si
       2
    Direct
      0.8750000000000000  0.8750000000000000  0.8750000000000000
      0.1250000000000000  0.1250000000000000  0.1250000000000000

    """

    structure_data = DataFactory('structure')
    alat = 5.431
    lattice = np.array([[.5, 0, .5], [.5, .5, 0], [0, .5, .5]]) * alat
    structure = structure_data(cell=lattice)
    for pos_direct in ([0.875, 0.875, 0.875], [0.125, 0.125, 0.125]):
        pos_cartesian = np.dot(pos_direct, lattice)
        structure.append_atom(position=pos_cartesian, symbols='Si')
    return structure
コード例 #6
0
ファイル: eos.py プロジェクト: espenfl/aiida-vasp
def locate_minimum(total_energies):
    """Locate the volume with the lowest energy using interpolation."""
    total_energies_array = total_energies.get_array('eos')
    volumes = total_energies_array[:, 0]
    energies = total_energies_array[:, 1]

    # Establish some initial guess (take lowest energy point from the original dataset)
    min_energy_guess_index = np.argmin(energies)

    # Create the function that can be used to extract interpolated values
    # Using cubic interpolation here, which is not necessarly physically correct,
    # only serves as an example. Please have a look at the theory behind more realiastic
    # models that can be used to fit such data.
    new_energies = interp1d(volumes, energies, kind='cubic')

    # Use minimize from scipy to locate the minimal point that can be ejected by the
    # interpolation routines
    minimized_point = minimize(new_energies,
                               volumes[min_energy_guess_index],
                               tol=1e-3)

    # Create a dictionary to house the results and return
    dict_data = DataFactory('dict')(dict={
        'volume': minimized_point.x[0],
        'energy': minimized_point.fun
    })

    return dict_data
コード例 #7
0
def test_process(diff_code):
    """Test running a calculation
    note this does not test that the expected outputs are created of output parsing"""

    # Prepare input parameters
    DiffParameters = DataFactory("diff")
    parameters = DiffParameters({"ignore-case": True})

    file1 = SinglefileData(
        file=os.path.join(TEST_DIR, "input_files", "file1.txt"))
    file2 = SinglefileData(
        file=os.path.join(TEST_DIR, "input_files", "file2.txt"))

    # set up calculation
    inputs = {
        "code": diff_code,
        "parameters": parameters,
        "file1": file1,
        "file2": file2,
        "metadata": {
            "options": {
                "max_wallclock_seconds": 30
            },
        },
    }

    result = run(CalculationFactory("diff"), **inputs)
    computed_diff = result["diff"].get_content()

    assert "content1" in computed_diff
    assert "content2" in computed_diff
コード例 #8
0
def test_process(aiida_code):
    """Test running a calculation
    note this does not test that the expected outputs are created of output parsing"""
    from aiida.plugins import DataFactory, CalculationFactory
    from aiida.engine import run

    # Prepare input parameters
    DiffParameters = DataFactory('transmatrix')
    parameters = DiffParameters({'ignore-case': True})

    from aiida.orm import SinglefileData
    file1 = SinglefileData(
        file=os.path.join(tests.TEST_DIR, "input_files", 'file1.txt'))
    file2 = SinglefileData(
        file=os.path.join(tests.TEST_DIR, "input_files", 'file2.txt'))

    # set up calculation
    inputs = {
        'code': aiida_code,
        'parameters': parameters,
        'file1': file1,
        'file2': file2,
        'metadata': {
            'options': {
                'max_wallclock_seconds': 30
            },
        },
    }

    result = run(CalculationFactory('transmatrix'), **inputs)
    computed_diff = result['transmatrix'].get_content()

    assert 'content1' in computed_diff
    assert 'content2' in computed_diff
コード例 #9
0
def test_bases_from_struct(db_test_app):
    db_test_app.get_or_create_computer()

    with resource_context("basis_sets", "sto3g") as path:
        nfiles, nuploaded = BasisSetData.upload_basisset_family(
            path, "sto3g", "group of sto3g basis sets")

    # MgO
    import ase  # noqa: F401
    from ase.spacegroup import crystal

    atoms = crystal(
        symbols=[12, 8],
        basis=[[0, 0, 0], [0.5, 0.5, 0.5]],
        spacegroup=225,
        cellpar=[4.21, 4.21, 4.21, 90, 90, 90],
    )  # type: ase.Atoms

    # atoms[0].tag = 1
    # atoms[1].tag = 1
    atoms.set_tags([1, 1, 0, 0, 0, 0, 0, 0])

    structure_data_cls = DataFactory("structure")
    struct = structure_data_cls(ase=atoms)

    bases_dict = BasisSetData.get_basissets_by_kind(struct, "sto3g")
    # print(bases_dict)

    assert set(bases_dict.keys()) == set(["Mg", "Mg1", "O"])

    assert bases_dict["Mg"].get_basis_family_names() == ["sto3g"]
コード例 #10
0
 def parse_stdout(self, f):
     self.stdout_parser = out.OutFileParser(f)
     params = self.stdout_parser.get_parameters()
     # raise flag if structure (atomic and electronic) is good
     self.converged_electronic = params['converged_electronic']
     self.converged_ionic = params['converged_ionic']
     return DataFactory('dict')(dict=params)
コード例 #11
0
def test_symmetry_show(db_test_app):

    from aiida.plugins import DataFactory

    node_cls = DataFactory("crystal17.symmetry")

    symmdata = {
        "operations": [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]],
        "hall_number": 1,
        "basis": "fractional",
    }
    node = node_cls(data=symmdata)
    node.store()

    runner = CliRunner()
    result = runner.invoke(symmetry, ["show", str(node.pk)])

    assert result.exit_code == 0

    expected = dedent("""\
                basis:       fractional
                hall_number: 1
                num_symops:  1
                """)

    print(result.output)

    assert expected == str(result.output)

    result2 = runner.invoke(symmetry, ["show", "-s", str(node.pk)])

    assert result2.exit_code == 0
コード例 #12
0
def test_enum_process(ce_enum_code):
    StructureSet = DataFactory('ce.structures')

    from ase.build import bulk
    prim = bulk('Ag')
    structure = StructureData(ase=prim)
    chemical_symbols = List(list=[['Au', 'Pd']])

    # set up calculation
    inputs = {
        'code': ce_enum_code,
        'structure': structure,
        'chemical_symbols': chemical_symbols,
        'min_volume': Int(1),
        'max_volume': Int(4),
        'metadata': {
            'options': {
                'max_wallclock_seconds': 30
            },
        },
    }

    result = run(CalculationFactory('ce.genenum'), **inputs)
    structures = result['enumerate_structures']
    structure0 = structures.get_structure(0).get_ase()

    assert numpy.allclose(structure0.cell, prim.cell)
    assert numpy.allclose(structure0.positions, prim.positions)
    assert isinstance(structures, StructureSet)

    assert result['number_of_structures'] == 10
コード例 #13
0
def test_optimize_process(
    db_test_app,
    get_potential_data,
    potential_type,
    data_regression,
):
    """Test the functionality of the optimization calculation type"""
    calc_plugin = 'lammps.optimize'
    code = db_test_app.get_or_create_code(calc_plugin)
    pot_data = get_potential_data(potential_type)
    potential = DataFactory('lammps.potential')(
        potential_type=pot_data.type,
        data=pot_data.data,
    )
    parameters = get_calc_parameters(
        get_lammps_version(code),
        calc_plugin,
        potential.default_units,
        potential_type,
    )
    builder = code.get_builder()
    builder._update({ # pylint: disable=protected-access
        'metadata': tests.get_default_metadata(),
        'code': code,
        'structure': pot_data.structure,
        'potential': potential,
        'parameters': parameters,
    })

    output = run_get_node(builder)
    calc_node = output.node

    if not calc_node.is_finished_ok:
        print(calc_node.attributes)
        print(get_calcjob_report(calc_node))
        raise Exception(
            f'finished with exit message: {calc_node.exit_message}')

    link_labels = calc_node.get_outgoing().all_link_labels()
    assert set(link_labels).issuperset(
        ['results', 'trajectory_data', 'structure'])

    trajectory_data = calc_node.outputs.trajectory_data.attributes
    # optimization steps may differ between lammps versions
    trajectory_data = {
        k: v
        for k, v in trajectory_data.items() if k != 'number_steps'
    }
    data_regression.check({
        'results':
        sanitize_results(calc_node.outputs.results.get_dict(), 1),
        'trajectory_data':
        trajectory_data,
        'structure': {
            'kind_names': calc_node.outputs.structure.get_kind_names()
        }
        # "structure": tests.recursive_round(
        #     calc_node.outputs.structure.attributes, 1, apply_lists=True
        # ),
    })
コード例 #14
0
def test_md_submission(db_test_app, get_potential_data, potential_type):
    """Test the submission of the md type of calculation"""
    calc_plugin = 'lammps.md'
    code = db_test_app.get_or_create_code(calc_plugin)
    pot_data = get_potential_data(potential_type)
    potential = DataFactory('lammps.potential')(
        potential_type=pot_data.type,
        data=pot_data.data,
    )
    parameters = get_calc_parameters(
        get_lammps_version(code),
        calc_plugin,
        potential.default_units,
        potential_type,
    )
    builder = code.get_builder()
    builder._update({ # pylint: disable=protected-access
        'metadata': tests.get_default_metadata(),
        'code': code,
        'structure': pot_data.structure,
        'potential': potential,
        'parameters': parameters,
    })

    with db_test_app.sandbox_folder() as folder:
        calc_info = db_test_app.generate_calcinfo(calc_plugin, folder, builder)

        assert calc_info.codes_info[0].cmdline_params == ['-in', 'input.in']
        assert set(folder.get_content_list()).issuperset(
            ['input.data', 'input.in'])
コード例 #15
0
def _extract_symmetry(final_data, init_settings, param_data, parser_result, exit_codes):
    """Extract symmetry operations."""
    if "primitive_symmops" not in final_data:
        param_data["parser_errors"].append(
            "primitive symmops were not found in the output file"
        )
        parser_result.exit_code = exit_codes.ERROR_SYMMETRY_NOT_FOUND
        return

    if init_settings:
        if init_settings.num_symops != len(final_data["primitive_symmops"]):
            param_data["parser_errors"].append("number of symops different")
            parser_result.exit_code = exit_codes.ERROR_SYMMETRY_INCONSISTENCY
        # differences = init_settings.compare_operations(
        #     final_data["primitive_symmops"])
        # if differences:
        #     param_data["parser_errors"].append(
        #         "output symmetry operations were not the same as "
        #         "those input: {}".format(differences))
        #     parser_result.success = False
    else:
        symmetry_data_cls = DataFactory("crystal17.symmetry")
        data_dict = {
            "operations": final_data["primitive_symmops"],
            "basis": "fractional",
            "hall_number": None,
        }
        parser_result.nodes.symmetry = symmetry_data_cls(data=data_dict)
コード例 #16
0
def kick_out_corestates_wf(potential_sfd, emin):
    """
    Workfunction that kicks out all core states from single file data potential that are higher than emin.
    :param potential_sfd: SingleFileData type of potential
    :param emin: Energy threshold above which all core states are removed from potential (Float)
    :returns: potential without core states higher than emin (SingleFileData)
    """
    from aiida.common.folders import SandboxFolder
    from aiida.plugins import DataFactory

    SingleFileData = DataFactory('singlefile')

    with SandboxFolder() as tmpdir:
        with tmpdir.open('potential_deleted_core_states', 'w') as potfile_out:
            with potential_sfd.open(potential_sfd.filename) as potfile_in:
                num_deleted = kick_out_corestates(potfile_in, potfile_out,
                                                  emin)
        # store new potential as single file data object
        if num_deleted > 0:
            with tmpdir.open('potential_deleted_core_states') as potfile_out:
                potential_nocore_sfd = SingleFileData(file=potfile_out)

    # return potential
    if num_deleted > 0:
        return potential_nocore_sfd
    else:
        return potential_sfd.clone()
コード例 #17
0
ファイル: test_eqeq.py プロジェクト: kjappelbaum/aiida-qeq
def test_submit(aiida_profile, clear_database, ionization_file, charge_file,
                hkust1_cif, basic_options):
    """Test submitting a calculation"""
    from aiida.plugins import CalculationFactory, DataFactory

    EqeqCalculation = CalculationFactory('qeq.eqeq')

    # Prepare input parameters
    EQeqParameters = DataFactory('qeq.eqeq')
    parameters = EQeqParameters({'method': 'ewald'})

    inputs = {
        'code': tests.get_code(entry_point='qeq.eqeq'),
        'structure': hkust1_cif,
        'parameters': parameters,
        'charge_data': charge_file,
        'ionization_data': ionization_file,
        'metadata': {
            'options': basic_options,
            'label': "aiida_qeq EQEQ test",
            'description':
            "Test EQEQ job submission with the aiida_qeq plugin",
        },
    }
    result = run(EqeqCalculation, **inputs)

    charges_list = result['json_with_charges'].get_content()
    assert charges_list.startswith('[0.878')
コード例 #18
0
    def define(cls, spec: CalcJobProcessSpec):
        super(CryDossCalculation, cls).define(spec)

        spec.input("metadata.options.output_isovalue_fname",
                   valid_type=str,
                   default="fort.25")

        spec.input("metadata.options.parser_name",
                   valid_type=str,
                   default="crystal17.doss")

        spec.exit_code(
            352,
            "ERROR_ISOVALUE_FILE_MISSING",
            message="parser could not find the output isovalue (fort.25) file",
        )
        spec.exit_code(
            353,
            "ERROR_PARSING_ISOVALUE_FILE",
            message="error parsing output isovalue (fort.25) file",
        )

        spec.output(
            "arrays",
            valid_type=DataFactory("array"),
            required=False,
            help="energies and DoS arrays",
        )
コード例 #19
0
ファイル: submit.py プロジェクト: lan496/aiida-vasp-bm
def get_structure_AlN():
    """Set up AlN primitive cell

     Al N
       1.0
         3.1100000000000000    0.0000000000000000    0.0000000000000000
        -1.5550000000000000    2.6933390057696038    0.0000000000000000
         0.0000000000000000    0.0000000000000000    4.9800000000000000
     Al N
       2   2
    Direct
       0.3333333333333333  0.6666666666666665  0.0000000000000000
       0.6666666666666667  0.3333333333333333  0.5000000000000000
       0.3333333333333333  0.6666666666666665  0.6190000000000000
       0.6666666666666667  0.3333333333333333  0.1190000000000000

    """

    StructureData = DataFactory('structure')
    a = 3.11
    c = 4.98
    lattice = [[a, 0, 0], [-a / 2, a / 2 * np.sqrt(3), 0], [0, 0, c]]
    structure = StructureData(cell=lattice)
    for pos_direct, symbol in zip(
        ([1. / 3, 2. / 3, 0], [2. / 3, 1. / 3, 0.5], [1. / 3, 2. / 3, 0.619],
         [2. / 3, 1. / 3, 0.119]), ('Al', 'Al', 'N', 'N')):
        pos_cartesian = np.dot(pos_direct, lattice)
        structure.append_atom(position=pos_cartesian, symbols=symbol)
    return structure
コード例 #20
0
def test_generic_datafile_parsing(fixture_retrieved):  # noqa: F811
    """Test a datafile with a comment section, labels and integer and floats."""
    from aiida_logger.parsers.file_parsers.datafile import DatafileParser

    dummy_calculation = CalculationFactory('arithmetic.add')
    exit_codes = dummy_calculation.exit_codes

    parameters = DataFactory('dict')(dict={
        'comment_string': '#',
        'labels': True
    })

    datafile_parser = DatafileParser(fixture_retrieved, 'datafile', exit_codes,
                                     parameters)
    result = datafile_parser.parse()
    data = result['data']
    metadata = result['metadata'].get_dict()

    assert 'labels' in metadata
    assert 'comments' in metadata
    assert metadata['labels'] == ['time', 'param1', 'param2', 'param3']
    assert metadata['comments'][0] == '# This is an example file'
    test_array = np.array([[1.0e+00, 3.0e+00, 4.0e+00, 5.0e+00],
                           [2.0e+00, 4.0e+00, 5.7e+00, -1.0e-01],
                           [3.0e+00, 1.0e-03, 1.0e+03, 8.0e-01]])
    np.testing.assert_allclose(data.get_array('content'), test_array)
コード例 #21
0
def get_structure():
    """
    Set up Si primitive cell

    fcc Si:
       3.9
       0.5000000000000000    0.5000000000000000    0.0000000000000000
       0.0000000000000000    0.5000000000000000    0.5000000000000000
       0.5000000000000000    0.0000000000000000    0.5000000000000000
    Si
       1
    Cartesian
    0.0000000000000000  0.0000000000000000  0.0000000000000000

    """

    structure_data = DataFactory('structure')
    alat = 3.9
    lattice = np.array([[.5, .5, 0], [0, .5, .5], [.5, 0, .5]]) * alat
    structure = structure_data(cell=lattice)
    positions = [[0.0, 0.0, 0.0]]
    for pos_direct in positions:
        pos_cartesian = np.dot(pos_direct, lattice)
        structure.append_atom(position=pos_cartesian, symbols='Si')
    return structure
コード例 #22
0
def test_input_creation(
    db_test_app,  # pylint: disable=unused-argument
    get_potential_data,
    calc_type,
    potential_type,
    file_regression,
):
    """
    Test the generation of the input file for lammps
    """
    pot_data = get_potential_data(potential_type)
    potential_data = DataFactory('lammps.potential')(
        potential_type=pot_data.type,
        data=pot_data.data,
    )
    parameter_data = get_calc_parameters(
        '17 Aug 2017',
        calc_type,
        potential_data.default_units,
        potential_type,
    )

    calc = CalculationFactory(calc_type)
    content = calc.create_main_input_content(
        parameter_data,
        potential_data,
        kind_symbols=['A', 'B'],
        structure_filename='input.data',
        trajectory_filename='output.traj',
        system_filename='sys_info.txt',
        restart_filename='calc.restart',
    )
    file_regression.check(content)
コード例 #23
0
ファイル: execmanager.py プロジェクト: CasperWA/aiida_core
def _retrieve_singlefiles(job, transport, folder, retrieve_file_list, logger_extra=None):
    """Retrieve files specified through the singlefile list mechanism."""
    singlefile_list = []
    for (linkname, subclassname, filename) in retrieve_file_list:
        execlogger.debug(
            '[retrieval of calc {}] Trying '
            "to retrieve remote singlefile '{}'".format(job.pk, filename),
            extra=logger_extra
        )
        localfilename = os.path.join(folder.abspath, os.path.split(filename)[1])
        transport.get(filename, localfilename, ignore_nonexisting=True)
        singlefile_list.append((linkname, subclassname, localfilename))

    # ignore files that have not been retrieved
    singlefile_list = [i for i in singlefile_list if os.path.exists(i[2])]

    # after retrieving from the cluster, I create the objects
    singlefiles = []
    for (linkname, subclassname, filename) in singlefile_list:
        cls = DataFactory(subclassname)
        singlefile = cls(file=filename)
        singlefile.add_incoming(job, link_type=LinkType.CREATE, link_label=linkname)
        singlefiles.append(singlefile)

    for fil in singlefiles:
        execlogger.debug(
            '[retrieval of calc {}] '
            'Storing retrieved_singlefile={}'.format(job.pk, fil.pk), extra=logger_extra
        )
        fil.store()
コード例 #24
0
def find_substrate(remote=None, structure=None):
    """
    Finds the stored substrate structure.
    If remote is given, goes up and tri
    """
    from aiida_fleur.workflows.base_relax import find_inputs_relax
    from aiida.plugins import DataFactory

    FleurinpData = DataFactory('fleur.fleurinp')

    if remote:
        inputs = find_inputs_relax(remote)
    elif structure:
        from aiida.orm import WorkChainNode
        inc_nodes = structure.get_incoming().all()
        for link in inc_nodes:
            if isinstance(link.node, WorkChainNode):
                relax_wc = link.node
                break

        if 'scf__remote_data' in relax_wc.inputs:
            inputs = find_inputs_relax(relax_wc.inputs.scf__remote_data)
        else:
            return relax_wc.inputs.scf__structure.get_incoming().all()[0].node.get_outgoing().get_node_by_label(
                'substrate').uuid

    if isinstance(inputs, FleurinpData):
        raise ValueError('Did not expect to find Relax WC started from FleurinpData')
    else:
        orig_structure = inputs[0]
        return orig_structure.get_incoming().all()[0].node.get_outgoing().get_node_by_label('substrate').uuid
コード例 #25
0
def get_structure(alat):
    """
    Set up Si primitive cell

    fcc Si:
       alat
       0.5000000000000000    0.5000000000000000    0.0000000000000000
       0.0000000000000000    0.5000000000000000    0.5000000000000000
       0.5000000000000000    0.0000000000000000    0.5000000000000000
    Si
       1
    Cartesian
    0.0000000000000000  0.0000000000000000  0.0000000000000000

    """

    structure_data = DataFactory('structure')
    lattice = np.array([[.5, .5, 0], [0, .5, .5], [.5, 0, .5]]) * alat
    structure = structure_data(cell=lattice)
    positions = [[0.0, 0.0, 0.0]]
    for pos_direct in positions:
        pos_cartesian = np.dot(pos_direct, lattice)
        structure.append_atom(position=pos_cartesian, symbols='Si')
        structure.label = 'silicon_at_{}'.format(str(alat).replace('.', '_'))
    return structure
コード例 #26
0
def main(options):

    ###### setting the gw parameters ######

    Dict = DataFactory('dict')

    params_ip_rpa = {
        'optics': True,
        'chi': True,
        'Chimod': "IP",
        'QpntsRXd': [1., 1.],
        'BndsrnXd': [1., 20.],
        'FFTGvecs': 50,
        'FFTGvecs_units': 'Ry',
        # 'NGsBlkXd': 1,              #For Hartree
        # 'NGsBlkXd_units': 'RL',
        'EnRngeXd': [0.00, 10.],
        'EnRngeXd_units': 'eV',
        'DmRngeXd': [0.15, 0.3],
        'DmRngeXd_units': 'eV',
        'ETStpsXd': 1000,
        'LongDrXd': [1., 0.0, 0.0],
        'X_CPU': "1 1 1 1",
        'X_ROLEs': "q k c v",
    }

    params_gw = Dict(dict=params_gw)

    ###### creation of the YamboCalculation ######

    builder = YamboCalculation.get_builder()
    builder.metadata.options.max_wallclock_seconds = \
            options['max_wallclock_seconds']
    builder.metadata.options.resources = \
            dict = options['resources']

    if 'queue_name' in options:
        builder.metadata.options.queue_name = options['queue_name']

    if 'qos' in options:
        builder.metadata.options.qos = options['qos']

    if 'account' in options:
        builder.metadata.options.account = options['account']

    builder.metadata.options.prepend_text = options['prepend_text']

    builder.parameters = params_gw

    builder.precode_parameters = Dict(dict={})
    builder.settings = Dict(dict={'INITIALISE': False, 'COPY_DBS': False})

    builder.code = load_code(options['yambocode_id'])
    builder.preprocessing_code = load_code(options['yamboprecode_id'])

    builder.parent_folder = load_node(
        options['parent_pk']).outputs.remote_folder

    return builder
コード例 #27
0
    def setUp(self):
        from click.testing import CliRunner
        from aiida.plugins import DataFactory

        DiffParameters = DataFactory('sirius')
        self.parameters = DiffParameters({'ignore-case': True})
        self.parameters.store()
        self.runner = CliRunner()
コード例 #28
0
ファイル: data.py プロジェクト: wangvei/aiida-vasp
def vasp_wavecar(fresh_aiida_env):
    """WAVECAR node and reference fixture."""
    from aiida.plugins import DataFactory
    wavecar_path = data_path('wavecar', 'WAVECAR')
    wavecar = DataFactory('vasp.wavefun')(file=wavecar_path)
    with open(wavecar_path, 'r') as ref_wavecar_fo:
        ref_wavecar = ref_wavecar_fo.read()
    return wavecar, ref_wavecar
コード例 #29
0
ファイル: data.py プロジェクト: wangvei/aiida-vasp
def vasp_chgcar(fresh_aiida_env):
    """CHGCAR node and reference fixture."""
    from aiida.plugins import DataFactory
    chgcar_path = data_path('chgcar', 'CHGCAR')
    chgcar = DataFactory('vasp.chargedensity')(file=chgcar_path)
    with open(chgcar_path, 'r') as ref_chgcar_fo:
        ref_chgcar = ref_chgcar_fo.read()
    return chgcar, ref_chgcar
コード例 #30
0
    def setUp(self):
        from click.testing import CliRunner
        from aiida.plugins import DataFactory

        BigDFTParameters = DataFactory('bigdft')
        self.parameters = BigDFTParameters({'ignore-case': True})
        self.parameters.store()
        self.runner = CliRunner()