Esempio n. 1
0
    def test_test_and_get_code(self):
        """
        Checks that the test_and_get_code functions of the example_helpers
        file behaves as expected.
        """

        from aiida.common.example_helpers import test_and_get_code

        # When asking an existing code, the returned code
        # should be the right one
        code = test_and_get_code('test_code', 'test_input_plugin')
        self.assertEquals(code.label, self.CODE_LABEL,
                          "The code name is not the expected one.")
        self.assertEquals(
            code.get_input_plugin_name(), self.INPUT_PLUGIN_NAME,
            "The input plugin name of the code is not the "
            "expected one.")

        # Check the correct behaviour of the function when asking a code that
        # doesn't exist and when the input doesn't also exist
        with self.assertRaises(ValueError):
            test_and_get_code('no_code',
                              'no_input_plugin',
                              use_exceptions=True)

        with self.assertRaises(ValueError):
            test_and_get_code('no_code',
                              self.INPUT_PLUGIN_NAME,
                              use_exceptions=True)
Esempio n. 2
0
def main(codelabel, block_pockets, submit):
    code = test_and_get_code(codelabel, expected_code_type='raspa')

    # calc object
    calc = code.new_calc()

    # parameters
    parameters = ParameterData(
        dict={
            "GeneralSettings": {
                "SimulationType": "MonteCarlo",
                "NumberOfCycles": 2000,
                "NumberOfInitializationCycles": 2000,
                "PrintEvery": 1000,
                "Forcefield": "GenericMOFs",
                "EwaldPrecision": 1e-6,
                "CutOff": 12.0,
                "Framework": 0,
                "UnitCells": "1 1 1",
                "HeliumVoidFraction": 0.149,
                "ExternalTemperature": 300.0,
                "ExternalPressure": 5e5,
            },
            "Component": [{
                "MoleculeName": "methane",
                "MoleculeDefinition": "TraPPE",
                "TranslationProbability": 0.5,
                "ReinsertionProbability": 0.5,
                "SwapProbability": 1.0,
                "CreateNumberOfMolecules": 0,
            }],
        })
    calc.use_parameters(parameters)

    # structure
    pwd = os.path.dirname(os.path.realpath(__file__))
    framework = CifData(file=pwd + '/test_raspa_attach_file/TCC1RS.cif')
    calc.use_structure(framework)

    # block pockets
    bp = load_node(block_pockets)
    calc.use_block_component_0(bp)

    # resources
    calc.set_max_wallclock_seconds(30 * 60)  # 30 min
    calc.set_resources({"num_machines": 1, "num_mpiprocs_per_machine": 1})
    calc.set_withmpi(False)
    #calc.set_queue_name("serial")

    if submit:
        calc.store_all()
        calc.submit()
        print(("submitted calculation; calc=Calculation(uuid='{}') # ID={}"\
                .format(calc.uuid,calc.dbnode.pk)))
    else:
        subfolder = calc.submit_test()[0]
        path = os.path.relpath(subfolder.abspath)
        print("submission test successful")
        print(("Find remote folder in {}".format(path)))
        print("In order to actually submit, add '--submit'")
Esempio n. 3
0
def main(codelabel, submit):
    code = test_and_get_code(codelabel, expected_code_type='raspa')

    # calc object
    calc = code.new_calc()

    # parameters
    parameters = ParameterData(
        dict={
            "GeneralSettings": {
                "SimulationType": "MonteCarlo",
                "NumberOfCycles": 2000,
                "NumberOfInitializationCycles": 2000,
                "PrintEvery": 1000,
                "Forcefield": "GenericMOFs",
                "EwaldPrecision": 1e-6,
                "CutOff": 12.0,
                "Box": 0,
                "BoxLengths": "25 25 25",
                "ExternalTemperature": 300.0,
                "ExternalPressure": 5e5,
            },
            "Component": [{
                "MoleculeName": "propane",
                "MoleculeDefinition": "TraPPE",
                "TranslationProbability": 1.0,
                "ReinsertionProbability": 1.0,
                "SwapProbability": 1.0,
                "CreateNumberOfMolecules": 30,
            }, {
                "MoleculeName": "butane",
                "MoleculeDefinition": "TraPPE",
                "TranslationProbability": 1.0,
                "ReinsertionProbability": 1.0,
                "SwapProbability": 1.0,
                "CreateNumberOfMolecules": 30,
            }],
        })
    calc.use_parameters(parameters)

    # resources
    calc.set_max_wallclock_seconds(30 * 60)  # 30 min
    calc.set_resources({"num_machines": 1, "num_mpiprocs_per_machine": 1})
    calc.set_withmpi(False)
    #calc.set_queue_name("serial")

    if submit:
        calc.store_all()
        calc.submit()
        print(("submitted calculation; calc=Calculation(uuid='{}') # ID={}"\
                .format(calc.uuid,calc.dbnode.pk)))
    else:
        subfolder = calc.submit_test()[0]
        path = os.path.relpath(subfolder.abspath)
        print("submission test successful")
        print(("Find remote folder in {}".format(path)))
        print("In order to actually submit, add '--submit'")
