From 27534133ae2d482a80dcad57e7286f1c94f53c0e Mon Sep 17 00:00:00 2001 From: Miriam Pougin Date: Sat, 26 Aug 2023 14:38:31 +0200 Subject: [PATCH] Add `aiida-core==2.X` support --- .style.yapf | 3 - .yamllint | 18 --- aiida_lsmo/calcfunctions/oxidation_state.py | 2 +- aiida_lsmo/calcfunctions/selectivity.py | 2 +- aiida_lsmo/calcfunctions/working_cap.py | 6 +- aiida_lsmo/calcfunctions/wrappers.py | 4 +- aiida_lsmo/utils/multiply_unitcell.py | 2 +- aiida_lsmo/utils/other_utilities.py | 5 +- aiida_lsmo/workchains/binding_site.py | 4 +- aiida_lsmo/workchains/cp2k_binding_energy.py | 6 +- aiida_lsmo/workchains/cp2k_multistage.py | 4 +- aiida_lsmo/workchains/cp2k_multistage_ddec.py | 6 +- aiida_lsmo/workchains/cp2k_phonopy.py | 18 +-- aiida_lsmo/workchains/isotherm.py | 18 +-- aiida_lsmo/workchains/isotherm_accurate.py | 16 +-- aiida_lsmo/workchains/isotherm_calc_pe.py | 2 +- aiida_lsmo/workchains/isotherm_inflection.py | 14 +-- aiida_lsmo/workchains/isotherm_multi_temp.py | 4 +- aiida_lsmo/workchains/multicomp_ads_des.py | 16 +-- aiida_lsmo/workchains/multicomp_gcmc.py | 12 +- aiida_lsmo/workchains/sim_annealing.py | 10 +- aiida_lsmo/workchains/singlecomp_widom.py | 8 +- .../workchains/zeopp_multistage_ddec.py | 2 +- examples/__init__.py | 4 - examples/data/__init__.py | 0 examples/go.sh | 117 ++++++++++++++++++ .../run_BindingSiteWorkChain_MOF74_CO2.py | 6 +- examples/run_BindingSiteWorkChain_MOF74_O2.py | 10 +- examples/run_Cp2kMultistageWorkChain_2_H2O.py | 4 +- .../run_Cp2kMultistageWorkChain_Cu_HKUST-1.py | 15 ++- examples/run_Cp2kMultistageWorkChain_H2O.py | 2 +- .../run_Cp2kMultistageWorkChain_H2O_fail.py | 2 +- ...n_Cp2kMultistageWorkChain_H2O_test_file.py | 2 +- examples/run_Cp2kPhonopyWorkChain.py | 4 +- ...n_IsothermAccurateWorkChain_Graphite_Ar.py | 6 +- examples/run_IsothermCalcPE_HKUST-1.py | 4 +- .../run_IsothermMultiTempWorkChain_HKUST-1.py | 4 +- .../run_IsothermMultiTempWorkChain_TCC1RS.py | 4 +- examples/run_IsothermWorkChain_COF-1.py | 4 +- examples/run_IsothermWorkChain_HKUST-1.py | 4 +- .../run_IsothermWorkChain_HKUST-1_onlyKh.py | 4 +- examples/run_IsothermWorkChain_TCC1RS.py | 4 +- ...un_MulticompGcmcWorkChain_HKUST-1_2comp.py | 8 +- ...un_MulticompGcmcWorkChain_HKUST-1_3comp.py | 8 +- ...run_SimAnnealingWorkChain_HKUST-1_3xCO2.py | 4 +- ...run_SimAnnealingWorkChain_HKUST-1_3xDMA.py | 6 +- examples/run_SinglecompWidomWorkChain_Box.py | 4 +- .../run_SinglecompWidomWorkChain_HKUST-1.py | 4 +- .../run_SinglecompWidomWorkChain_custom.py | 4 +- .../run_ZeoppMultistageDdecWorkChain_H2O.py | 4 +- ...bmit_ZeoppMultistageDdecWorkChain_COF-5.py | 4 +- examples/test_Cp2kBindingEnergy_CO2_MOF74.py | 4 +- .../test_Cp2kMultistageDdecWorkChain_H2O.py | 4 +- examples/test_Cp2kMultistageWorkChain_Al.py | 6 +- ...IsothermInflectionWorkChain_graphite_Ar.py | 6 +- examples/test_IsothermWorkChain_Mg-MOF74.py | 4 +- .../test_MulticompAdsDesWorkChain_HKUST-1.py | 14 ++- .../test_MulticompGcmcWorkChain_Box_3comp.py | 6 +- .../test_SimAnnealingWorkChain_MOF74_CO2.py | 4 +- pyproject.toml | 20 ++- tests/test_calc_ch4_working_cap.py | 2 +- tests/test_ffbuilder.py | 2 +- tests/test_get_molecule_from_restart_file.py | 8 +- 63 files changed, 302 insertions(+), 206 deletions(-) delete mode 100644 .style.yapf delete mode 100644 .yamllint create mode 100644 examples/data/__init__.py create mode 100644 examples/go.sh diff --git a/.style.yapf b/.style.yapf deleted file mode 100644 index b3d849f2..00000000 --- a/.style.yapf +++ /dev/null @@ -1,3 +0,0 @@ -[style] -based_on_style = google -column_limit = 120 diff --git a/.yamllint b/.yamllint deleted file mode 100644 index 996a82b1..00000000 --- a/.yamllint +++ /dev/null @@ -1,18 +0,0 @@ -extends: default -rules: - document-start: disable - braces: - max-spaces-inside: 1 - level: error - brackets: - max-spaces-inside: 1 - level: error - line-length: - max: 160 - level: warning - truthy: disable - indentation: - spaces: 2 - indent-sequences: false -ignore: | - default/roles diff --git a/aiida_lsmo/calcfunctions/oxidation_state.py b/aiida_lsmo/calcfunctions/oxidation_state.py index f187a147..e8af24d2 100644 --- a/aiida_lsmo/calcfunctions/oxidation_state.py +++ b/aiida_lsmo/calcfunctions/oxidation_state.py @@ -22,4 +22,4 @@ def compute_oxidation_states(cif): } results_dict['oximachine_version'] = str(OXIMACHINE_RUNNER) - return Dict(dict=results_dict) + return Dict(results_dict) diff --git a/aiida_lsmo/calcfunctions/selectivity.py b/aiida_lsmo/calcfunctions/selectivity.py index 8660b14e..5e85f4bc 100644 --- a/aiida_lsmo/calcfunctions/selectivity.py +++ b/aiida_lsmo/calcfunctions/selectivity.py @@ -25,4 +25,4 @@ def calc_selectivity(isot_dict_a, isot_dict_b): out_dict['selectivity_dev'] = out_dict['selectivity_average'] * sqrt( (isot_dict_a['henry_coefficient_dev'] / isot_dict_a['henry_coefficient_average']) + (isot_dict_b['henry_coefficient_dev'] / isot_dict_b['henry_coefficient_average'])) - return Dict(dict=out_dict) + return Dict(out_dict) diff --git a/aiida_lsmo/calcfunctions/working_cap.py b/aiida_lsmo/calcfunctions/working_cap.py index 15e2921b..d5ffea03 100644 --- a/aiida_lsmo/calcfunctions/working_cap.py +++ b/aiida_lsmo/calcfunctions/working_cap.py @@ -59,7 +59,7 @@ def calc_ch4_working_cap(isot_dict): 'wc_65bar_fraction': wc_65bar_fract, 'wc_65bar_fraction_unit': '-', }) - return Dict(dict=out_dict) + return Dict(out_dict) @calcfunction @@ -112,7 +112,7 @@ def calc_h2_working_cap(isotmt_dict): # pylint: disable=too-many-locals 'case-{}_{}_dev'.format(case, unit): sqrt(load_dev**2 + disc_dev**2) * conv }) - return Dict(dict=out_dict) + return Dict(out_dict) @calcfunction @@ -161,4 +161,4 @@ def calc_o2_working_cap(isot_dict): 'wc_140bar_fraction': wc_140bar_fract, 'wc_140bar_fraction_unit': '-', }) - return Dict(dict=out_dict) + return Dict(out_dict) diff --git a/aiida_lsmo/calcfunctions/wrappers.py b/aiida_lsmo/calcfunctions/wrappers.py index 5736399f..169b047b 100644 --- a/aiida_lsmo/calcfunctions/wrappers.py +++ b/aiida_lsmo/calcfunctions/wrappers.py @@ -26,7 +26,7 @@ def calc_co2_parasitic_energy(isot_co2, isot_n2, pe_parameters): from calc_pe import mainPE if not isot_co2['is_porous'] or not isot_n2['is_porous']: - return Dict(dict={'is_porous': False}) + return Dict({'is_porous': False}) bar2pa = 1e5 # convert pressure from bar to Pa gcm2kgm = 1000 # convert density from g/cm3 to kg/m3 @@ -53,4 +53,4 @@ def calc_co2_parasitic_energy(isot_co2, isot_n2, pe_parameters): ) pe_dict['is_porous'] = True - return Dict(dict=pe_dict) + return Dict(pe_dict) diff --git a/aiida_lsmo/utils/multiply_unitcell.py b/aiida_lsmo/utils/multiply_unitcell.py index 71238a12..38cff513 100644 --- a/aiida_lsmo/utils/multiply_unitcell.py +++ b/aiida_lsmo/utils/multiply_unitcell.py @@ -60,7 +60,7 @@ def angle(vect1, vect2): 'ny': int(ceil(thr / perpwidth[1])), 'nz': int(ceil(thr / perpwidth[2])) } - return Dict(dict=resize) + return Dict(resize) @calcfunction diff --git a/aiida_lsmo/utils/other_utilities.py b/aiida_lsmo/utils/other_utilities.py index ee3f28ad..b8e37de2 100644 --- a/aiida_lsmo/utils/other_utilities.py +++ b/aiida_lsmo/utils/other_utilities.py @@ -7,6 +7,7 @@ from aiida.orm import Dict, CifData, StructureData from aiida.engine import calcfunction +from collections.abc import Mapping def dict_merge(dct, merge_dct): """ Taken from https://gist.github.com/angstwad/bf22d1822c38a92ec0a9 @@ -19,7 +20,7 @@ def dict_merge(dct, merge_dct): :return: None """ for k in merge_dct.keys(): - if (k in dct and isinstance(dct[k], dict) and isinstance(merge_dct[k], collections.Mapping)): + if (k in dct and isinstance(dct[k], dict) and isinstance(merge_dct[k], Mapping)): dict_merge(dct[k], merge_dct[k]) else: dct[k] = merge_dct[k] @@ -35,7 +36,7 @@ def aiida_dict_merge(to_dict, from_dict): dict_merge(to_dict, from_dict) - return Dict(dict=to_dict) + return Dict(to_dict) def ase_cells_are_similar(ase_a, ase_b, thr=2): diff --git a/aiida_lsmo/workchains/binding_site.py b/aiida_lsmo/workchains/binding_site.py index fde8c254..7c0c2e99 100644 --- a/aiida_lsmo/workchains/binding_site.py +++ b/aiida_lsmo/workchains/binding_site.py @@ -10,8 +10,8 @@ Cp2kBindingEnergyWorkChain = WorkflowFactory('lsmo.cp2k_binding_energy') # pylint: disable=invalid-name # import aiida data -StructureData = DataFactory('structure') # pylint: disable=invalid-name -CifData = DataFactory('cif') # pylint: disable=invalid-name +StructureData = DataFactory('core.structure') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name class BindingSiteWorkChain(WorkChain): diff --git a/aiida_lsmo/workchains/cp2k_binding_energy.py b/aiida_lsmo/workchains/cp2k_binding_energy.py index 2a114ce8..09059b48 100644 --- a/aiida_lsmo/workchains/cp2k_binding_energy.py +++ b/aiida_lsmo/workchains/cp2k_binding_energy.py @@ -36,7 +36,7 @@ def get_output_parameters(**cp2k_out_dict): if key in cp2k_out_dict['bsse'].get_dict(): # "binding_energy_dispersion" may miss output_dict[key] = cp2k_out_dict['bsse'][key] - return Dict(dict=output_dict) + return Dict(output_dict) @calcfunction @@ -185,7 +185,7 @@ def run_geo_opt(self): if 'parameters' in self.exposed_inputs(Cp2kBaseWorkChain, 'cp2k_base')['cp2k']: dict_merge(self.ctx.cp2k_param, self.exposed_inputs(Cp2kBaseWorkChain, 'cp2k_base')['cp2k']['parameters'].get_dict()) - self.ctx.base_inp['cp2k']['parameters'] = Dict(dict=self.ctx.cp2k_param) + self.ctx.base_inp['cp2k']['parameters'] = Dict(self.ctx.cp2k_param) self.ctx.base_inp['metadata'].update({'label': 'geo_opt_molecule', 'call_link_label': 'run_geo_opt_molecule'}) self.ctx.base_inp['cp2k']['metadata'].update({'label': 'GEO_OPT'}) self.ctx.base_inp['cp2k']['metadata']['options']['parser_name'] = 'lsmo.cp2k_advanced_parser' @@ -250,7 +250,7 @@ def run_bsse(self): if 'parameters' in self.exposed_inputs(Cp2kBaseWorkChain, 'cp2k_base')['cp2k']: dict_merge(self.ctx.cp2k_param, self.exposed_inputs(Cp2kBaseWorkChain, 'cp2k_base')['cp2k']['parameters'].get_dict()) - self.ctx.base_inp['cp2k']['parameters'] = Dict(dict=self.ctx.cp2k_param) + self.ctx.base_inp['cp2k']['parameters'] = Dict(self.ctx.cp2k_param) self.ctx.base_inp['cp2k']['structure'] = self.ctx.stages[-1].outputs.output_structure self.ctx.base_inp['metadata'].update({'label': 'bsse', 'call_link_label': 'run_bsse'}) self.ctx.base_inp['cp2k']['metadata'].update({'label': 'BSSE'}) diff --git a/aiida_lsmo/workchains/cp2k_multistage.py b/aiida_lsmo/workchains/cp2k_multistage.py index c77321d3..9a0c8fc7 100644 --- a/aiida_lsmo/workchains/cp2k_multistage.py +++ b/aiida_lsmo/workchains/cp2k_multistage.py @@ -68,7 +68,7 @@ def apply_initial_magnetization(structure, protocol, oxidation_states=None, with cp2k_param = get_kinds_section(atoms=atoms, protocol=protocol_dict, with_ghost_atoms=bool(with_ghost_atoms)) dict_merge(cp2k_param, get_multiplicity_section(atoms=atoms, protocol=protocol_dict)) - return {'structure': StructureData(ase=atoms), 'cp2k_param': Dict(dict=cp2k_param)} + return {'structure': StructureData(ase=atoms), 'cp2k_param': Dict(cp2k_param)} @calcfunction @@ -137,7 +137,7 @@ def extract_results(resize, **kwargs): output_dict['final_bandgap_spin1_au'] = kwarg['bandgap_spin1_au'] output_dict['final_bandgap_spin2_au'] = kwarg['bandgap_spin2_au'] - return Dict(dict=output_dict) + return Dict(output_dict) class Cp2kMultistageWorkChain(WorkChain): diff --git a/aiida_lsmo/workchains/cp2k_multistage_ddec.py b/aiida_lsmo/workchains/cp2k_multistage_ddec.py index 06d54800..9cc947d2 100644 --- a/aiida_lsmo/workchains/cp2k_multistage_ddec.py +++ b/aiida_lsmo/workchains/cp2k_multistage_ddec.py @@ -14,8 +14,8 @@ DdecCalculation = CalculationFactory('ddec') # pylint: disable=invalid-name # import aiida data -Dict = DataFactory('dict') # pylint: disable=invalid-name -CifData = DataFactory('cif') # pylint: disable=invalid-name +Dict = DataFactory('core.dict') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name class Cp2kMultistageDdecWorkChain(WorkChain): @@ -50,7 +50,7 @@ def run_cp2kddec(self): cp2k_ddec_inputs = AttributeDict(self.exposed_inputs(Cp2kDdecWorkChain)) cp2k_ddec_inputs['cp2k_base'] = self.exposed_inputs(Cp2kMultistageWorkChain)['cp2k_base'] cp2k_params_modify = Dict( - dict={ + { 'FORCE_EVAL': { 'DFT': { 'WFN_RESTART_FILE_NAME': './parent_calc/aiida-RESTART.wfn', diff --git a/aiida_lsmo/workchains/cp2k_phonopy.py b/aiida_lsmo/workchains/cp2k_phonopy.py index ff7a929f..84a131b4 100644 --- a/aiida_lsmo/workchains/cp2k_phonopy.py +++ b/aiida_lsmo/workchains/cp2k_phonopy.py @@ -18,13 +18,13 @@ Cp2kBaseWorkChain = WorkflowFactory('cp2k.base') # pylint: disable=invalid-name # import aiida data -Str = DataFactory('str') # pylint: disable=invalid-name -Int = DataFactory('int') # pylint: disable=invalid-name -List = DataFactory('list') # pylint: disable=invalid-name -Dict = DataFactory('dict') # pylint: disable=invalid-name -CifData = DataFactory('cif') # pylint: disable=invalid-name -StructureData = DataFactory('structure') # pylint: disable=invalid-name -SinglefileData = DataFactory('singlefile') # pylint: disable=invalid-name +Str = DataFactory('core.str') # pylint: disable=invalid-name +Int = DataFactory('core.int') # pylint: disable=invalid-name +List = DataFactory('core.list') # pylint: disable=invalid-name +Dict = DataFactory('core.dict') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name +StructureData = DataFactory('core.structure') # pylint: disable=invalid-name +SinglefileData = DataFactory('core.singlefile') # pylint: disable=invalid-name class Cp2kPhonopyWorkChain(WorkChain): @@ -92,7 +92,7 @@ def collect_cp2k_inputs(self): # Collect the other inputs for Cp2kBaseWC from the ref_cp2k_calc to self.ctx.base_inp self.ctx.base_inp = AttributeDict(self.exposed_inputs(Cp2kBaseWorkChain, 'cp2k_base')) - self.ctx.base_inp['cp2k']['settings'] = Dict(dict={'additional_retrieve_list': ['aiida-forces-1_0.xyz']}) + self.ctx.base_inp['cp2k']['settings'] = Dict({'additional_retrieve_list': ['aiida-forces-1_0.xyz']}) self.ctx.base_inp['cp2k']['parent_calc_folder'] = ref_cp2k_calc.outputs.remote_folder self.ctx.base_inp['cp2k']['file'] = {} if 'file' in ref_cp2k_calc.inputs: @@ -226,7 +226,7 @@ def results(self): sets_of_forces.append(forces_parsed) # Output the forces of the initial structure as a List - initial_forces = List(list=sets_of_forces[0]) + initial_forces = List(sets_of_forces[0]) initial_forces.store() self.out('initial_forces', initial_forces) self.report(f'Forces computed on the input structure: List<{initial_forces.pk}>') diff --git a/aiida_lsmo/workchains/isotherm.py b/aiida_lsmo/workchains/isotherm.py index fe412945..4c238f98 100644 --- a/aiida_lsmo/workchains/isotherm.py +++ b/aiida_lsmo/workchains/isotherm.py @@ -20,7 +20,7 @@ FFBuilder = CalculationFactory('lsmo.ff_builder') # pylint: disable=invalid-name # import aiida data -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name ZeoppParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -35,7 +35,7 @@ def get_molecule_dict(molecule_name): yaml_dict = yaml.safe_load(stream) ISOTHERM_MOLECULES_SCHEMA(yaml_dict) molecule_dict = yaml_dict[molecule_name.value] - return Dict(dict=molecule_dict) + return Dict(molecule_dict) @calcfunction @@ -71,7 +71,7 @@ def get_ff_parameters(molecule_dict, isotparam): ff_params['tail_corrections'] = isotparam['ff_tail_corrections'] ff_params['mixing_rule'] = isotparam['ff_mixing_rule'] ff_params['separate_interactions'] = isotparam['ff_separate_interactions'] - return Dict(dict=ff_params) + return Dict(ff_params) @calcfunction @@ -95,7 +95,7 @@ def choose_pressure_points(inp_param, geom, raspa_widom_out): else: pressure_points.append(inp_param['pressure_max']) break - return List(list=pressure_points) + return List(pressure_points) @calcfunction @@ -107,7 +107,7 @@ def get_geometric_dict(zeopp_out, molecule): 'Estimated_saturation_loading_unit': 'mol/kg', 'is_porous': geometric_dict['POAV_A^3'] > 0.000 }) - return Dict(dict=geometric_dict) + return Dict(geometric_dict) @calcfunction @@ -172,7 +172,7 @@ def get_output_parameters(geom_out, inp_params, widom_out=None, pressures=None, 'conversion_factor_molec_uc_to_mol_kg': gcmc_out_mol['conversion_factor_molec_uc_to_mol_kg'], }) - return Dict(dict=out_dict) + return Dict(out_dict) class IsothermWorkChain(WorkChain): @@ -283,7 +283,7 @@ def setup(self): # Get the parameters Dict, merging defaults with user settings @calcfunction def get_valid_dict(dict_node): - return Dict(dict=self.parameters_schema(dict_node.get_dict())) + return Dict(self.parameters_schema(dict_node.get_dict())) self.ctx.parameters = get_valid_dict(self.inputs.parameters) @@ -416,7 +416,7 @@ def run_raspa_widom(self): self.ctx.inp['raspa']['block_pocket'] = {'block_file': self.ctx.zeopp.outputs.block} self.ctx.raspa_param = self._get_widom_param() - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) # Generate the force field with the ff_builder ff_params = get_ff_parameters(self.ctx.molecule, self.ctx.parameters) @@ -502,7 +502,7 @@ def run_raspa_gcmc(self): self.ctx.pressures[self.ctx.current_p_index] * 1e5 # Update parameters Dict - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) # Update restart (if present, i.e., if current_p_index>0) if self.ctx.current_p_index > 0: diff --git a/aiida_lsmo/workchains/isotherm_accurate.py b/aiida_lsmo/workchains/isotherm_accurate.py index dcad5bd8..bd5adf67 100644 --- a/aiida_lsmo/workchains/isotherm_accurate.py +++ b/aiida_lsmo/workchains/isotherm_accurate.py @@ -20,7 +20,7 @@ FFBuilder = CalculationFactory('lsmo.ff_builder') # pylint: disable=invalid-name # import aiida data -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name ZeoppParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -35,7 +35,7 @@ def get_molecule_dict(molecule_name): yaml_dict = yaml.safe_load(stream) ISOTHERM_MOLECULES_SCHEMA(yaml_dict) molecule_dict = yaml_dict[molecule_name.value] - return Dict(dict=molecule_dict) + return Dict(molecule_dict) @calcfunction @@ -71,7 +71,7 @@ def get_ff_parameters(molecule_dict, isotparam): ff_params['tail_corrections'] = isotparam['ff_tail_corrections'] ff_params['mixing_rule'] = isotparam['ff_mixing_rule'] ff_params['separate_interactions'] = isotparam['ff_separate_interactions'] - return Dict(dict=ff_params) + return Dict(ff_params) @calcfunction @@ -83,7 +83,7 @@ def get_geometric_dict(zeopp_out, molecule): 'Estimated_saturation_loading_unit': 'mol/kg', 'is_porous': geometric_dict['POAV_A^3'] > 0.000 }) - return Dict(dict=geometric_dict) + return Dict(geometric_dict) @calcfunction @@ -153,7 +153,7 @@ def get_output_parameters(geom_out, inp_params, widom_out=None, **gcmc_out_dict) 'conversion_factor_molec_uc_to_mol_kg': gcmc_out_mol['conversion_factor_molec_uc_to_mol_kg'], }) - return Dict(dict=out_dict) + return Dict(out_dict) class IsothermAccurateWorkChain(WorkChain): @@ -266,7 +266,7 @@ def setup(self): # Get the parameters Dict, merging defaults with user settings @calcfunction def get_valid_dict(dict_node): - return Dict(dict=self.parameters_schema(dict_node.get_dict())) + return Dict(self.parameters_schema(dict_node.get_dict())) self.ctx.parameters = get_valid_dict(self.inputs.parameters) @@ -405,7 +405,7 @@ def run_raspa_widom(self): self.ctx.inp['raspa']['block_pocket'] = {'block_file': self.ctx.zeopp.outputs.block} self.ctx.raspa_param = self._get_widom_param() - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) # Generate the force field with the ff_builder ff_params = get_ff_parameters(self.ctx.molecule, self.ctx.parameters) @@ -557,7 +557,7 @@ def run_raspa_gcmc(self): self.ctx.raspa_param['System']['framework_1']['ExternalPressure'] = self.ctx.pressure * 1e5 # Update parameters Dict - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) # Update restart (if present, i.e., if current_p_index>0) if 'raspa_gcmc' in self.ctx: diff --git a/aiida_lsmo/workchains/isotherm_calc_pe.py b/aiida_lsmo/workchains/isotherm_calc_pe.py index 49d043da..60400c60 100644 --- a/aiida_lsmo/workchains/isotherm_calc_pe.py +++ b/aiida_lsmo/workchains/isotherm_calc_pe.py @@ -14,7 +14,7 @@ IsothermWorkChain = WorkflowFactory('lsmo.isotherm') #pylint: disable=invalid-name # import aiida data -CifData = DataFactory('cif') #pylint: disable=invalid-name +CifData = DataFactory('core.cif') #pylint: disable=invalid-name class IsothermCalcPEWorkChain(WorkChain): diff --git a/aiida_lsmo/workchains/isotherm_inflection.py b/aiida_lsmo/workchains/isotherm_inflection.py index 83b71bd9..e6626655 100644 --- a/aiida_lsmo/workchains/isotherm_inflection.py +++ b/aiida_lsmo/workchains/isotherm_inflection.py @@ -16,7 +16,7 @@ RaspaBaseWorkChain = WorkflowFactory('raspa.base') # pylint: disable=invalid-name ZeoppCalculation = CalculationFactory('zeopp.network') # pylint: disable=invalid-name FFBuilder = CalculationFactory('lsmo.ff_builder') # pylint: disable=invalid-name -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name ZeoppParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name NAVO = 6.022E+23 # molec/mol @@ -36,7 +36,7 @@ def get_pressure_points(molecule_dict, isotparam): exp_max = np.log10(isotparam['pressure_max'] * molecule_dict['pressure_zero']) exp_list = np.linspace(exp_min, exp_max, isotparam['pressure_num']) pressure_points = [10**x for x in exp_list] - return List(list=pressure_points) + return List(pressure_points) @calcfunction @@ -106,7 +106,7 @@ def get_output_parameters(inp_params, pressures, geom_out, widom_out, **gcmc_dic out_dict['isotherm'] = isotherm - return Dict(dict=out_dict) + return Dict(out_dict) class IsothermInflectionWorkChain(WorkChain): @@ -202,7 +202,7 @@ def setup(self): # Get the parameters Dict, merging defaults with user settings @calcfunction def get_valid_dict(dict_node): - return Dict(dict=self.parameters_schema(dict_node.get_dict())) + return Dict(self.parameters_schema(dict_node.get_dict())) self.ctx.parameters = get_valid_dict(self.inputs.parameters) @@ -366,7 +366,7 @@ def run_raspa_widom_and_sat(self): self.ctx.inp['raspa']['block_pocket'] = {'block_file': self.ctx.zeopp.outputs.block} self.ctx.raspa_param = self._get_widom_param() - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) # Generate the force field with the ff_builder ff_params = get_ff_parameters(self.ctx.molecule, self.ctx.parameters) @@ -386,7 +386,7 @@ def run_raspa_widom_and_sat(self): nmolecules = int(0.90 * self._get_saturation_molecules()) self.ctx.raspa_param = self._update_param_for_gcmc(number_of_molecules=nmolecules, swap_prob=0.01) - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) running = self.submit(RaspaBaseWorkChain, **self.ctx.inp) @@ -413,7 +413,7 @@ def run_raspa_gcmc_from_dil_sat(self): self.ctx.raspa_param['System']['framework_1']['ExternalPressure'] = self.ctx.pressures[i] * 1e5 # Update parameters Dict - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) if inp == 'dil': pass diff --git a/aiida_lsmo/workchains/isotherm_multi_temp.py b/aiida_lsmo/workchains/isotherm_multi_temp.py index 52395165..e3b52c64 100644 --- a/aiida_lsmo/workchains/isotherm_multi_temp.py +++ b/aiida_lsmo/workchains/isotherm_multi_temp.py @@ -16,7 +16,7 @@ def get_parameters_singletemp(i, parameters): parameters_singletemp = parameters.get_dict() parameters_singletemp['temperature'] = parameters_singletemp['temperature_list'][i] del parameters_singletemp['temperature_list'] - return Dict(dict=parameters_singletemp) + return Dict(parameters_singletemp) @calcfunction @@ -48,7 +48,7 @@ def get_output_parameters(geom_dict, **isotherm_dict): for label in single_temp_labels: out_dict[label] = isotherm_out_i[label] - return Dict(dict=out_dict) + return Dict(out_dict) class IsothermMultiTempWorkChain(WorkChain): diff --git a/aiida_lsmo/workchains/multicomp_ads_des.py b/aiida_lsmo/workchains/multicomp_ads_des.py index 7c5eeaa9..360cc9f3 100644 --- a/aiida_lsmo/workchains/multicomp_ads_des.py +++ b/aiida_lsmo/workchains/multicomp_ads_des.py @@ -16,7 +16,7 @@ RaspaBaseWorkChain = WorkflowFactory('raspa.base') #pylint: disable=invalid-name # Defining DataFactory, CalculationFactory and default parameters -CifData = DataFactory('cif') #pylint: disable=invalid-name +CifData = DataFactory('core.cif') #pylint: disable=invalid-name ZeoppParameters = DataFactory('zeopp.parameters') #pylint: disable=invalid-name ZeoppCalculation = CalculationFactory('zeopp.network') #pylint: disable=invalid-name @@ -47,7 +47,7 @@ def get_components_dict(conditions, parameters): 'ha': 'DEF', 'block': [probe_rad * parameters['zeopp_probe_scaling'], parameters['zeopp_block_samples']], } - return Dict(dict=components_dict) + return Dict(components_dict) @calcfunction @@ -64,7 +64,7 @@ def get_ff_parameters(components, isotparams): for value in components.get_dict().values(): ff = value['forcefield'] #pylint: disable=invalid-name ff_params['ff_molecules'][value['name']] = ff - return Dict(dict=ff_params) + return Dict(ff_params) @calcfunction @@ -83,7 +83,7 @@ def get_geometric_output(zeopp_out): """Return the geometric_output Dict from Zeopp results, including is_porous""" geometric_output = zeopp_out.get_dict() geometric_output.update({'is_porous': geometric_output['POAV_A^3'] > 0.000}) - return Dict(dict=geometric_output) + return Dict(geometric_output) @calcfunction @@ -139,7 +139,7 @@ def get_output_parameters(inp_conditions, components, **all_out_dicts): #pylint work_cap = out_dict['loading_absolute_average'][comp][0] - out_dict['loading_absolute_average'][comp][1] out_dict['working_capacity'][comp] = work_cap - return Dict(dict=out_dict) + return Dict(out_dict) class MulticompAdsDesWorkChain(WorkChain): @@ -200,7 +200,7 @@ def setup(self): @calcfunction def get_valid_dict(dict_node): - return Dict(dict=self.parameters_schema(dict_node.get_dict())) + return Dict(self.parameters_schema(dict_node.get_dict())) self.ctx.parameters = get_valid_dict(self.inputs.parameters) self.ctx.components = get_components_dict(self.inputs.conditions, self.ctx.parameters) @@ -328,7 +328,7 @@ def run_raspa_gcmc_ads(self): gcmc_label = 'RaspaGCMC_Ads' self.ctx.raspa_inputs['metadata']['label'] = gcmc_label self.ctx.raspa_inputs['metadata']['call_link_label'] = 'run_raspa_gcmc_ads' - self.ctx.raspa_inputs['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.raspa_inputs['raspa']['parameters'] = Dict(self.ctx.raspa_param) running = self.submit(RaspaBaseWorkChain, **self.ctx.raspa_inputs) self.report('Running Raspa GCMC @ Adsorption conditions') self.to_context(**{gcmc_label: running}) @@ -339,7 +339,7 @@ def run_raspa_gcmc_des(self): gcmc_label = 'RaspaGCMC_Des' self.ctx.raspa_inputs['metadata']['label'] = gcmc_label self.ctx.raspa_inputs['metadata']['call_link_label'] = 'run_raspa_gcmc_des' - self.ctx.raspa_inputs['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.raspa_inputs['raspa']['parameters'] = Dict(self.ctx.raspa_param) running = self.submit(RaspaBaseWorkChain, **self.ctx.raspa_inputs) self.report('Running Raspa GCMC @ Desorption conditions') self.to_context(**{gcmc_label: running}) diff --git a/aiida_lsmo/workchains/multicomp_gcmc.py b/aiida_lsmo/workchains/multicomp_gcmc.py index 3031ffc5..812a0f40 100644 --- a/aiida_lsmo/workchains/multicomp_gcmc.py +++ b/aiida_lsmo/workchains/multicomp_gcmc.py @@ -16,7 +16,7 @@ RaspaBaseWorkChain = WorkflowFactory('raspa.base') #pylint: disable=invalid-name # Defining DataFactory, CalculationFactory and default parameters -CifData = DataFactory('cif') #pylint: disable=invalid-name +CifData = DataFactory('core.cif') #pylint: disable=invalid-name ZeoppParameters = DataFactory('zeopp.parameters') #pylint: disable=invalid-name ZeoppCalculation = CalculationFactory('zeopp.network') #pylint: disable=invalid-name @@ -48,7 +48,7 @@ def get_components_dict(conditions, parameters): 'ha': 'DEF', 'block': [probe_rad * parameters['zeopp_probe_scaling'], parameters['zeopp_block_samples']], } - return Dict(dict=components_dict) + return Dict(components_dict) @calcfunction @@ -65,7 +65,7 @@ def get_ff_parameters(components, isotparams): for value in components.get_dict().values(): ff = value['forcefield'] #pylint: disable=invalid-name ff_params['ff_molecules'][value['name']] = ff - return Dict(dict=ff_params) + return Dict(ff_params) @calcfunction @@ -130,7 +130,7 @@ def get_output_parameters(inp_conditions, components, **all_out_dicts): #pylint gcmc_out['components'][comp][label] = 0 out_dict[label][comp] = conv_ener * gcmc_out['components'][comp][label] - return Dict(dict=out_dict) + return Dict(out_dict) class MulticompGcmcWorkChain(WorkChain): @@ -190,7 +190,7 @@ def setup(self): # Get the parameters Dict, merging defaults with user settings @calcfunction def get_valid_dict(dict_node): - return Dict(dict=self.parameters_schema(dict_node.get_dict())) + return Dict(self.parameters_schema(dict_node.get_dict())) self.ctx.parameters = get_valid_dict(self.inputs.parameters) self.ctx.components = get_components_dict(self.inputs.conditions, self.ctx.parameters) @@ -299,7 +299,7 @@ def run_raspa_gcmc(self): system_key = list(self.ctx.raspa_param['System'].keys())[0] self.ctx.raspa_param['System'][system_key]['ExternalTemperature'] = temp #K self.ctx.raspa_param['System'][system_key]['ExternalPressure'] = press * 1e5 # Pa - self.ctx.raspa_inputs['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.raspa_inputs['raspa']['parameters'] = Dict(self.ctx.raspa_param) running = self.submit(RaspaBaseWorkChain, **self.ctx.raspa_inputs) self.report('Running Raspa GCMC #{} @ {} K, {} bar'.format(i, temp, press)) self.to_context(**{gcmc_label: running}) diff --git a/aiida_lsmo/workchains/sim_annealing.py b/aiida_lsmo/workchains/sim_annealing.py index a4f88cd9..78ab968e 100644 --- a/aiida_lsmo/workchains/sim_annealing.py +++ b/aiida_lsmo/workchains/sim_annealing.py @@ -21,7 +21,7 @@ FFBuilder = CalculationFactory('lsmo.ff_builder') # pylint: disable=invalid-name # import aiida data -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name # calcfunctions (in order of appearence) @@ -93,7 +93,7 @@ def get_output_parameters(input_dict, min_out_dict, **nvt_out_dict): for key in key_list: out_dict[key].append(min_out_dict['framework_1']['general'][key]) - return Dict(dict=out_dict) + return Dict(out_dict) class SimAnnealingWorkChain(WorkChain): @@ -201,7 +201,7 @@ def setup(self): # Get the parameters Dict, merging defaults with user settings @calcfunction def get_valid_dict(dict_node): - return Dict(dict=self.parameters_schema(dict_node.get_dict())) + return Dict(self.parameters_schema(dict_node.get_dict())) self.ctx.parameters = get_valid_dict(self.inputs.parameters) @@ -231,7 +231,7 @@ def run_raspa_nvt(self): if self.ctx.count > 0: self.ctx.inp['raspa']['retrieved_parent_folder'] = self.ctx.raspa_nvt[self.ctx.count - 1].outputs.retrieved - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) self.ctx.inp['metadata']['label'] = 'RaspaNVT_{}'.format(self.ctx.count + 1) self.ctx.inp['metadata']['call_link_label'] = 'run_raspa_nvt_{}'.format(self.ctx.count + 1) @@ -255,7 +255,7 @@ def run_raspa_min(self): 'RMSGradientTolerance': 1e-6, 'MaxGradientTolerance': 1e-6, }) - self.ctx.inp['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.inp['raspa']['parameters'] = Dict(self.ctx.raspa_param) self.ctx.inp['raspa']['retrieved_parent_folder'] = self.ctx.raspa_nvt[self.ctx.count - 1].outputs.retrieved self.ctx.inp['metadata']['label'] = 'RaspaMin' self.ctx.inp['metadata']['call_link_label'] = 'run_raspa_min' diff --git a/aiida_lsmo/workchains/singlecomp_widom.py b/aiida_lsmo/workchains/singlecomp_widom.py index 7c438150..4e6fd08d 100644 --- a/aiida_lsmo/workchains/singlecomp_widom.py +++ b/aiida_lsmo/workchains/singlecomp_widom.py @@ -15,7 +15,7 @@ RaspaBaseWorkChain = WorkflowFactory('raspa.base') #pylint: disable=invalid-name # Defining DataFactory, CalculationFactory and default parameters -CifData = DataFactory('cif') #pylint: disable=invalid-name +CifData = DataFactory('core.cif') #pylint: disable=invalid-name ZeoppParameters = DataFactory('zeopp.parameters') #pylint: disable=invalid-name ZeoppCalculation = CalculationFactory('zeopp.network') #pylint: disable=invalid-name @@ -60,7 +60,7 @@ def get_output_parameters(inp_parameters, **all_out_dicts): comp_key = list(output_widom[system_key]['components'].keys())[0] out_dict[key].append(output_widom[system_key]['components'][comp_key][key]) - return Dict(dict=out_dict) + return Dict(out_dict) class SinglecompWidomWorkChain(WorkChain): @@ -114,7 +114,7 @@ def setup(self): # Get the parameters Dict, merging defaults with user settings @calcfunction def get_valid_dict(dict_node): - return Dict(dict=self.parameters_schema(dict_node.get_dict())) + return Dict(self.parameters_schema(dict_node.get_dict())) self.ctx.parameters = get_valid_dict(self.inputs.parameters) if isinstance(self.inputs.molecule, Str): @@ -219,7 +219,7 @@ def run_raspa_widom(self): self.ctx.raspa_inputs['metadata']['call_link_label'] = f'run_{widom_label}' system_key = list(self.ctx.raspa_param['System'].keys())[0] self.ctx.raspa_param['System'][system_key]['ExternalTemperature'] = temp - self.ctx.raspa_inputs['raspa']['parameters'] = Dict(dict=self.ctx.raspa_param) + self.ctx.raspa_inputs['raspa']['parameters'] = Dict(self.ctx.raspa_param) running = self.submit(RaspaBaseWorkChain, **self.ctx.raspa_inputs) self.report(f"Running Raspa Widom @ {temp}K for the Henry coefficient of <{self.ctx.molecule['name']}>") self.to_context(**{widom_label: running}) diff --git a/aiida_lsmo/workchains/zeopp_multistage_ddec.py b/aiida_lsmo/workchains/zeopp_multistage_ddec.py index 99922b11..3ad34cc9 100644 --- a/aiida_lsmo/workchains/zeopp_multistage_ddec.py +++ b/aiida_lsmo/workchains/zeopp_multistage_ddec.py @@ -17,7 +17,7 @@ ZeoppCalculation = CalculationFactory('zeopp.network') # pylint: disable=invalid-name # import aiida data -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name diff --git a/examples/__init__.py b/examples/__init__.py index 11491d91..82ebba1b 100644 --- a/examples/__init__.py +++ b/examples/__init__.py @@ -1,6 +1,2 @@ # -*- coding: utf-8 -*- """Examples of how to run work chains.""" -from pathlib import Path - -THIS_DIR = Path(__file__).resolve().parent -DATA_DIR = THIS_DIR / 'data' diff --git a/examples/data/__init__.py b/examples/data/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/examples/go.sh b/examples/go.sh new file mode 100644 index 00000000..fb2332d1 --- /dev/null +++ b/examples/go.sh @@ -0,0 +1,117 @@ +cp2k_code=cp2k@localhost +raspa_code=raspa@localhost +ddec_code=ddec@localhost +zeopp_code=network@localhost + +# verdi run run_BindingSiteWorkChain_MOF74_CO2.py \ +# --cp2k_code $cp2k_code \ +# --raspa_code $raspa_code +# DONE + +# verdi run run_BindingSiteWorkChain_MOF74_O2.py \ +# --cp2k_code $cp2k_code \ +# --raspa_code $raspa_code +# DONE + +# verdi run run_Cp2kMultistageWorkChain_2_H2O.py \ +# --cp2k-code $cp2k_code \ +# DONE + +# verdi run run_Cp2kMultistageWorkChain_Cu_HKUST-1.py \ +# --cp2k-code $cp2k_code \ +# TAKES VERY LONG... + +# verdi run run_Cp2kPhonopyWorkChain.py \ +# --cp2k-code $cp2k_code \ +# --structure-pk 73 +# NOT SURE HOW THIS ONE WORKS + +# verdi run run_IsothermAccurateWorkChain_Graphite_Ar.py $raspa_code $zeopp_code +# GOT STUCK + +# verdi run run_IsothermCalcPE_HKUST-1.py \ +# --raspa_code $raspa_code \ +# --zeopp_code $zeopp_code +# DONE + +# verdi run run_IsothermMultiTempWorkChain_HKUST-1.py \ +# --raspa_code $raspa_code \ +# --zeopp_code $zeopp_code +# DONE + +# verdi run run_IsothermWorkChain_COF-1.py \ +# --raspa_code $raspa_code \ +# --zeopp_code $zeopp_code +# DONE + +# verdi run run_IsothermWorkChain_HKUST-1_onlyKh.py \ +# --raspa_code $raspa_code \ +# --zeopp_code $zeopp_code +# DONE + +# verdi run run_MulticompGcmcWorkChain_HKUST-1_2comp.py \ +# --raspa_code $raspa_code \ +# --zeopp_code $zeopp_code +# DONE + +# verdi run run_SimAnnealingWorkChain_HKUST-1_3xCO2.py \ +# --raspa_code $raspa_code \ +# DONE + +# verdi run run_SinglecompWidomWorkChain_Box.py \ +# --raspa_code $raspa_code \ +# --zeopp_code $zeopp_code +# DONE + +# verdi run run_SinglecompWidomWorkChain_HKUST-1.py \ +# --raspa_code $raspa_code \ +# --zeopp_code $zeopp_code +# DONE + +# verdi run run_ZeoppMultistageDdecWorkChain_H2O.py \ +# --zeopp_code $zeopp_code \ +# --cp2k_code $cp2k_code \ +# --ddec_code $ddec_code \ +# /home/lsmo/project/lsmo/git/aiida-lsmo-codes/data/chargemol/atomic_densities +# TAKES VERY LONG... + +# verdi run test_Cp2kBindingEnergy_CO2_MOF74.py \ +# --cp2k-code $cp2k_code \ +# TAKES VERY LONG... + +# verdi run test_Cp2kMultistageDdecWorkChain_H2O.py \ +# --ddec-code $ddec_code \ +# --cp2k-code $cp2k_code +# TAKES VERY LONG + +# verdi run test_Cp2kMultistageWorkChain_Al.py \ +# --cp2k-code $cp2k_code +# TAKES VERY LONG + +# verdi run test_IsothermInflectionWorkChain_graphite_Ar.py \ +# --raspa-code $raspa_code \ +# --zeopp-code $zeopp_code +# DONE + +# verdi run test_IsothermWorkChain_Mg-MOF74.py \ +# --raspa-code $raspa_code \ +# --zeopp-code $zeopp_code +# DONE + +# verdi run test_MulticompAdsDesWorkChain_HKUST-1.py \ +# --raspa-code $raspa_code \ +# --zeopp-code $zeopp_code +# THIS ONE FAILED ONCE but then worked... + +# verdi run test_MulticompGcmcWorkChain_Box_3comp.py \ +# --raspa-code $raspa_code \ +# --zeopp-code $zeopp_code +# DONE + +verdi run test_SimAnnealingWorkChain_MOF74_CO2.py \ + --raspa-code $raspa_code \ +# DONE + +# Worrying warning: +# /home/lsmo/project/lsmo/git/oximachinerunner/oximachinerunner/__init__.py:319: UserWarning: Oximachine can only predict oxidation states of metals. This structure contains no metals. +# warnings.warn( diff --git a/examples/run_BindingSiteWorkChain_MOF74_CO2.py b/examples/run_BindingSiteWorkChain_MOF74_CO2.py index ed1d9d22..1179bbe7 100755 --- a/examples/run_BindingSiteWorkChain_MOF74_CO2.py +++ b/examples/run_BindingSiteWorkChain_MOF74_CO2.py @@ -14,7 +14,7 @@ BindingSiteWorkChain = WorkflowFactory('lsmo.binding_site') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name @click.command('cli') @@ -48,13 +48,13 @@ def main(raspa_code, cp2k_code): builder.structure = CifData(file=os.path.abspath('data/Zn-MOF-74.cif'), label='Zn-MOF-74') builder.molecule = Str('co2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # (str) Forcefield of the structure. 'mc_steps': int(10), # (int) Number of MC cycles. 'temperature_list': [300, 150], }) builder.protocol_tag = Str('test') - builder.cp2k_base.cp2k.parameters = Dict(dict={ # Lowering CP2K default setting for a faster test calculation + builder.cp2k_base.cp2k.parameters = Dict({ # Lowering CP2K default setting for a faster test calculation 'FORCE_EVAL': { 'DFT': { 'SCF': { diff --git a/examples/run_BindingSiteWorkChain_MOF74_O2.py b/examples/run_BindingSiteWorkChain_MOF74_O2.py index e95fe708..a30f371b 100755 --- a/examples/run_BindingSiteWorkChain_MOF74_O2.py +++ b/examples/run_BindingSiteWorkChain_MOF74_O2.py @@ -7,14 +7,14 @@ from aiida.engine import run from aiida.plugins import DataFactory, WorkflowFactory -from aiida.orm import Dict, Str +from aiida.orm import Dict, Str, Int from aiida import cmdline # Workchain objects BindingSiteWorkChain = WorkflowFactory('lsmo.binding_site') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name @click.command('cli') @@ -48,13 +48,13 @@ def main(raspa_code, cp2k_code): builder.structure = CifData(file=os.path.abspath('data/Zn-MOF-74.cif'), label='Zn-MOF-74') builder.molecule = Str('o2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # (str) Forcefield of the structure. 'mc_steps': int(10), # (int) Number of MC cycles. 'temperature_list': [300, 150], }) builder.protocol_tag = Str('test') - builder.cp2k_base.cp2k.parameters = Dict(dict={ # Lowering CP2K default setting for a faster test calculation + builder.cp2k_base.cp2k.parameters = Dict({ # Lowering CP2K default setting for a faster test calculation 'FORCE_EVAL': { 'DFT': { 'SCF': { @@ -71,7 +71,7 @@ def main(raspa_code, cp2k_code): } }, }) - builder.starting_settings_idx = int(1) + builder.starting_settings_idx = Int(1) run(builder) diff --git a/examples/run_Cp2kMultistageWorkChain_2_H2O.py b/examples/run_Cp2kMultistageWorkChain_2_H2O.py index bca5d243..62596663 100755 --- a/examples/run_Cp2kMultistageWorkChain_2_H2O.py +++ b/examples/run_Cp2kMultistageWorkChain_2_H2O.py @@ -25,8 +25,8 @@ def run_multistage_h2om(cp2k_code): atoms.center(vacuum=2.0) structure = StructureData(ase=atoms) - protocol_mod = Dict(dict={'settings_0': {'FORCE_EVAL': {'DFT': {'MGRID': {'CUTOFF': 300,}}}}}) - parameters = Dict(dict={'FORCE_EVAL': { + protocol_mod = Dict({'settings_0': {'FORCE_EVAL': {'DFT': {'MGRID': {'CUTOFF': 300,}}}}}) + parameters = Dict({'FORCE_EVAL': { 'DFT': { 'UKS': True, 'MULTIPLICITY': 3, diff --git a/examples/run_Cp2kMultistageWorkChain_Cu_HKUST-1.py b/examples/run_Cp2kMultistageWorkChain_Cu_HKUST-1.py index 13f55555..0d2480ac 100755 --- a/examples/run_Cp2kMultistageWorkChain_Cu_HKUST-1.py +++ b/examples/run_Cp2kMultistageWorkChain_Cu_HKUST-1.py @@ -5,31 +5,34 @@ import pytest import click import ase.build +import data + +from importlib.resources import files from aiida.plugins import DataFactory, WorkflowFactory from aiida import cmdline from aiida import engine from aiida.orm import Dict, StructureData, Str, SinglefileData -from . import DATA_DIR + # Workchain objects Cp2kMultistageWorkChain = WorkflowFactory('lsmo.cp2k_multistage') # Data objects -StructureData = DataFactory('structure') +StructureData = DataFactory('core.structure') @pytest.fixture(scope='function') def cu_hkust1_structuredata(): """StructureData for Aluminum.""" - return StructureData(ase=ase.io.read(DATA_DIR / 'Cu-I-II-HKUST-1.cif')) + return StructureData(ase=ase.io.read(files(data) / 'Cu-I-II-HKUST-1.cif')) def run_multistage_cu_hkust1(cp2k_code, cu_hkust1_structuredata): # pylint: disable=redefined-outer-name """Run Cp2kMultistageWorkChain on Cu-HKUST-1.""" # testing user change of parameters and protocol - parameters = Dict(dict={'FORCE_EVAL': {'DFT': {'MGRID': {'CUTOFF': 250,}}}}) + parameters = Dict({'FORCE_EVAL': {'DFT': {'MGRID': {'CUTOFF': 250,}}}}) # Construct process builder builder = Cp2kMultistageWorkChain.get_builder() @@ -44,7 +47,7 @@ def run_multistage_cu_hkust1(cp2k_code, cu_hkust1_structuredata): # pylint: dis #builder.cp2k_base.cp2k.metadata.options.withmpi = False # comment this for parallel cp2k executable builder.cp2k_base.cp2k.metadata.options.max_wallclock_seconds = 1 * 60 * 60 # The following is not needed, if the files are available in the data directory of your CP2K executable - cp2k_dir = DATA_DIR / 'cp2k' + cp2k_dir = files(data) / 'cp2k' builder.cp2k_base.cp2k.file = { 'basis': SinglefileData(file=str(cp2k_dir / 'BASIS_MOLOPT')), 'pseudo': SinglefileData(file=str(cp2k_dir / 'GTH_POTENTIALS')), @@ -69,7 +72,7 @@ def cli(cp2k_code): Example usage: $ ./test_multistage_aluminum.py --cp2k-code my-cp2k@myhost """ run_multistage_cu_hkust1(cp2k_code, - cu_hkust1_structuredata=StructureData(ase=ase.io.read(DATA_DIR / 'Cu-I-II-HKUST-1.cif'))) + cu_hkust1_structuredata=StructureData(ase=ase.io.read(files(data) / 'Cu-I-II-HKUST-1.cif'))) if __name__ == '__main__': diff --git a/examples/run_Cp2kMultistageWorkChain_H2O.py b/examples/run_Cp2kMultistageWorkChain_H2O.py index 8eb9964f..b3b8bcc9 100755 --- a/examples/run_Cp2kMultistageWorkChain_H2O.py +++ b/examples/run_Cp2kMultistageWorkChain_H2O.py @@ -32,7 +32,7 @@ def run_multistage_h2o(cp2k_code): 'num_mpiprocs_per_machine': 1, } builder.cp2k_base.cp2k.metadata.options.max_wallclock_seconds = 1 * 3 * 60 - builder.cp2k_base.cp2k.parameters = Dict(dict={ + builder.cp2k_base.cp2k.parameters = Dict({ 'GLOBAL': { 'PREFERRED_DIAG_LIBRARY': 'SL' }, diff --git a/examples/run_Cp2kMultistageWorkChain_H2O_fail.py b/examples/run_Cp2kMultistageWorkChain_H2O_fail.py index aa596ef2..92098f84 100755 --- a/examples/run_Cp2kMultistageWorkChain_H2O_fail.py +++ b/examples/run_Cp2kMultistageWorkChain_H2O_fail.py @@ -22,7 +22,7 @@ def run_multistage_h2o_fail(cp2k_code): atoms.center(vacuum=2.0) structure = StructureData(ase=atoms) - parameters = Dict(dict={'FORCE_EVAL': { + parameters = Dict({'FORCE_EVAL': { 'DFT': { 'UKS': True, 'MULTIPLICITY': 666, diff --git a/examples/run_Cp2kMultistageWorkChain_H2O_test_file.py b/examples/run_Cp2kMultistageWorkChain_H2O_test_file.py index dba0662b..1421824f 100755 --- a/examples/run_Cp2kMultistageWorkChain_H2O_test_file.py +++ b/examples/run_Cp2kMultistageWorkChain_H2O_test_file.py @@ -36,7 +36,7 @@ def run_multistage_h2o_testfile(cp2k_code): 'num_mpiprocs_per_machine': 1, } builder.cp2k_base.cp2k.metadata.options.max_wallclock_seconds = 1 * 3 * 60 - builder.cp2k_base.cp2k.parameters = Dict(dict={ + builder.cp2k_base.cp2k.parameters = Dict({ 'GLOBAL': { 'PREFERRED_DIAG_LIBRARY': 'SL' }, diff --git a/examples/run_Cp2kPhonopyWorkChain.py b/examples/run_Cp2kPhonopyWorkChain.py index ace00f47..54299438 100755 --- a/examples/run_Cp2kPhonopyWorkChain.py +++ b/examples/run_Cp2kPhonopyWorkChain.py @@ -9,8 +9,8 @@ from aiida import cmdline Cp2kPhonopyWorkChain = WorkflowFactory('lsmo.cp2k_phonopy') -Str = DataFactory('str') # pylint: disable=invalid-name -Int = DataFactory('int') # pylint: disable=invalid-name +Str = DataFactory('core.str') # pylint: disable=invalid-name +Int = DataFactory('core.int') # pylint: disable=invalid-name def run_cp2k_phonopy(cp2k_code, structure_pk): diff --git a/examples/run_IsothermAccurateWorkChain_Graphite_Ar.py b/examples/run_IsothermAccurateWorkChain_Graphite_Ar.py index 16e40742..53dac7f0 100644 --- a/examples/run_IsothermAccurateWorkChain_Graphite_Ar.py +++ b/examples/run_IsothermAccurateWorkChain_Graphite_Ar.py @@ -13,7 +13,7 @@ IsothermAccurateWorkChain = WorkflowFactory('lsmo.isotherm_accurate') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -45,7 +45,7 @@ def main(raspa_code_label, zeopp_code_label): builder.structure = CifData(file=os.path.abspath('data/Graphite_7A.cif'), label='Graphite_7A') builder.molecule = Dict( - dict={ + { 'name': 'Ar', 'forcefield': 'HIRSCHFELDER', 'molsatdens': 35.4, @@ -55,7 +55,7 @@ def main(raspa_code_label, zeopp_code_label): }) builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # Default: UFF 'ff_cutoff': 10, # To speed up 'temperature': 400, # (K) Note: higher temperature will have less adsorbate and it is faster diff --git a/examples/run_IsothermCalcPE_HKUST-1.py b/examples/run_IsothermCalcPE_HKUST-1.py index f6a1f224..edd74842 100755 --- a/examples/run_IsothermCalcPE_HKUST-1.py +++ b/examples/run_IsothermCalcPE_HKUST-1.py @@ -14,7 +14,7 @@ IsothermCalcPEWorkChain = WorkflowFactory('lsmo.isotherm_calc_pe') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -49,7 +49,7 @@ def main(raspa_code, zeopp_code): # NOTE1: parameters are chosen for speed purpose. Use the default to be consistent to 10.1021/acscentsci.9b00619 # NOTE2: calc_pe can fail due to this raw sampling of the isotherm. It happens in the ca. 20% of the cases. builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', 'temperature': 400, 'zeopp_volpo_samples': 1000, diff --git a/examples/run_IsothermMultiTempWorkChain_HKUST-1.py b/examples/run_IsothermMultiTempWorkChain_HKUST-1.py index 844b1dad..fe6888a9 100755 --- a/examples/run_IsothermMultiTempWorkChain_HKUST-1.py +++ b/examples/run_IsothermMultiTempWorkChain_HKUST-1.py @@ -14,7 +14,7 @@ IsothermWorkChain = WorkflowFactory('lsmo.isotherm_multi_temp') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -48,7 +48,7 @@ def main(raspa_code, zeopp_code): builder.structure = CifData(file=os.path.abspath('data/HKUST-1.cif'), label='HKUST-1') builder.molecule = Str('co2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # Default: UFF 'temperature_list': [400, 500], # (K) ******* NOTE: list for multi temperature ********* 'zeopp_volpo_samples': 1000, # Default: 1e5 *NOTE: default is good for standard real-case! diff --git a/examples/run_IsothermMultiTempWorkChain_TCC1RS.py b/examples/run_IsothermMultiTempWorkChain_TCC1RS.py index 6b072166..92bf4236 100755 --- a/examples/run_IsothermMultiTempWorkChain_TCC1RS.py +++ b/examples/run_IsothermMultiTempWorkChain_TCC1RS.py @@ -14,7 +14,7 @@ IsothermWorkChain = WorkflowFactory('lsmo.isotherm_multi_temp') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -48,7 +48,7 @@ def main(raspa_code, zeopp_code): builder.structure = CifData(file=os.path.abspath('data/TCC1RS.cif'), label='TCC1RS') builder.molecule = Str('co2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # Default: UFF 'temperature_list': [400, 500], # (K) ******* NOTE: list for multi temperature ********* 'zeopp_volpo_samples': 1000, # Default: 1e5 *NOTE: default is good for standard real-case! diff --git a/examples/run_IsothermWorkChain_COF-1.py b/examples/run_IsothermWorkChain_COF-1.py index 26bf9741..810cf77d 100755 --- a/examples/run_IsothermWorkChain_COF-1.py +++ b/examples/run_IsothermWorkChain_COF-1.py @@ -14,7 +14,7 @@ IsothermWorkChain = WorkflowFactory('lsmo.isotherm') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -48,7 +48,7 @@ def main(raspa_code, zeopp_code): builder.structure = CifData(file=os.path.abspath('data/COF-1.cif'), label='COF-1') builder.molecule = Str('co2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # Default: UFF 'temperature': 400, # (K) Note: higher temperature will have less adsorbate and it is faster 'zeopp_volpo_samples': 1000, # Default: 1e5 *NOTE: default is good for standard real-case! diff --git a/examples/run_IsothermWorkChain_HKUST-1.py b/examples/run_IsothermWorkChain_HKUST-1.py index 38e10c24..1a1ce78b 100755 --- a/examples/run_IsothermWorkChain_HKUST-1.py +++ b/examples/run_IsothermWorkChain_HKUST-1.py @@ -14,7 +14,7 @@ IsothermWorkChain = WorkflowFactory('lsmo.isotherm') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -48,7 +48,7 @@ def main(raspa_code, zeopp_code): builder.structure = CifData(file=os.path.abspath('data/HKUST-1.cif'), label='HKUST-1') builder.molecule = Str('co2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # Default: UFF 'temperature': 400, # (K) Note: higher temperature will have less adsorbate and it is faster 'zeopp_probe_scaling': 0.8, diff --git a/examples/run_IsothermWorkChain_HKUST-1_onlyKh.py b/examples/run_IsothermWorkChain_HKUST-1_onlyKh.py index c8580ae5..8b599b82 100755 --- a/examples/run_IsothermWorkChain_HKUST-1_onlyKh.py +++ b/examples/run_IsothermWorkChain_HKUST-1_onlyKh.py @@ -14,7 +14,7 @@ IsothermWorkChain = WorkflowFactory('lsmo.isotherm') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -48,7 +48,7 @@ def main(raspa_code, zeopp_code): builder.structure = CifData(file=os.path.abspath('data/HKUST-1.cif'), label='HKUST-1') builder.molecule = Str('h2o') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # Default: UFF 'temperature': 400, # (K) Note: higher temperature will have less adsorbate and it is faster 'zeopp_volpo_samples': 1000, # Default: 1e5 *NOTE: default is good for standard real-case! diff --git a/examples/run_IsothermWorkChain_TCC1RS.py b/examples/run_IsothermWorkChain_TCC1RS.py index 2ee8e629..b22c7bd7 100755 --- a/examples/run_IsothermWorkChain_TCC1RS.py +++ b/examples/run_IsothermWorkChain_TCC1RS.py @@ -14,7 +14,7 @@ IsothermWorkChain = WorkflowFactory('lsmo.isotherm') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -48,7 +48,7 @@ def main(raspa_code, zeopp_code): builder.structure = CifData(file=os.path.abspath('data/TCC1RS.cif'), label='TCC1RS') builder.molecule = Str('co2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # Default: UFF 'temperature': 400, # (K) Note: higher temperature will have less adsorbate and it is faster 'zeopp_volpo_samples': 1000, # Default: 1e5 *NOTE: default is good for standard real-case! diff --git a/examples/run_MulticompGcmcWorkChain_HKUST-1_2comp.py b/examples/run_MulticompGcmcWorkChain_HKUST-1_2comp.py index e0abc458..5c999ddf 100755 --- a/examples/run_MulticompGcmcWorkChain_HKUST-1_2comp.py +++ b/examples/run_MulticompGcmcWorkChain_HKUST-1_2comp.py @@ -13,9 +13,9 @@ MulticompGcmcWorkChain = WorkflowFactory('lsmo.multicomp_gcmc') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name -SinglefileData = DataFactory('singlefile') +SinglefileData = DataFactory('core.singlefile') @click.command('cli') @@ -44,7 +44,7 @@ def main(raspa_code, zeopp_code): builder.raspa_base.raspa.metadata.options = options builder.zeopp.metadata.options = options builder.structure = CifData(file=os.path.abspath('data/HKUST-1.cif'), label='HKUST-1') - builder.conditions = Dict(dict={ + builder.conditions = Dict({ 'molfraction': { 'xenon': 0.2, 'krypton': 0.8, @@ -57,7 +57,7 @@ def main(raspa_code, zeopp_code): }) builder.parameters = Dict( - dict={ + { 'zeopp_probe_scaling': 0.95, 'zeopp_block_samples': 10, # Default: 100 'raspa_gcmc_init_cycles': 100, # Default: 1e3 diff --git a/examples/run_MulticompGcmcWorkChain_HKUST-1_3comp.py b/examples/run_MulticompGcmcWorkChain_HKUST-1_3comp.py index 62f2d998..320fcd88 100755 --- a/examples/run_MulticompGcmcWorkChain_HKUST-1_3comp.py +++ b/examples/run_MulticompGcmcWorkChain_HKUST-1_3comp.py @@ -13,9 +13,9 @@ MulticompGcmcWorkChain = WorkflowFactory('lsmo.multicomp_gcmc') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name -SinglefileData = DataFactory('singlefile') +SinglefileData = DataFactory('core.singlefile') @click.command('cli') @@ -44,7 +44,7 @@ def main(raspa_code, zeopp_code): builder.raspa_base.raspa.metadata.options = options builder.zeopp.metadata.options = options builder.structure = CifData(file=os.path.abspath('data/HKUST-1.cif'), label='HKUST-1') - builder.conditions = Dict(dict={ + builder.conditions = Dict({ 'molfraction': { 'co': 0.2, 'ethene': 0.3, @@ -58,7 +58,7 @@ def main(raspa_code, zeopp_code): }) builder.parameters = Dict( - dict={ + { 'zeopp_probe_scaling': 0.0, # NOTE: excluding blocking sphere calculations 'zeopp_block_samples': 10, # Default: 100 'raspa_gcmc_init_cycles': 100, # Default: 1e3 diff --git a/examples/run_SimAnnealingWorkChain_HKUST-1_3xCO2.py b/examples/run_SimAnnealingWorkChain_HKUST-1_3xCO2.py index 39d20963..70263a8d 100755 --- a/examples/run_SimAnnealingWorkChain_HKUST-1_3xCO2.py +++ b/examples/run_SimAnnealingWorkChain_HKUST-1_3xCO2.py @@ -14,7 +14,7 @@ SimAnnealingWorkChain = WorkflowFactory('lsmo.sim_annealing') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name @click.command('cli') @@ -36,7 +36,7 @@ def main(raspa_code): builder.structure = CifData(file=os.path.abspath('data/HKUST-1.cif'), label='HKUST-1') builder.molecule = Str('co2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # (str) Forcefield of the structure. 'temperature_list': [300, 200, 100], # (list) List of decreasing temperatures for the annealing. 'mc_steps': int(10), # (int) Number of MC cycles. diff --git a/examples/run_SimAnnealingWorkChain_HKUST-1_3xDMA.py b/examples/run_SimAnnealingWorkChain_HKUST-1_3xDMA.py index bedcbef1..95e02f85 100644 --- a/examples/run_SimAnnealingWorkChain_HKUST-1_3xDMA.py +++ b/examples/run_SimAnnealingWorkChain_HKUST-1_3xDMA.py @@ -14,7 +14,7 @@ SimAnnealingWorkChain = WorkflowFactory('lsmo.sim_annealing') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name @click.command('cli') @@ -34,7 +34,7 @@ def main(raspa_code): 'max_wallclock_seconds': 1 * 60 * 60, } builder.structure = CifData(file=os.path.abspath('data/HKUST-1.cif'), label='HKUST-1') - builder.molecule = Dict(dict={ + builder.molecule = Dict({ 'name': 'DMA', 'forcefield': 'BOYDDDEC', 'proberad': 1.7365, @@ -42,7 +42,7 @@ def main(raspa_code): 'charged': True, }) builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # (str) Forcefield of the structure. 'temperature_list': [300, 150], # (list) List of decreasing temperatures for the annealing. 'mc_steps': int(10), # (int) Number of MC cycles. diff --git a/examples/run_SinglecompWidomWorkChain_Box.py b/examples/run_SinglecompWidomWorkChain_Box.py index c9b12893..9a735baa 100755 --- a/examples/run_SinglecompWidomWorkChain_Box.py +++ b/examples/run_SinglecompWidomWorkChain_Box.py @@ -12,7 +12,7 @@ SinglecompWidomWorkChain = WorkflowFactory('lsmo.singlecomp_widom') # Data objects -CifData = DataFactory('cif') +CifData = DataFactory('core.cif') NetworkParameters = DataFactory('zeopp.parameters') @@ -43,7 +43,7 @@ def main(raspa_code, zeopp_code): builder.zeopp.metadata.options = options builder.molecule = Str('h2o') # it does not make much sense with a rigid molecule! - builder.parameters = Dict(dict={ + builder.parameters = Dict({ 'zeopp_block_samples': 10, # Default: 100 'raspa_widom_cycles': 100, # Default: 1e5 'temperatures': [200, 300] diff --git a/examples/run_SinglecompWidomWorkChain_HKUST-1.py b/examples/run_SinglecompWidomWorkChain_HKUST-1.py index 904ba9de..94fcc046 100755 --- a/examples/run_SinglecompWidomWorkChain_HKUST-1.py +++ b/examples/run_SinglecompWidomWorkChain_HKUST-1.py @@ -13,7 +13,7 @@ SinglecompWidomWorkChain = WorkflowFactory('lsmo.singlecomp_widom') # Data objects -CifData = DataFactory('cif') +CifData = DataFactory('core.cif') NetworkParameters = DataFactory('zeopp.parameters') @@ -46,7 +46,7 @@ def main(raspa_code, zeopp_code): builder.molecule = Str('h2o') builder.parameters = Dict( - dict={ + { 'zeopp_probe_scaling': 0.7, 'zeopp_block_samples': 10, # Default: 100 'raspa_widom_cycles': 100, # Default: 1e5 diff --git a/examples/run_SinglecompWidomWorkChain_custom.py b/examples/run_SinglecompWidomWorkChain_custom.py index 5eab563c..d433061a 100755 --- a/examples/run_SinglecompWidomWorkChain_custom.py +++ b/examples/run_SinglecompWidomWorkChain_custom.py @@ -13,7 +13,7 @@ SinglecompWidomWorkChain = WorkflowFactory('lsmo.singlecomp_widom') # Data objects -CifData = DataFactory('cif') +CifData = DataFactory('core.cif') NetworkParameters = DataFactory('zeopp.parameters') @@ -46,7 +46,7 @@ def main(raspa_code, zeopp_code): builder.molecule = load_node(72198) builder.parameters = Dict( - dict={ + { 'zeopp_probe_scaling': 0.0, 'zeopp_block_samples': 10, # Default: 100 'raspa_widom_cycles': 100, # Default: 1e5 diff --git a/examples/run_ZeoppMultistageDdecWorkChain_H2O.py b/examples/run_ZeoppMultistageDdecWorkChain_H2O.py index cc1f3c17..d4481c36 100755 --- a/examples/run_ZeoppMultistageDdecWorkChain_H2O.py +++ b/examples/run_ZeoppMultistageDdecWorkChain_H2O.py @@ -14,7 +14,7 @@ ZeoppMultistageDdecWorkChain = WorkflowFactory('lsmo.zeopp_multistage_ddec') # pylint: disable=invalid-name #Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name @@ -55,7 +55,7 @@ def main(zeopp_code, cp2k_code, ddec_code, ddec_atdens_path): } ddec_params = Dict( - dict={ + { 'net charge': 0.0, 'charge type': 'DDEC6', 'periodicity along A, B, and C vectors': [True, True, True], diff --git a/examples/submit_ZeoppMultistageDdecWorkChain_COF-5.py b/examples/submit_ZeoppMultistageDdecWorkChain_COF-5.py index 5bc17fb3..c5f77706 100644 --- a/examples/submit_ZeoppMultistageDdecWorkChain_COF-5.py +++ b/examples/submit_ZeoppMultistageDdecWorkChain_COF-5.py @@ -12,7 +12,7 @@ ZeoppMultistageDdecWorkChain = WorkflowFactory('lsmo.zeopp_multistage_ddec') # pylint: disable=invalid-name #Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name print('NOTE: this test will perform a real-case calculation on Fidis, taking a couple of hours!') @@ -46,7 +46,7 @@ } ddec_params = Dict( - dict={ + { 'net charge': 0.0, 'charge type': diff --git a/examples/test_Cp2kBindingEnergy_CO2_MOF74.py b/examples/test_Cp2kBindingEnergy_CO2_MOF74.py index 655665e1..2b68e41c 100755 --- a/examples/test_Cp2kBindingEnergy_CO2_MOF74.py +++ b/examples/test_Cp2kBindingEnergy_CO2_MOF74.py @@ -19,7 +19,7 @@ BindingEnergyWorkChain = WorkflowFactory('lsmo.cp2k_binding_energy') # Data objects -StructureData = DataFactory('structure') +StructureData = DataFactory('core.structure') @pytest.fixture(scope='function') @@ -44,7 +44,7 @@ def run_binding_energy_co2_mof74(cp2k_code, zn_mof74, co2_in_mof74): # pylint: builder.structure = zn_mof74 builder.molecule = co2_in_mof74 builder.protocol_tag = Str('test') - builder.cp2k_base.cp2k.parameters = Dict(dict={ # Lowering CP2K default setting for a faster test calculation + builder.cp2k_base.cp2k.parameters = Dict({ # Lowering CP2K default setting for a faster test calculation 'FORCE_EVAL': { 'DFT': { 'SCF': { diff --git a/examples/test_Cp2kMultistageDdecWorkChain_H2O.py b/examples/test_Cp2kMultistageDdecWorkChain_H2O.py index 1081bed2..696dd238 100755 --- a/examples/test_Cp2kMultistageDdecWorkChain_H2O.py +++ b/examples/test_Cp2kMultistageDdecWorkChain_H2O.py @@ -18,7 +18,7 @@ MultistageDdecWorkChain = WorkflowFactory('lsmo.cp2k_multistage_ddec') # pylint: disable=invalid-name # Data objects -StructureData = DataFactory('structure') # pylint: disable=invalid-name +StructureData = DataFactory('core.structure') # pylint: disable=invalid-name def run_cp2k_multistage_ddec_h2o(cp2k_code, ddec_code): # pylint: disable=redefined-outer-name @@ -50,7 +50,7 @@ def run_cp2k_multistage_ddec_h2o(cp2k_code, ddec_code): # pylint: disable=redef builder.ddec.code = ddec_code builder.ddec.parameters = Dict( - dict={ + { 'net charge': 0.0, 'charge type': 'DDEC6', 'periodicity along A, B, and C vectors': [True, True, True], diff --git a/examples/test_Cp2kMultistageWorkChain_Al.py b/examples/test_Cp2kMultistageWorkChain_Al.py index 2cfacd75..564cb4ac 100755 --- a/examples/test_Cp2kMultistageWorkChain_Al.py +++ b/examples/test_Cp2kMultistageWorkChain_Al.py @@ -19,7 +19,7 @@ Cp2kMultistageWorkChain = WorkflowFactory('lsmo.cp2k_multistage') # Data objects -StructureData = DataFactory('structure') +StructureData = DataFactory('core.structure') @pytest.fixture(scope='function') @@ -35,8 +35,8 @@ def run_multistage_al(cp2k_code, al_structuredata): # pylint: disable=redefined print('EXPECTED: the OT (settings_0) will converge to a negative bandgap, then use SMEARING (settings_1)') # testing user change of parameters and protocol - parameters = Dict(dict={'FORCE_EVAL': {'DFT': {'MGRID': {'CUTOFF': 250,}}}}) - protocol_mod = Dict(dict={ + parameters = Dict({'FORCE_EVAL': {'DFT': {'MGRID': {'CUTOFF': 250,}}}}) + protocol_mod = Dict({ 'initial_magnetization': { 'Al': 0 }, diff --git a/examples/test_IsothermInflectionWorkChain_graphite_Ar.py b/examples/test_IsothermInflectionWorkChain_graphite_Ar.py index ee072d21..c7b28a31 100755 --- a/examples/test_IsothermInflectionWorkChain_graphite_Ar.py +++ b/examples/test_IsothermInflectionWorkChain_graphite_Ar.py @@ -19,7 +19,7 @@ IsothermInflectionWorkChain = WorkflowFactory('lsmo.isotherm_inflection') # Data objects -CifData = DataFactory('cif') +CifData = DataFactory('core.cif') NetworkParameters = DataFactory('zeopp.parameters') @@ -56,7 +56,7 @@ def run_isotherm_inflection_ar_graphite(raspa_code, zeopp_code, graphite_20a): builder.structure = graphite_20a builder.molecule = Dict( - dict={ + { 'name': 'Ar', 'forcefield': 'HIRSCHFELDER', 'ff_cutoff': 8, @@ -68,7 +68,7 @@ def run_isotherm_inflection_ar_graphite(raspa_code, zeopp_code, graphite_20a): }) builder.parameters = Dict( - dict={ + { 'ff_framework': 'DREIDING', 'temperature': 87, # T_sat Ar 'ff_cutoff': 8.0, # NOTE: Low to have cheap testing diff --git a/examples/test_IsothermWorkChain_Mg-MOF74.py b/examples/test_IsothermWorkChain_Mg-MOF74.py index 84b1f0cd..6e6d45e6 100755 --- a/examples/test_IsothermWorkChain_Mg-MOF74.py +++ b/examples/test_IsothermWorkChain_Mg-MOF74.py @@ -19,7 +19,7 @@ IsothermWorkChain = WorkflowFactory('lsmo.isotherm') # Data objects -CifData = DataFactory('cif') +CifData = DataFactory('core.cif') NetworkParameters = DataFactory('zeopp.parameters') @@ -53,7 +53,7 @@ def run_isotherm_mg_mof74(raspa_code, zeopp_code, mg_mof74_cifdata): # pylint: builder.structure = mg_mof74_cifdata builder.molecule = Str('co2') builder.parameters = Dict( - dict={ + { 'ff_framework': 'UFF', # Default: UFF 'temperature': 400, # (K) Note: higher temperature will have less adsorbate and it is faster 'zeopp_volpo_samples': 1000, # Default: 1e5 *NOTE: default is good for standard real-case! diff --git a/examples/test_MulticompAdsDesWorkChain_HKUST-1.py b/examples/test_MulticompAdsDesWorkChain_HKUST-1.py index ff65641f..b6b3b5c9 100755 --- a/examples/test_MulticompAdsDesWorkChain_HKUST-1.py +++ b/examples/test_MulticompAdsDesWorkChain_HKUST-1.py @@ -19,9 +19,9 @@ MulticompAdsDesWorkChain = WorkflowFactory('lsmo.multicomp_ads_des') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name NetworkParameters = DataFactory('zeopp.parameters') # pylint: disable=invalid-name -SinglefileData = DataFactory('singlefile') +SinglefileData = DataFactory('core.singlefile') @pytest.fixture(scope='function') @@ -55,7 +55,7 @@ def run_multicomp_ads_des_hkust_1(raspa_code, zeopp_code, hkust_1_cifdata): # p builder.zeopp.metadata.options = options builder.structure = hkust_1_cifdata builder.conditions = Dict( - dict={ + { 'molfraction': { 'xenon': 0.2, 'krypton': 0.8 @@ -71,7 +71,7 @@ def run_multicomp_ads_des_hkust_1(raspa_code, zeopp_code, hkust_1_cifdata): # p }) builder.parameters = Dict( - dict={ + { 'zeopp_probe_scaling': 0.9, # Default: 1.0 'zeopp_block_samples': 10, # Default: 100 'raspa_widom_cycles': 100, # Default: 1e5 @@ -86,8 +86,10 @@ def run_multicomp_ads_des_hkust_1(raspa_code, zeopp_code, hkust_1_cifdata): # p params = results['output_parameters'].get_dict() # checking results - assert params['loading_absolute_average']['Kr'][1] == pytest.approx(0.02, abs=0.02) - assert params['loading_absolute_average']['Xe'][1] == pytest.approx(0.74, abs=0.2) + assert params['loading_absolute_average']['Kr'][1] == pytest.approx(0.02, abs=0.02), \ + params['loading_absolute_average']['Kr'][1] + assert params['loading_absolute_average']['Xe'][1] == pytest.approx(0.74, abs=0.2), \ + params['loading_absolute_average']['Xe'][1] @click.command() diff --git a/examples/test_MulticompGcmcWorkChain_Box_3comp.py b/examples/test_MulticompGcmcWorkChain_Box_3comp.py index c9b2b8e9..ad7ad032 100755 --- a/examples/test_MulticompGcmcWorkChain_Box_3comp.py +++ b/examples/test_MulticompGcmcWorkChain_Box_3comp.py @@ -12,7 +12,7 @@ MulticompGcmcWorkChain = WorkflowFactory('lsmo.multicomp_gcmc') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name def run_multicomp_gcmc_box(raspa_code, zeopp_code): # pylint: disable=redefined-outer-name @@ -35,7 +35,7 @@ def run_multicomp_gcmc_box(raspa_code, zeopp_code): # pylint: disable=redefined } builder.raspa_base.raspa.metadata.options = options builder.zeopp.metadata.options = options - builder.conditions = Dict(dict={ + builder.conditions = Dict({ 'molfraction': { 'co': 0.2, 'ethene': 0.3, @@ -48,7 +48,7 @@ def run_multicomp_gcmc_box(raspa_code, zeopp_code): # pylint: disable=redefined ] }) - builder.parameters = Dict(dict={ + builder.parameters = Dict({ 'raspa_gcmc_init_cycles': 1000, # Default: 1e3 'raspa_gcmc_prod_cycles': 1000, # Default: 1e4 }) diff --git a/examples/test_SimAnnealingWorkChain_MOF74_CO2.py b/examples/test_SimAnnealingWorkChain_MOF74_CO2.py index 6aa52b8a..f5fce38b 100755 --- a/examples/test_SimAnnealingWorkChain_MOF74_CO2.py +++ b/examples/test_SimAnnealingWorkChain_MOF74_CO2.py @@ -19,7 +19,7 @@ SimAnnealingWorkChain = WorkflowFactory('lsmo.sim_annealing') # pylint: disable=invalid-name # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name +CifData = DataFactory('core.cif') # pylint: disable=invalid-name @pytest.fixture(scope='function') @@ -46,7 +46,7 @@ def run_sim_annealing_zn_mof74(raspa_code, zn_mof74_cifdata): # pylint: disable } builder.structure = zn_mof74_cifdata builder.molecule = Str('co2') - builder.parameters = Dict(dict={ + builder.parameters = Dict({ 'ff_framework': 'UFF', # (str) Forcefield of the structure. 'mc_steps': int(10), # (int) Number of MC cycles. }) diff --git a/pyproject.toml b/pyproject.toml index 6655c7a5..d78f4f8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,22 +17,20 @@ readme = "README.md" license = {file = "LICENSE"} classifiers = [ "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ] dependencies = [ - "aiida-core~=1.0", - "aiida-cp2k~=1.4", - "aiida-ddec~=1.0", - "aiida-zeopp~=1.0,>=1.0.3", - "aiida-raspa~=1.1", + 'aiida_core[atomic_tools]~=2.3', + "aiida-cp2k~=2.0", + "aiida-ddec~=2.0", + "aiida-zeopp~=2.0", + "aiida-raspa~=2.0", "calc-pe~=1.0,>=1.0.1", - "ruamel.yaml~=0.16.5", - "ase<3.20", - "oximachinerunner~=1.4.0", - "pymatgen<2021", + 'oximachinerunner @ git+https://github.com/mpougin/oximachinerunner.git@update-packaging', "phonopy~=2.9", - "markupsafe<2.1", ] [project.urls] diff --git a/tests/test_calc_ch4_working_cap.py b/tests/test_calc_ch4_working_cap.py index c4334218..613a2268 100644 --- a/tests/test_calc_ch4_working_cap.py +++ b/tests/test_calc_ch4_working_cap.py @@ -13,7 +13,7 @@ def test_calc_ch4_working_cap(): """Test extraction of working capacity data from IsothermWorkChain output dictionary.""" OUTPUT_PARAMETERS = Dict( - dict={ + { 'Density': 0.440527, 'Density_unit': 'g/cm^3', 'Estimated_saturation_loading': 41.985376, diff --git a/tests/test_ffbuilder.py b/tests/test_ffbuilder.py index 42786021..a3301b11 100644 --- a/tests/test_ffbuilder.py +++ b/tests/test_ffbuilder.py @@ -12,7 +12,7 @@ def test_ff_builder(): """Test force-field builder""" ff_parameters = Dict( - dict={ + { 'ff_framework': 'UFF', 'ff_molecules': { 'CO2': 'TraPPE', diff --git a/tests/test_get_molecule_from_restart_file.py b/tests/test_get_molecule_from_restart_file.py index e46b11b6..15f6f58c 100644 --- a/tests/test_get_molecule_from_restart_file.py +++ b/tests/test_get_molecule_from_restart_file.py @@ -11,8 +11,8 @@ DATA_DIR = THIS_DIR / 'data' # Data objects -CifData = DataFactory('cif') # pylint: disable=invalid-name -FolderData = DataFactory('folder') +CifData = DataFactory('core.cif') # pylint: disable=invalid-name +FolderData = DataFactory('core.folder') def test_get_molecule_from_restart_file(): @@ -23,9 +23,9 @@ def test_get_molecule_from_restart_file(): molecule_folderdata = FolderData(tree=(DATA_DIR / 'RASPA_3N2_in_HKUST1')) - input_dict = Dict(dict={'number_of_molecules': int(3)}) + input_dict = Dict({'number_of_molecules': int(3)}) - molecule_dict = Dict(dict={'name': 'N2', 'forcefield': 'TraPPE'}) + molecule_dict = Dict({'name': 'N2', 'forcefield': 'TraPPE'}) cif_out = get_molecule_from_restart_file(structure_cif, molecule_folderdata, input_dict, molecule_dict)