diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca00495..637218f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,12 +4,30 @@ on: [push, pull_request] jobs: + pre-commit: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install python dependencies + run: | + pip install --upgrade pip + pip install -e .[pre-commit] + - name: Run pre-commit + run: | + pre-commit install + pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) + tests: runs-on: ubuntu-latest timeout-minutes: 30 services: postgres: - image: postgres:10 + image: postgres:12 ports: - 5432:5432 rabbitmq: @@ -19,51 +37,24 @@ jobs: strategy: matrix: python-version: [3.8] - backend: ['django'] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Install system dependencies - run: | - sudo apt update - sudo apt install postgresql-12 - - name: Install python dependencies run: | pip install --upgrade pip pip install -e .[testing] - reentry scan -r aiida - name: Run test suite env: - AIIDA_TEST_BACKEND: ${{ matrix.backend }} # show timings of tests PYTEST_ADDOPTS: "--durations=0" COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} run: | py.test --cov aiida_gaussian --cov-append . coveralls - - pre-commit: - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@v1 - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install python dependencies - run: | - pip install --upgrade pip - pip install -e .[pre-commit] - reentry scan -r aiida - - name: Run pre-commit - run: | - pre-commit install - pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) diff --git a/aiida_gaussian/calculations/gaussian.py b/aiida_gaussian/calculations/gaussian.py index 04e5875..85b228f 100644 --- a/aiida_gaussian/calculations/gaussian.py +++ b/aiida_gaussian/calculations/gaussian.py @@ -11,7 +11,7 @@ import pymatgen.io.gaussian as mgaus -StructureData = DataFactory("structure") +StructureData = DataFactory("core.structure") class GaussianCalculation(CalcJob): diff --git a/aiida_gaussian/tests/test_gaussian.py b/aiida_gaussian/tests/test_gaussian.py index ffa1388..c25e72f 100644 --- a/aiida_gaussian/tests/test_gaussian.py +++ b/aiida_gaussian/tests/test_gaussian.py @@ -52,7 +52,7 @@ def test_gaussian(fixture_code): inputs = { 'code': fixture_code('gaussian'), #load_code("gaussian09@localhost"), 'structure': structure, - 'parameters': Dict(dict=parameters), + 'parameters': Dict(parameters), 'metadata': { 'options': { 'resources': { diff --git a/aiida_gaussian/workchains/base.py b/aiida_gaussian/workchains/base.py index 8c6c567..8e0b354 100644 --- a/aiida_gaussian/workchains/base.py +++ b/aiida_gaussian/workchains/base.py @@ -10,7 +10,7 @@ from aiida.plugins import CalculationFactory, DataFactory GaussianCalculation = CalculationFactory('gaussian') -StructureData = DataFactory('structure') +StructureData = DataFactory('core.structure') class GaussianBaseWorkChain(BaseRestartWorkChain): @@ -96,7 +96,7 @@ def handle_scf_failure(self, node): # Update the params Dict route_params['scf'] = new_scf - self.ctx.inputs.parameters = Dict(dict=params) + self.ctx.inputs.parameters = Dict(params) return ProcessHandlerReport(True) diff --git a/aiida_gaussian/workchains/cubes.py b/aiida_gaussian/workchains/cubes.py index d083e9d..6c668f0 100644 --- a/aiida_gaussian/workchains/cubes.py +++ b/aiida_gaussian/workchains/cubes.py @@ -282,7 +282,7 @@ def cubegen_step(self): builder.parent_calc_folder = self.ctx.formchk_node.outputs.remote_folder builder.code = self.inputs.cubegen_code builder.stencil = SinglefileData(io.BytesIO(stencil)) - builder.parameters = Dict(dict=params_dict) + builder.parameters = Dict(params_dict) builder.retrieve_cubes = self.inputs.retrieve_cubes builder.parser_params = self.inputs.cubegen_parser_params diff --git a/examples/example_01_opt.py b/examples/example_01_opt.py index 3d15404..7a59878 100644 --- a/examples/example_01_opt.py +++ b/examples/example_01_opt.py @@ -28,26 +28,24 @@ def example_dft(gaussian_code): memory_mb = 300 # Main parameters: geometry optimization - parameters = Dict( - dict={ - 'link0_parameters': { - '%chk': 'aiida.chk', - '%mem': "%dMB" % memory_mb, - '%nprocshared': num_cores, + parameters = Dict({ + 'link0_parameters': { + '%chk': 'aiida.chk', + '%mem': "%dMB" % memory_mb, + '%nprocshared': num_cores, + }, + 'functional': 'BLYP', + 'basis_set': '6-31g', + 'charge': 0, + 'multiplicity': 1, + 'route_parameters': { + 'scf': { + 'cdiis': None, }, - 'functional': 'BLYP', - 'basis_set': '6-31g', - 'charge': 0, - 'multiplicity': 1, - 'route_parameters': { - 'scf': { - 'cdiis': None, - }, - 'nosymm': None, - 'opt': None, - }, - } - ) + 'nosymm': None, + 'opt': None, + }, + }) # Construct process builder diff --git a/examples/example_02_output_wfx.py b/examples/example_02_output_wfx.py index 2954042..215e611 100644 --- a/examples/example_02_output_wfx.py +++ b/examples/example_02_output_wfx.py @@ -30,24 +30,22 @@ def example_dft(gaussian_code): memory_mb = 300 # parameters - parameters = Dict( - dict={ - 'link0_parameters': { - '%chk': 'aiida.chk', - '%mem': '%dMB' % memory_mb, - '%nprocshared': num_cores, - }, - 'functional': 'PBE1PBE', - 'basis_set': '6-31g', - 'route_parameters': { - 'nosymm': None, - 'Output': 'WFX' - }, - 'input_parameters': { - 'output.wfx': None - }, - } - ) + parameters = Dict({ + 'link0_parameters': { + '%chk': 'aiida.chk', + '%mem': '%dMB' % memory_mb, + '%nprocshared': num_cores, + }, + 'functional': 'PBE1PBE', + 'basis_set': '6-31g', + 'route_parameters': { + 'nosymm': None, + 'Output': 'WFX' + }, + 'input_parameters': { + 'output.wfx': None + }, + }) # Construct process builder diff --git a/examples/example_03_base_workflow.py b/examples/example_03_base_workflow.py index b7918e1..e1c3bc1 100644 --- a/examples/example_03_base_workflow.py +++ b/examples/example_03_base_workflow.py @@ -32,33 +32,31 @@ def example_dft(gaussian_code): memory_mb = 300 # Main parameters: geometry optimization - parameters = Dict( - dict={ - 'link0_parameters': { - '%chk': 'aiida.chk', - '%mem': "%dMB" % memory_mb, - '%nprocshared': num_cores, + parameters = Dict({ + 'link0_parameters': { + '%chk': 'aiida.chk', + '%mem': "%dMB" % memory_mb, + '%nprocshared': num_cores, + }, + 'functional': 'B3LYP', + 'basis_set': '6-31g', + 'charge': 0, + 'multiplicity': 1, + 'route_parameters': { + 'scf': { + 'conver': 7, + 'maxcycle': 140, }, - 'functional': 'B3LYP', - 'basis_set': '6-31g', - 'charge': 0, - 'multiplicity': 1, - 'route_parameters': { - 'scf': { - 'conver': 7, - 'maxcycle': 140, - }, - 'sp': None, - }, - } - ) + 'sp': None, + }, + }) # Construct process builder builder = GaussianBaseWorkChain.get_builder() # Handle the ASyTop error - builder.handler_overrides = Dict(dict={'handle_asytop_error': True}) + builder.handler_overrides = Dict({'handle_asytop_error': True}) builder.gaussian.structure = structure builder.gaussian.parameters = parameters diff --git a/examples/example_cubes_workchain.py b/examples/example_cubes_workchain.py index 74117b7..faadc79 100644 --- a/examples/example_cubes_workchain.py +++ b/examples/example_cubes_workchain.py @@ -37,27 +37,25 @@ def example(gaussian_code, formchk_code, cubegen_code): builder = GaussianCalculation.get_builder() builder.code = gaussian_code builder.structure = struct_node - builder.parameters = Dict( - dict={ - 'link0_parameters': { - '%chk': 'aiida.chk', - '%mem': "%dMB" % memory_mb, - '%nprocshared': str(num_cores), + builder.parameters = Dict({ + 'link0_parameters': { + '%chk': 'aiida.chk', + '%mem': "%dMB" % memory_mb, + '%nprocshared': str(num_cores), + }, + 'functional': 'UB3LYP', + 'basis_set': '6-31g', + 'charge': 0, + 'multiplicity': 1, + 'route_parameters': { + 'scf': { + 'cdiis': None, }, - 'functional': 'UB3LYP', - 'basis_set': '6-31g', - 'charge': 0, - 'multiplicity': 1, - 'route_parameters': { - 'scf': { - 'cdiis': None, - }, - 'guess': 'mix', - 'nosymm': None, - 'sp': None, - }, - } - ) + 'guess': 'mix', + 'nosymm': None, + 'sp': None, + }, + }) builder.metadata.options.resources = { "tot_num_mpiprocs": num_cores, "num_machines": 1, diff --git a/pyproject.toml b/pyproject.toml index af754b2..7ecfaec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ ] requires-python = ">=3.7" dependencies = [ - "aiida-core>=1.0.0,<2.0.0", + "aiida-core>=2.0.0,<3.0.0", "pymatgen>=2020.4,<2022.0.0", "cclib>=1.6.1,<=1.7", "ase",