def main(codelabel, block_pockets):
    code = test_and_get_code(codelabel, expected_code_type='raspa')

    options_dict = {
        "resources": {
            "num_machines": 1,
            "num_mpiprocs_per_machine": 1,
        },
        "max_wallclock_seconds": 3 * 60 * 60,
    }

    options = ParameterData(dict=options_dict)

    params_dict = {
        "GeneralSettings": {
            "SimulationType": "MonteCarlo",
            "NumberOfCycles": 2000,
            "NumberOfInitializationCycles": 2000,
            "PrintEvery": 1000,
            "Forcefield": "GenericMOFs",
            "EwaldPrecision": 1e-6,
            "CutOff": 12.0,
            "Framework": 0,
            "UnitCells": "1 1 1",
            "HeliumVoidFraction": 0.149,
            "ExternalTemperature": 300.0,
            "ExternalPressure": 5e5,
        },
        "Component": [{
            "MoleculeName": "methane",
            "MoleculeDefinition": "TraPPE",
            "TranslationProbability": 0.5,
            "ReinsertionProbability": 0.5,
            "SwapProbability": 1.0,
            "CreateNumberOfMolecules": 0,
        }],
    }
    parameters = ParameterData(dict=params_dict)

    # structure
    pwd = os.path.dirname(os.path.realpath(__file__))
    structure = CifData(file=pwd + '/test_raspa_attach_file/TCC1RS.cif')

    # block pockets
    bp = load_node(block_pockets)

    submit(
        RaspaConvergeWorkChain,
        code=code,
        structure=structure,
        parameters=parameters,
        block_component_0=bp,
        options=options,
        _label='MyFirstWokchain',
    )
Esempio n. 5
0
def run_fleur_benchmark(code, inp_files_folder_path_list,
                        wf_para_base_dict_list):
    """
    Executes fleur_scf_wcs for every path given in the inp_files_folder_path_list.
    resources and so on are specificed in the dictionaries in the nested wf_para_base_dict_list (if you want multiple runs for that system).

    designed for running benchmarks from fleur input files.
    """

    # get the code
    # load the system (load an inp.xml file from the disk)
    # launch scf_wc on given systems

    all_res = []

    if len(inp_files_folder_path_list) != len(wf_para_base_dict_list):
        print(
            'Input error: for every input folder path given you have to specify a scf workchian paranode! I abort.'
        )
        return None

    code_node = test_and_get_code(code, 'fleur.fleur')
    #if isinstance(code, Code):
    #    code_node = code
    #else:
    #    code_node = Code.get_from_string(code)

    # create a fleurinp for each
    for i, path in enumerate(inp_files_folder_path_list):
        files = os.listdir(path)
        inpfiles = []
        for name in files:
            inpfiles.append(os.path.join(path, name))
        if inpfiles:
            fleurinp = FleurinpData(files=inpfiles)
            structure = fleurinp.get_structuredata_nwf()  #fleurinp)
            formula = structure.get_formula()
        else:
            print(('No files found in {}'.format(path)))
            continue
        scf_para = wf_para_base_dict_list[i]
        print(scf_para)
        label = 'fleur_scf_benchmark_run_{}'.format(formula)
        description = 'Fleur benchmark run on system {} with resources {}'.format(
            formula, scf_para['resources'])
        print(('submitting {}'.format(label)))
        res = submit(FleurScfWorkChain,
                     wf_parameters=Dict(dict=scf_para),
                     fleurinp=fleurinp,
                     fleur=code_node,
                     _label=label,
                     _description=description)
        all_res.append(res)
    return all_res
