diff --git a/.gitignore b/.gitignore
index 6769e21..f030a14 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,9 @@ __pycache__/
# C extensions
*.so
+#jobflow tmp output dirs
+job*/
+
# Distribution / packaging
.Python
build/
@@ -25,6 +28,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
+.idea
# PyInstaller
# Usually these files are written by a python script from a template
diff --git a/adis_tools/parsers.py b/adis_tools/parsers.py
index d691581..326f0e4 100644
--- a/adis_tools/parsers.py
+++ b/adis_tools/parsers.py
@@ -12,7 +12,7 @@
def parse_pw(xml_file):
"""Parse a Quantum Espresso XML output file."""
- xml_dict = XMLSchema(files(schemas) / 'qes_230310.xsd').to_dict(xml_file)
+ xml_dict = XMLSchema(str(files(schemas) / 'qes_230310.xsd')).to_dict(xml_file)
parsed_results = {}
diff --git a/adis_tools/schemas/qes_230310.xsd b/adis_tools/schemas/qes_230310.xsd
index a68aad3..576a6cb 100644
--- a/adis_tools/schemas/qes_230310.xsd
+++ b/adis_tools/schemas/qes_230310.xsd
@@ -22,7 +22,7 @@ datecode 220603
-
+
@@ -150,8 +150,8 @@ datecode 220603
-
-
+
diff --git a/aiida.ipynb b/aiida.ipynb
index 78a042f..79b1dc0 100644
--- a/aiida.ipynb
+++ b/aiida.ipynb
@@ -1 +1,799 @@
-{"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3 (ipykernel)","language":"python"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.11.0"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Aiida","metadata":{}},{"cell_type":"code","source":"import subprocess","metadata":{"tags":[]},"execution_count":1,"outputs":[]},{"cell_type":"code","source":"try: \n subprocess.check_output([\"verdi\", \"profile\", \"setup\", \"core.sqlite_dos\", \"-n\", \"--profile\", \"test\", \"--email\", \"no@email.com\"])\nexcept: \n pass","metadata":{"tags":[]},"execution_count":2,"outputs":[{"name":"stderr","text":"/srv/conda/envs/notebook/lib/python3.11/site-packages/aiida/manage/configuration/settings.py:59: UserWarning: Creating AiiDA configuration folder `/home/jovyan/.aiida`.\n warnings.warn(f'Creating AiiDA configuration folder `{path}`.')\n","output_type":"stream"}]},{"cell_type":"code","source":"from pathlib import Path\nfrom ase.build import bulk\n\nfrom aiida import orm, engine, load_profile\nfrom aiida.common.exceptions import NotExistent\n\nload_profile()","metadata":{"tags":[]},"execution_count":3,"outputs":[{"execution_count":3,"output_type":"execute_result","data":{"text/plain":"Profile"},"metadata":{}}]},{"cell_type":"code","source":"try:\n localhost = orm.load_computer('localhost')\nexcept NotExistent:\n localhost = orm.Computer(\n label='localhost',\n hostname='localhost',\n transport_type='core.local',\n scheduler_type='core.direct',\n workdir=Path('workdir').absolute().as_posix()\n ).store()\n localhost.configure()\n\ntry:\n pw_code = orm.load_code('pw@localhost')\nexcept NotExistent:\n pw_code = orm.InstalledCode(\n label='pw',\n computer=localhost,\n filepath_executable='pw.x',\n default_calc_job_plugin='aiida_qe_basic.pw',\n prepend_text='export OMP_NUM_THREADS=1'\n ).store()","metadata":{"tags":[]},"execution_count":4,"outputs":[{"name":"stderr","text":"/srv/conda/envs/notebook/lib/python3.11/site-packages/aiida/orm/nodes/data/code/legacy.py:42: AiidaDeprecationWarning: The `Code` class is deprecated. To create an instance, use the `aiida.orm.nodes.data.code.installed.InstalledCode` or `aiida.orm.nodes.data.code.portable.PortableCode` for a \"remote\" or \"local\" code, respectively. If you are using this class to compare type, e.g. in `isinstance`, use `aiida.orm.nodes.data.code.abstract.AbstractCode`. (this will be removed in v3)\n warn_deprecation(\n","output_type":"stream"}]},{"cell_type":"code","source":"from aiida_qe_basic.pw import PwCalculation\n\nbuilder = PwCalculation.get_builder()\n\nbuilder.code = pw_code\nbuilder.structure = orm.StructureData(ase=bulk('Al', a=4.05, cubic=True))\nbuilder.pseudopotentials = orm.Dict({\"Al\": \"Al.pbe-n-kjpaw_psl.1.0.0.UPF\"})\nbuilder.parameters = orm.Dict(\n {\n 'CONTROL': {\n 'calculation': 'scf',\n # 'pseudo_dir': Path('files').absolute().as_posix(),\n },\n 'SYSTEM': {\n 'occupations': 'smearing',\n 'smearing': 'cold',\n 'degauss': 0.02\n }\n }\n)\nbuilder.metadata.options.resources = {\n 'num_machines': 1,\n 'num_mpiprocs_per_machine': 1\n}","metadata":{"tags":[]},"execution_count":5,"outputs":[]},{"cell_type":"code","source":"! rabbitmq-server -detached","metadata":{},"execution_count":6,"outputs":[]},{"cell_type":"code","source":"! sleep 5","metadata":{},"execution_count":7,"outputs":[]},{"cell_type":"code","source":"results = engine.run(builder)","metadata":{"tags":[]},"execution_count":8,"outputs":[]},{"cell_type":"code","source":"results","metadata":{},"execution_count":9,"outputs":[{"execution_count":9,"output_type":"execute_result","data":{"text/plain":"{'structure': ,\n 'properties': ,\n 'remote_folder': ,\n 'retrieved': }"},"metadata":{}}]},{"cell_type":"code","source":"results['properties'].get_dict()","metadata":{},"execution_count":10,"outputs":[{"execution_count":10,"output_type":"execute_result","data":{"text/plain":"{'energy': -1074.9272223013, 'volume': 66.430124128914}"},"metadata":{}}]},{"cell_type":"markdown","source":"## Equation of State curve - basic QE\n\nRunning an EOS without all the fancy features in the `aiida-quantumespresso` plugin.","metadata":{}},{"cell_type":"code","source":"from pathlib import Path\n\nfrom aiida import orm, engine, load_profile\n\nload_profile()","metadata":{},"execution_count":11,"outputs":[{"execution_count":11,"output_type":"execute_result","data":{"text/plain":"Profile"},"metadata":{}}]},{"cell_type":"markdown","source":"### Importing a structure","metadata":{}},{"cell_type":"code","source":"from ase.build import bulk\n\nstructure = orm.StructureData(ase=bulk('Al', a=4.05, cubic=True))","metadata":{},"execution_count":12,"outputs":[]},{"cell_type":"markdown","source":"### Relaxing the geometry","metadata":{}},{"cell_type":"code","source":"resources = {\n 'num_machines': 1,\n 'num_mpiprocs_per_machine': 1\n}\n\nrelax_params = {\n 'CONTROL': {\n 'calculation': 'vc-relax',\n # 'pseudo_dir': Path('files').absolute().as_posix(),\n },\n 'SYSTEM': {\n 'occupations': 'smearing',\n 'smearing': 'cold',\n 'degauss': 0.02\n }\n}","metadata":{},"execution_count":13,"outputs":[]},{"cell_type":"code","source":"from aiida_qe_basic.pw import PwCalculation\n\nbuilder = PwCalculation.get_builder()\n\nbuilder.code = orm.load_code('pw@localhost')\nbuilder.structure = orm.StructureData(ase=bulk('Al', a=4.05, cubic=True))\nbuilder.pseudopotentials = orm.Dict({\"Al\": \"Al.pbe-n-kjpaw_psl.1.0.0.UPF\"})\nbuilder.parameters = orm.Dict(relax_params)\nbuilder.metadata.options.resources = resources","metadata":{},"execution_count":14,"outputs":[]},{"cell_type":"code","source":"results = engine.run(builder)\nrelaxed_structure = results['structure']\nrelaxed_structure","metadata":{},"execution_count":15,"outputs":[{"execution_count":15,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}}]},{"cell_type":"markdown","source":"### Calc function to rescale structures\n\nThe `calcfunction` below takes an input structure and rescales it to different volumes.","metadata":{}},{"cell_type":"code","source":"from aiida_qe_basic.pw import PwCalculation\n\n@engine.calcfunction\ndef rescale_list(structure: orm.StructureData, factor_list: orm.List):\n\n scaled_structure_dict = {}\n\n for index, scaling_factor in enumerate(factor_list.get_list()):\n\n ase_structure = structure.get_ase()\n\n new_cell = ase_structure.get_cell() * scaling_factor\n ase_structure.set_cell(new_cell, scale_atoms=True)\n\n scaled_structure_dict[f'structure_{index}'] = orm.StructureData(ase=ase_structure)\n\n return scaled_structure_dict","metadata":{},"execution_count":16,"outputs":[]},{"cell_type":"markdown","source":"Typically, you'd just run it by calling the function as you would a regular Python function:","metadata":{}},{"cell_type":"code","source":"rescaled_structures = rescale_list(relaxed_structure, orm.List(list=[0.9, 0.95, 1.0, 1.05, 1.1]))","metadata":{},"execution_count":17,"outputs":[]},{"cell_type":"code","source":"rescaled_structures","metadata":{},"execution_count":18,"outputs":[{"execution_count":18,"output_type":"execute_result","data":{"text/plain":"{'structure_0': ,\n 'structure_1': ,\n 'structure_2': ,\n 'structure_3': ,\n 'structure_4': }"},"metadata":{}}]},{"cell_type":"markdown","source":"## EOS: Work function version","metadata":{}},{"cell_type":"code","source":"scf_inputs = {\n 'CONTROL': {\n 'calculation': 'scf',\n # 'pseudo_dir': Path('files').absolute().as_posix(),\n },\n 'SYSTEM': {\n 'occupations': 'smearing',\n 'smearing': 'cold',\n 'degauss': 0.02\n }\n}","metadata":{},"execution_count":19,"outputs":[]},{"cell_type":"code","source":"@engine.workfunction\ndef run_eos_wf(code: orm.Code, structure: orm.StructureData, scale_factors: orm.List):\n \"\"\"Run an equation of state of a bulk crystal structure for the given element.\"\"\"\n\n properties = {}\n\n for label, rescaled_structure in rescale_list(structure, scale_factors).items():\n\n builder = PwCalculation.get_builder()\n builder.code = code\n builder.structure = rescaled_structure\n builder.parameters = orm.Dict(scf_inputs)\n builder.pseudopotentials = orm.Dict({\"Al\": \"Al.pbe-n-kjpaw_psl.1.0.0.UPF\"})\n builder.metadata.options.resources = resources\n\n results = engine.run(builder)\n properties[label] = results['properties']\n\n return properties","metadata":{},"execution_count":20,"outputs":[]},{"cell_type":"code","source":"results = run_eos_wf(\n code=orm.load_code('pw@localhost'),\n structure=relaxed_structure,\n scale_factors=[0.9, 0.95, 1.0, 1.05, 1.1]\n)","metadata":{},"execution_count":21,"outputs":[]},{"cell_type":"code","source":"results","metadata":{},"execution_count":22,"outputs":[{"execution_count":22,"output_type":"execute_result","data":{"text/plain":"{'structure_0': ,\n 'structure_1': ,\n 'structure_2': ,\n 'structure_3': ,\n 'structure_4': }"},"metadata":{}}]},{"cell_type":"code","source":"volumes = []\nenergies = []\n\nfor result in results.values():\n volumes.append(result['volume'])\n energies.append(result['energy'])","metadata":{},"execution_count":23,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\nplt.plot(volumes, energies)","metadata":{},"execution_count":24,"outputs":[{"execution_count":24,"output_type":"execute_result","data":{"text/plain":"[]"},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"