Skip to content

Commit

Permalink
Migrate to aiida 2 (#23)
Browse files Browse the repository at this point in the history
* update aiida-core dependency

* run aiida-upgrade

* fix yapf

* update ci
  • Loading branch information
eimrek authored Nov 21, 2022
1 parent e2dd422 commit 1f603e1
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 112 deletions.
49 changes: 20 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 )
2 changes: 1 addition & 1 deletion aiida_gaussian/calculations/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import pymatgen.io.gaussian as mgaus

StructureData = DataFactory("structure")
StructureData = DataFactory("core.structure")


class GaussianCalculation(CalcJob):
Expand Down
2 changes: 1 addition & 1 deletion aiida_gaussian/tests/test_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
4 changes: 2 additions & 2 deletions aiida_gaussian/workchains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from aiida.plugins import CalculationFactory, DataFactory

GaussianCalculation = CalculationFactory('gaussian')
StructureData = DataFactory('structure')
StructureData = DataFactory('core.structure')


class GaussianBaseWorkChain(BaseRestartWorkChain):
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion aiida_gaussian/workchains/cubes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 17 additions & 19 deletions examples/example_01_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
34 changes: 16 additions & 18 deletions examples/example_02_output_wfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
38 changes: 18 additions & 20 deletions examples/example_03_base_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 18 additions & 20 deletions examples/example_cubes_workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1f603e1

Please sign in to comment.