Esempio n. 6
0
def main(codename, cp2k_calculation_pk, submit):
    """Command line interface for testing and submitting calculations.

    Usage: ./cli.py CODENAME CP2K_CALCULATION
    
    CODENAME       from "verdi code setup"

    COMPUTER_NAME  from "verdi calculation list -a"

    This script extends submit.py, adding flexibility in the selected code/computer.
    """
    code = test_and_get_code(codename, expected_code_type='ddec')

    # input parameters
    parameters = ParameterData(dict=input_dict)

    # set up calculation
    calc = code.new_calc()
    calc.label = "aiida_plugin_template computes 2*3"
    calc.description = "Test job submission with the aiida_plugin_template plugin"
    calc.set_max_wallclock_seconds(30 * 60)  # 30 min

    calc.set_withmpi(False)
    calc.set_resources({"num_machines": 1})
    calc.use_parameters(parameters)

    # use cp2k calculations
    cp2k_calc = load_node(int(cp2k_calculation_pk))
    calc.use_charge_density_folder(cp2k_calc.out.remote_folder)

    if submit:
        calc.store_all()
        calc.submit()
        print("submitted calculation; calc=Calculation(uuid='{}') # ID={}"\
                .format(calc.uuid,calc.dbnode.pk))
    else:
        subfolder, script_filename = calc.submit_test()
        path = os.path.relpath(subfolder.abspath)
        print("submission test successful")
        print("Find remote folder in {}".format(path))
        print("In order to actually submit, add '--submit'")
Esempio n. 7
0
         "MoleculeName"                  : "methane",
         "MoleculeDefinition"            : "TraPPE",
         "MolFraction"                   : 1.0,
         "TranslationProbability"        : 1.0,
         "RotationProbability"           : 1.0,
         "ReinsertionProbability"        : 1.0,
         "SwapProbability"               : 1.0,
         "CreateNumberOfMolecules"       : 0,
    }],
})

# Calculation resources
options = {
    "resources": {
        "num_machines": 1,                 # run on 1 node
        "tot_num_mpiprocs": 1,             # use 1 process
        "num_mpiprocs_per_machine": 1,
    },
    "max_wallclock_seconds": 1 * 60 * 60,  # 1h walltime
    "max_memory_kb": 2000000,              # 2GB memory
    "queue_name": "molsim",                # slurm partition to use
    "withmpi": False,                      # we run in serial mode
}

submit(RaspaCalculation.process(),
    code=test_and_get_code("raspa@bazis", expected_code_type='raspa'),
    structure=load_node("<uuid>"),
    parameters=parameters,
    _options=options
)
Esempio n. 8
0
from aiida.backends import settings
if not is_dbenv_loaded():
    load_dbenv(profile=settings.AIIDADB_PROFILE)

from aiida.common.example_helpers import test_and_get_code  # noqa
from aiida.orm.data.structure import StructureData  # noqa
from aiida.orm.data.parameter import ParameterData  # noqa
from aiida.orm.data.singlefile import SinglefileData  # noqa

# ==============================================================================
if len(sys.argv) != 2:
    print("Usage: test_dft.py <code_name>")
    sys.exit(1)

codename = sys.argv[1]
code = test_and_get_code(codename, expected_code_type='cp2k')

print("Testing CP2K ENERGY on H2O (DFT)...")

# calc object
calc = code.new_calc()

# structure
atoms = ase.build.molecule('H2O')
atoms.center(vacuum=2.0)
structure = StructureData(ase=atoms)
calc.use_structure(structure)

# parameters
parameters = ParameterData(
    dict={
Esempio n. 9
0
            "Framework": 0,
            "UnitCells": "1 1 1",
            "ExternalTemperature": 298.0,
        },
        "Component": [{
            "MoleculeName": "tip4p",
            "MoleculeDefinition": "tip4p",
            "TranslationProbability": 0.5,
            "RotationProbability": 0.5,
            "ReinsertionProbability": 0.5,
            "SwapProbability": 1.0,
            "CreateNumberOfMolecules": 0,
        }],
    })

zeopp_code = test_and_get_code('zeopp@fidis',
                               expected_code_type='zeopp.network')
raspa_code = test_and_get_code('raspa2@fidis', expected_code_type='raspa')

