-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SelfConsistentHubbard
: new implementation
The following changes are applied: * Inputs adapted for handling both onsite and intersite cases (U and U+V) * New inputs for skipping the first relaxation and for controlling the frequency of the call to the relax workflow * Validation for magnetic inputs * Outline change: always perform an scf with smearing, than recognize if it is a metal or insultaor; if insulator, than do scf with fixed occupation. * The check on convergence over Hubbard parameters is performed separately on onsite (U) and intersite (V). * Protocols through the `get_builder_from_protocol` * `clean_workdir` input
- Loading branch information
Showing
8 changed files
with
1,002 additions
and
312 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
25 changes: 25 additions & 0 deletions
25
src/aiida_quantumespresso_hp/workflows/protocols/hubbard.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
default_inputs: | ||
clean_workdir: True | ||
meta_convergence: True | ||
tolerance_onsite: 0.1 | ||
tolerance_intersite: 0.01 | ||
skip_first_relax: False | ||
scf: | ||
kpoints_distance: 0.4 | ||
|
||
default_protocol: moderate | ||
protocols: | ||
moderate: | ||
description: 'Protocol to perform the computation at normal precision at moderate computational cost.' | ||
precise: | ||
description: 'Protocol to perform the computation at high precision at higher computational cost.' | ||
tolerance_onsite: 0.01 | ||
tolerance_intersite: 0.005 | ||
scf: | ||
kpoints_distance: 0.2 | ||
fast: | ||
description: 'Protocol to perform the computation at low precision at minimal computational cost for testing purposes.' | ||
tolerance_onsite: 0.2 | ||
tolerance_intersite: 0.1 | ||
scf: | ||
kpoints_distance: 0.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[pytest] | ||
testpaths = tests | ||
filterwarnings = | ||
ignore::DeprecationWarning:aio_pika: | ||
ignore::DeprecationWarning:frozendict: | ||
ignore::DeprecationWarning:sqlalchemy_utils: | ||
ignore::DeprecationWarning:pkg_resources: |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Tests for the ``SelfConsistentHubbardWorkChain.get_builder_from_protocol`` method.""" | ||
from aiida.engine import ProcessBuilder | ||
import pytest | ||
|
||
from aiida_quantumespresso_hp.workflows.hubbard import SelfConsistentHubbardWorkChain | ||
|
||
|
||
def test_get_available_protocols(): | ||
"""Test ``SelfConsistentHubbardWorkChain.get_available_protocols``.""" | ||
protocols = SelfConsistentHubbardWorkChain.get_available_protocols() | ||
assert sorted(protocols.keys()) == ['fast', 'moderate', 'precise'] | ||
assert all('description' in protocol for protocol in protocols.values()) | ||
|
||
|
||
def test_get_default_protocol(): | ||
"""Test ``SelfConsistentHubbardWorkChain.get_default_protocol``.""" | ||
assert SelfConsistentHubbardWorkChain.get_default_protocol() == 'moderate' | ||
|
||
|
||
def test_default(fixture_code, data_regression, generate_hubbard_structure, serialize_builder): | ||
"""Test ``SelfConsistentHubbardWorkChain.get_builder_from_protocol`` for the default protocol.""" | ||
pw_code = fixture_code('quantumespresso.pw') | ||
hp_code = fixture_code('quantumespresso.hp') | ||
hubbard_structure = generate_hubbard_structure() | ||
|
||
builder = SelfConsistentHubbardWorkChain.get_builder_from_protocol(pw_code, hp_code, hubbard_structure) | ||
|
||
assert isinstance(builder, ProcessBuilder) | ||
data_regression.check(serialize_builder(builder)) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'overrides', ( | ||
{ | ||
'relax_frequency': 3 | ||
}, | ||
{ | ||
'tolerance_onsite': 1 | ||
}, | ||
{ | ||
'tolerance_intersite': 1 | ||
}, | ||
{ | ||
'meta_convergence': False | ||
}, | ||
{ | ||
'clean_workdir': False | ||
}, | ||
) | ||
) | ||
def test_overrides(fixture_code, generate_hubbard_structure, overrides): | ||
"""Test specifying different``overrides`` for the ``get_builder_from_protocol()`` method.""" | ||
pw_code = fixture_code('quantumespresso.pw') | ||
hp_code = fixture_code('quantumespresso.hp') | ||
hubbard_structure = generate_hubbard_structure() | ||
|
||
builder = SelfConsistentHubbardWorkChain.get_builder_from_protocol( | ||
pw_code, hp_code, hubbard_structure, overrides=overrides | ||
) | ||
|
||
for key, value in overrides.items(): | ||
assert builder[key].value == value | ||
|
||
|
||
def test_options(fixture_code, generate_hubbard_structure): | ||
"""Test specifying ``options`` for the ``get_builder_from_protocol()`` method.""" | ||
pw_code = fixture_code('quantumespresso.pw') | ||
hp_code = fixture_code('quantumespresso.hp') | ||
hubbard_structure = generate_hubbard_structure() | ||
|
||
queue_name = 'super-fast' | ||
withmpi = False # The protocol default is ``True`` | ||
|
||
options = {'queue_name': queue_name, 'withmpi': withmpi} | ||
builder = SelfConsistentHubbardWorkChain.get_builder_from_protocol( | ||
pw_code, hp_code, hubbard_structure, options_pw=options, options_hp=options | ||
) | ||
|
||
assert builder.hubbard.hp.metadata['options']['queue_name'] == queue_name | ||
assert builder.scf.pw.metadata['options']['queue_name'] == queue_name | ||
assert builder.relax.base.pw.metadata['options']['queue_name'] == queue_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
clean_workdir: true | ||
hubbard: | ||
hp: | ||
code: test.quantumespresso.hp@localhost | ||
metadata: | ||
options: | ||
max_wallclock_seconds: 43200 | ||
resources: | ||
num_machines: 1 | ||
withmpi: true | ||
parameters: | ||
INPUTHP: | ||
conv_thr_chi: 5.0e-06 | ||
settings: | ||
parent_folder_symlink: true | ||
parallelize_atoms: true | ||
parallelize_qpoints: true | ||
qpoints_distance: 0.8 | ||
hubbard_structure: CoLiO2 | ||
meta_convergence: true | ||
relax: | ||
base: | ||
kpoints_distance: 0.15 | ||
kpoints_force_parity: false | ||
pw: | ||
code: test.quantumespresso.pw@localhost | ||
metadata: | ||
options: | ||
max_wallclock_seconds: 43200 | ||
resources: | ||
num_machines: 1 | ||
withmpi: true | ||
parameters: | ||
CELL: | ||
cell_dofree: all | ||
press_conv_thr: 0.5 | ||
CONTROL: | ||
calculation: vc-relax | ||
etot_conv_thr: 4.0e-05 | ||
forc_conv_thr: 0.0001 | ||
tprnfor: true | ||
tstress: true | ||
ELECTRONS: | ||
conv_thr: 8.0e-10 | ||
electron_maxstep: 80 | ||
mixing_beta: 0.4 | ||
SYSTEM: | ||
degauss: 0.01 | ||
ecutrho: 240.0 | ||
ecutwfc: 30.0 | ||
nosym: false | ||
occupations: smearing | ||
smearing: cold | ||
pseudos: | ||
Co: Co<md5=04edd96127402ab6ffc358660b52a2db> | ||
Li: Li<md5=90ac4658c7606c7ad16e40ce66db5a86> | ||
O: O<md5=721f9895631356f7d4610e60de16fd63> | ||
max_meta_convergence_iterations: 5 | ||
meta_convergence: true | ||
volume_convergence: 0.02 | ||
scf: | ||
kpoints_distance: 0.4 | ||
kpoints_force_parity: false | ||
pw: | ||
code: test.quantumespresso.pw@localhost | ||
metadata: | ||
options: | ||
max_wallclock_seconds: 43200 | ||
resources: | ||
num_machines: 1 | ||
withmpi: true | ||
parameters: | ||
CONTROL: | ||
calculation: scf | ||
etot_conv_thr: 4.0e-05 | ||
forc_conv_thr: 0.0001 | ||
tprnfor: true | ||
tstress: true | ||
ELECTRONS: | ||
conv_thr: 8.0e-10 | ||
electron_maxstep: 80 | ||
mixing_beta: 0.4 | ||
SYSTEM: | ||
degauss: 0.01 | ||
ecutrho: 240.0 | ||
ecutwfc: 30.0 | ||
nosym: false | ||
occupations: smearing | ||
smearing: cold | ||
pseudos: | ||
Co: Co<md5=04edd96127402ab6ffc358660b52a2db> | ||
Li: Li<md5=90ac4658c7606c7ad16e40ce66db5a86> | ||
O: O<md5=721f9895631356f7d4610e60de16fd63> | ||
skip_first_relax: false | ||
tolerance_intersite: 0.01 | ||
tolerance_onsite: 0.1 |
Oops, something went wrong.