for cif in cifs:
    for pressure in pressures:
        structure = CifData(file=cif)
        submit(
            ResubmitGCMC,
            structure=structure,
            zeopp_probe_radius=Float(probe_radius),
            number_runs=Float(number_runs),
            pressure=Float(pressure),
            zeopp_code=zeopp_code,
            _zeopp_options=zr_options,
            zeopp_atomic_radii=atomic_radii,
            raspa_code=raspa_code,
Esempio n. 10
0
try:
    codename = sys.argv[2]
except IndexError:
    codename = None

# If True, load the pseudos from the family specified below
# Otherwise, use static files provided
auto_pseudos = True

queue = None
# queue = "Q_aries_free"
settings = None
#####

code = test_and_get_code(codename, expected_code_type='quantumespresso.neb')

cell = [
    [
        4.0,
        0.,
        0.,
    ],
    [
        0.,
        4.0,
        0.,
    ],
    [
        0.,
        0.,
Esempio n. 11
0
        raise IndexError
except IndexError:
    print(('The first parameter can only be either ' '--send or --dont-send'), file=sys.stderr)
    sys.exit(1)

try:
    codename = sys.argv[2]
except IndexError:
    codename = None

queue = None
# queue = "th1_small"
settings = None
#####

code = test_and_get_code(codename, expected_code_type='fleur_inp.fleurinputgen')
bohr_a_0 = 0.52917721092  # A

# Cr_delta_inp
a = 5.425405929900 * bohr_a_0
cell = [[a, 0., 0.], [0., a, 0.], [0., 0., a]]
Cr = StructureData(cell=cell)
Cr.append_atom(position=(0., 0., 0.), symbols='Cr', name='Cr1')
pos2 = rel_to_abs((1. / 2., 1. / 2., 1. / 2.), cell)
Cr.append_atom(position=pos2, symbols='Cr', name='Cr2')
Crp = Dict(
    dict={
        'title': 'Cr, bcc chromium, bulk, delta project',
        'atom1': {
            'element': 'Cr',
            'id': '24.0',
Esempio n. 12
0
structure = load_node(int(structure_pk))

try:
    pw_codename = sys.argv[2]
except IndexError:
    print >> sys.stderr, "The second parameter must be the pw code name"
    sys.exit(1)

try:
    ph_codename = sys.argv[3]
except IndexError:
    print >> sys.stderr, "The third parameter must be the ph code name"
    sys.exit(1)

# validate codes and pseudopotential family
test_and_get_code(pw_codename,'quantumespresso.pw')
test_and_get_code(ph_codename,'quantumespresso.ph')
validate_upf_family(pseudo_family, structure.get_kind_names())

try:
    wien2k_EOS_pk = sys.argv[4]
except IndexError:
    print >> sys.stderr, ("The fourth parameter must be the pk of the Wien2k SinglefileData")
    sys.exit(1)

try:
    band_kpoints_pk = sys.argv[5]
except IndexError:
    print >> sys.stderr, ("The fifth parameter must be the pk of the KpointsData used for band structure convergence")
    sys.exit(1)
Esempio n. 13
0
except IndexError:
    print >> sys.stderr, ("The first parameter can only be either "
                          "--send or --dont-send")
    sys.exit(1)

try:
    codename = sys.argv[2]
except IndexError:
    codename = None

queue = None
#queue = "Q_aries_free"
settings = None
#####

code = test_and_get_code(codename, expected_code_type='nwchem.basic')

alat = 4.  # angstrom
cell = [
    [
        alat,
        0.,
        0.,
    ],
    [
        0.,
        alat,
        0.,
    ],
    [
        0.,
Esempio n. 14
0
    print >> sys.stderr, 'Parent_id not an integer: {}'.format(parent_id)
    sys.exit(1)

try:
    nnkp_file_id = int(nnkp_file_id)
except ValueError:
    print >> sys.stderr, 'nnkp_file_id not an integer: {}'.format(nnkp_file_id)
    sys.exit(1)

nnkp_file = load_node(nnkp_file_id)
if not isinstance(nnkp_file, DataFactory('singlefile')):
    print >> sys.stderr, 'The provided nnkp_file is not an SinglefileData: {}'.format(
        nnkp_file_id)
    sys.exit(1)

code = test_and_get_code(codename,
                         expected_code_type='quantumespresso.pw2wannier90')

computer = code.get_remote_computer()

parameters = ParameterData(dict={
    'INPUTPP': {
        'write_unk': True,
        'write_amn': True,
        'write_mmn': True,
    },
})

parentcalc = load_node(parent_id)

# calc = code.new_calc(computer=computer)
calc = code.new_calc()
Esempio n. 15
0
    else:
        raise IndexError
except IndexError:
    print >> sys.stderr, ("The first parameter can only be either "
                          "--send or --dont-send")
    sys.exit(1)

try:
    codename = sys.argv[2]
except IndexError:
    codename = None

queue = None
settings = None

code = test_and_get_code(codename, expected_code_type='quantumespresso.pw')
max_seconds = 600

kpoints = KpointsData()
kpoints_mesh = 4
kpoints.set_kpoints_mesh([kpoints_mesh, kpoints_mesh, kpoints_mesh])

from aiida.tools.dbimporters.plugins.cod import CodDbImporter
from aiida.orm.data.cif import parse_formula
codi = CodDbImporter()

launched_calcs = {}

## SQL query, executed in the COD database:
## select file, formula
## from data
Esempio n. 16
0
        codename = sys.argv.pop(0)
    elif arg == '--arg':
        argkey = None
        argval = None
        if '=' in sys.argv[0]:
            argkey, argval = sys.argv.pop(0).split('=', 1)
        else:
            argkey = sys.argv.pop(0)
            argval = True
        if argkey not in options.keys():
            options[argkey] = []
        options[argkey].append(argval)
    else:
        files.append(arg)

code = test_and_get_code(codename, expected_code_type="codtools.ciffilter")

cif = None
if len(files) == 1:
    cif = CifData(file=os.path.abspath(files[0]))
else:
    raise ValueError("Please specify a single CIF file")

parameters = ParameterData(dict=options)
computer = Computer.get(Computer.list_names()[0])

calc = code.new_calc()
calc.label = "Test cod-tools cif_molecule"
calc.description = "Test calculation with the cod-tools cif_molecule"
calc.set_max_wallclock_seconds(30 * 60)  # 30 min
calc.set_resources({"num_machines": 1,
Esempio n. 17
0
            "HeliumVoidFraction": 0.0,
            "ExternalTemperature": 298.0,
            "ExternalPressure": 58e4,
        },
        "Component": [{
            "MoleculeName": "CO2",
            "MoleculeDefinition": "TraPPE",
            "TranslationProbability": 0.5,
            "RotationProbability": 0.5,
            "ReinsertionProbability": 0.5,
            "SwapProbability": 1.0,
            "CreateNumberOfMolecules": 0,
        }],
    })

zeopp_code = test_and_get_code('zeopp@deneb',
                               expected_code_type='zeopp.network')
raspa_code = test_and_get_code('raspa@deneb', expected_code_type='raspa')

pressures = ArrayData()
pressures.set_array("pressures", np.array([0.01e5]))
submit(
    Isotherm,
    structure=structure,
    probe_radius=Float(1.525),
    pressures=pressures,
    min_cell_size=Float(10.0),
    zeopp_code=zeopp_code,
    _zeopp_options=zr_options,
    raspa_code=raspa_code,
    raspa_parameters=raspa_parameters,
    _raspa_options=zr_options,
Esempio n. 18
0
from aiida.backends import settings
if not is_dbenv_loaded():
    load_dbenv(profile=settings.AIIDADB_PROFILE)

from aiida.common.example_helpers import test_and_get_code
from aiida.orm.data.cif import CifData
from aiida.orm.data.parameter import ParameterData
from aiida.orm.data.singlefile import SinglefileData

# ==============================================================================
if len(sys.argv) != 3:
    print("Usage: test_raspa.py <code_name> parent_calc_pk")
    sys.exit(1)

codename = sys.argv[1]
code = test_and_get_code(codename, expected_code_type='raspa')

parent_calc = int(sys.argv[2])

print("Testing RASPA...")

# calc object
calc = code.new_calc()

# parameters
parameters = ParameterData(
    dict={
        "GeneralSettings": {
            "SimulationType": "MonteCarlo",
            "NumberOfCycles": 2000,
            "NumberOfInitializationCycles": 2000,
Esempio n. 19
0
        codename = sys.argv.pop(0)
    elif arg == '--arg':
        argkey = None
        argval = None
        if '=' in sys.argv[0]:
            argkey, argval = sys.argv.pop(0).split('=', 1)
        else:
            argkey = sys.argv.pop(0)
            argval = True
        if argkey not in options.keys():
            options[argkey] = []
        options[argkey].append(argval)
    else:
        files.append(arg)

code = test_and_get_code(codename, expected_code_type="codtools.cifcellcontents")

cif = None
if len(files) == 1:
    cif = CifData(file=os.path.abspath(files[0]))
else:
    raise ValueError("Please specify a single CIF file")

parameters = ParameterData(dict=options)
computer = Computer.get(Computer.list_names()[0])

calc = code.new_calc()
calc.label = "Test cod-tools cif_cell_contents"
calc.description = "Test calculation with the cod-tools cif_cell_contents"
calc.set_max_wallclock_seconds(30 * 60)  # 30 min
calc.set_resources({"num_machines": 1,
Esempio n. 20
0
settings_dict = {'also_bands': True}
settings = ParameterData(dict=settings_dict)

# calc.label = "Test QE pw.x"
# calc.description = "Test calculation with the Quantum ESPRESSO pw.x code"
# Valid only for Slurm and PBS (using default values for the
# number_cpus_per_machine), change for SGE-like schedulers

JobCalc = PwCalculation.process()

# Inputs
inputs = JobCalc.get_inputs_template()
inputs.structure = s
inputs.parameters = parameters
inputs.kpoints = kpoints
inputs.code = test_and_get_code(codename,
                                expected_code_type='quantumespresso.pw')

# Calculation options
options = inputs._options
options.max_wallclock_seconds = 30 * 60  # 30 min
options.resources = {"num_machines": 1, "num_mpiprocs_per_machine": 8}
options.custom_scheduler_commands = u"#SBATCH --account=ch3"
if run_in_serial_mode:
    options.withmpi = False
if queue is not None:
    options.queue_name = queue

if settings is not None:
    inputs.settings = settings

    # if auto_pseudos:
Esempio n. 21
0
        submit_test = False
    else:
        raise IndexError
except IndexError:
    print >> sys.stderr, ("The first parameter can only be either "
                          "--send or --dont-send")
    sys.exit(1)

#####- Code ----------------------------------------------------

try:
    codename = sys.argv[2]
except IndexError:
    codename = 'go-2.0.0@cm135'

code = test_and_get_code(codename, expected_code_type='gollum.gollum')

#####- Set up calculation object -------------------------------

calc = code.new_calc()
calc.label = "Test Gollum. Spin-polarized chain"
calc.description = "Test calculation with the Gollum code. Spin-pol chain"

#####- Settings ------------------------------------------------

emname = os.path.realpath(os.path.join(os.path.dirname(__file__),
    "../data"))+'/Extended_Molecule'
l1name = os.path.realpath(os.path.join(os.path.dirname(__file__),
    "../data"))+'/Lead_1'
l2name = os.path.realpath(os.path.join(os.path.dirname(__file__),
    "../data"))+'/Lead_2'
Esempio n. 22
0
    kpoints_wf.append(kmesh)
    kpoints.store()
    structures_wf.append(struct)
    scaled_struct, new_k = scale_structure(kmesh, struct, json_hpc['scale'])
    scaled_struct.store()
    param = calc.get_inputs_dict()['parameters'].get_attrs()
    extras = calc.get_extras()

    parameters = set_dict(param, args.json_pw, 1, 1)
    pw_parameters = ParameterData(dict=parameters)
    pw_parameters.store()
    pw_parameters_wf.append(pw_parameters)
    hpc_parameters = ParameterData(dict=json_hpc)
    hpc_parameters.store()

    code = test_and_get_code(args.code,
                             expected_code_type='quantumespresso.pw')
    UpfData.get_upf_group(pseudo_family)
    hpc_workflow_params.update({
        'pw_codename_' + str(count): args.code,
        'structure_' + str(count): scaled_struct,
        'hpc_params_' + str(count): hpc_parameters,
        'pseudo_family_' + str(count): pseudo_family,
        'kpoints_' + str(count): new_k,
        'pw_parameters_' + str(count): pw_parameters,
        'extras_' + str(count): extras
    })
    keys.append(count)
    count += 1

wf_params = {}
bench = BenchWorkflow()
Esempio n. 23
0
cp2k_options = {
    "resources": {
        "num_machines": 1,
    },
    "max_wallclock_seconds": 1 * 60 * 60,
}

ddec_options = {
    "resources": {
        "num_machines": 1,
    },
    "max_wallclock_seconds": 1 * 60 * 60,
    "withmpi": False,
}

cp2k_code = test_and_get_code('cp2k_6.1_18464@daint-s746',
                              expected_code_type='cp2k')
ddec_code = test_and_get_code('chargemol_09_26_2017@daint-s746',
                              expected_code_type='ddec')

ddec_params = ParameterData(
    dict={
        "net charge":
        0.0,
        "charge type":
        "DDEC6",
        "periodicity along A, B, and C vectors": [
            True,
            True,
            True,
        ],
        "compute BOs":
Esempio n. 24
0
except IndexError:
    print >> sys.stderr, ("The first parameter can only be either "
                          "--send or --dont-send")
    sys.exit(1)

try:
    codename = sys.argv[2]
except IndexError:
    codename = None

queue = None
#queue = "Q_aries_free"
settings = None
#####

code = test_and_get_code(codename, expected_code_type='nwchem.nwcpymatgen')

calc = code.new_calc()
calc.label = "Test NWChem"
calc.description = "Test calculation with the NWChem SCF code"
calc.set_max_wallclock_seconds(30 * 60)  # 30 min
calc.set_resources({"num_machines": 1})

if queue is not None:
    calc.set_queue_name(queue)

parameters = ParameterData(
    dict={
        'tasks': [{
            'theory': 'scf',
            'basis_set': {
Esempio n. 25
0
        },
        'GEO_OPT': {
            'MAX_ITER': 5,
        },
        'CELL_OPT': {
            'MAX_ITER': 5,
        },
    },
}
ddec_options = {
    "resources": {
        "num_machines": 1,
    },
    "max_wallclock_seconds": 1 * 60 * 60 / 2,
    "withmpi": False,
}
cp2k_parameters = ParameterData(dict=params_dict)
cp2k_code = test_and_get_code('cp2k@fidis-debug', expected_code_type='cp2k')
ddec_code = test_and_get_code('ddec@fidis-debug', expected_code_type='ddec')
submit(
    Cp2kGeoOptDdecWorkChain,
    structure=structure,
    cp2k_code=cp2k_code,
    cp2k_parameters=cp2k_parameters,
    _cp2k_options=cp2k_options,
    ddec_code=ddec_code,
    _ddec_options=ddec_options,
    _label='MyFirstWokchain',
    _guess_multiplicity=True,
)
Esempio n. 26
0
structure = StructureData(ase=atoms)
structure.label = 'H2O'
structure.store()
options_dict = {
    "resources": {
        "num_machines": 1,
        "num_mpiprocs_per_machine": 2,
    },
    "max_wallclock_seconds": 3 * 60 * 60,
}
options = ParameterData(dict=options_dict)

params_dict = {
    'FORCE_EVAL': {
        'DFT': {
            'UKS': True,
        },
    },
}

parameters = ParameterData(dict=params_dict)
code = test_and_get_code('cp2k@localhost', expected_code_type='cp2k')
submit(
    Cp2kGeoOptWorkChain,
    code=code,
    structure=structure,
    parameters=parameters,
    options=options,
    _label='MyFirstWokchain',
)
Esempio n. 27
0
    "max_wallclock_seconds": 1 * 60 * 60,
    'prepend_text': '#SBATCH --partition=debug',
}

options = ParameterData(dict=options_dict)

params_dict = {
    'MOTION': {
        'MD': {
            'STEPS': 5,
        },
        'GEO_OPT': {
            'MAX_ITER': 5,
        },
        'CELL_OPT': {
            'MAX_ITER': 5,
        },
    },
}
parameters = ParameterData(dict=params_dict)
code = test_and_get_code('cp2k-5.1@fidis', expected_code_type='cp2k')
submit(
    Cp2kRobustGeoOptWorkChain,
    code=code,
    structure=structure,
    parameters=parameters,
    options=options,
    _label='MyFirstWokchain',
    _guess_multiplicity=True,
)
Esempio n. 28
0
    print(('The first parameter can only be either '
           '--send or --dont-send'),
          file=sys.stderr)
    sys.exit(1)

try:
    codename = sys.argv[2]
except IndexError:
    codename = None

queue = None
# queue = "th1_small"
settings = None
#####

code = test_and_get_code(codename, expected_code_type='fleur.fleur')

#TODO: how to make smart path?
# get where tests folder is, then relative path
inpxmlfile = '/usr/users/iff_th1/broeder/aiida/github/aiida_fleur_plugin/tests/inp_xml_files/Fe_bctXML/files/inp.xml'
symout = '/usr/users/iff_th1/broeder/aiida/github/aiida_fleur_plugin/tests/inp_xml_files/Fe_bctXML/files/sym.out'

fleurinp = FleurinpData(files=[inpxmlfile, symout])
print(fleurinp.files)
## For remote codes, it is not necessary to manually set the computer,
## since it is set automatically by new_calc
#computer = code.get_remote_computer()
#calc = code.new_calc(computer=computer)

calc = code.new_calc()
calc.label = 'Fe_bct Fleur test'
Esempio n. 29
0
from aiida.common.example_helpers import test_and_get_code  # noqa
from aiida.orm.data.structure import StructureData  # noqa
from aiida.orm.data.parameter import ParameterData  # noqa
from aiida.orm.data.base import Str
from aiida.work.run import submit

from ase.io import read
from cp2k import Cp2kDftBaseWorkChain

atoms = read('Fe-MOF-74_h111.xyz')
atoms.cell = [[6.96775, 0.00000, 0.00000], [-2.33067, 15.22261, 0.00000],
              [-2.32566, -7.57517, 13.22945]]

structure = StructureData(ase=atoms)
structure.store()
options_dict = {
    "resources": {
        "num_machines": 2,
        "num_mpiprocs_per_machine": 12,
    },
    "max_wallclock_seconds": 8 * 60 * 60,
}
options = ParameterData(dict=options_dict)
code = test_and_get_code('cp2k@daint', expected_code_type='cp2k')
submit(
    Cp2kDftBaseWorkChain,
    code=code,
    structure=structure,
    options=options,
)
                          "--send or --dont-send")
    sys.exit(1)

try:
    codename = sys.argv[2]
except IndexError:
    codename = 'Siesta-4.0@rinaldo'

# If True, load the pseudos from the family specified below
# Otherwise, use static files provided
auto_pseudos = True

queue = None
settings = None

code = test_and_get_code(codename, expected_code_type='siesta.siesta')

alat = 5.430  # angstrom
cell = [
    [
        0.5 * alat,
        0.5 * alat,
        0.,
    ],
    [
        0.,
        0.5 * alat,
        0.5 * alat,
    ],
    [
        0.5 * alat,
Esempio n. 31
0
    def start(self):
        """
        Checks the parameters
        """
        self.append_to_report("Checking input parameters")

        mandatory_pw_keys = [
            ('structure', StructureData,
             "the structure (a previously stored StructureData object)"),
            ('pseudo_family', basestring, 'the pseudopotential family'),
            ('pw_kpoints', KpointsData,
             'A KpointsData object with the kpoint mesh used by PWscf'),
            #('pw_calculation_set',dict,'A dictionary with resources, walltime, ...'),
            ('pw_parameters', dict, "A dictionary with the PW input parameters"
             ),
        ]
        mandatory_ph_keys = [
            ('ph_qpoints', KpointsData,
             'A KpointsData object with the kpoint mesh used by PWscf'),
            ('ph_calculation_set', dict,
             'A dictionary with resources, walltime, ...'),
            ('ph_parameters', dict,
             "A dictionary with the PH input parameters"),
        ]
        mandatory_dispersion_keys = [
            ('dispersion_calculation_set', dict,
             'A dictionary with resources, walltime, ...'),
        ]

        main_params = self.get_parameters()

        # validate the codes
        for kind, key in [
            ['quantumespresso.pw', 'pw_codename'],
            ['quantumespresso.ph', 'ph_codename'],
            ['quantumespresso.q2r', 'dispersion_q2r_codename'],
            ['quantumespresso.matdyn', 'dispersion_matdyn_codename'],
        ]:
            try:
                test_and_get_code(main_params[key], kind, use_exceptions=True)
            except KeyError:
                # none of the codes is always required
                pass

        # case of restart from phonon calculation
        if 'ph_calculation' in main_params:
            if isinstance(main_params['ph_calculation'], PhCalculation):
                helpers.validate_keys(main_params, mandatory_dispersion_keys)
                self.next(self.run_q2r)
                return
            else:
                raise TypeError("parameter 'ph_calculation' should be a "
                                "PhCalculation")

        # case of restart from phonon folder
        if 'ph_folder' in main_params:
            if isinstance(main_params['ph_folder'], DataFactory('folder')):
                helpers.validate_keys(main_params, mandatory_dispersion_keys)
                self.next(self.run_q2r)
                return
            else:
                raise TypeError("parameter 'ph_folder' should be a FolderData")

        # validate phonon keys
        helpers.validate_keys(main_params, mandatory_ph_keys)

        if 'pw_calculation' in main_params:
            if isinstance(main_params['pw_calculation'], PwCalculation):
                # if pw is a calculation, launch directly from the PH step
                self.next(self.run_ph)
                return
            else:
                raise TypeError("parameter 'pw_calculation' should be a "
                                "PwCalculation")

        # validate Pw keys
        helpers.validate_keys(main_params, mandatory_pw_keys)

        # start from Pw calculation
        self.next(self.run_pw)