Skip to content

Commit

Permalink
WIP: measure precision workflow accept ecutwfc/ecutrho as inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Aug 9, 2023
1 parent 101879d commit 32bebe8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ This what we call it residual volume is therefore a stiffness-agnostic value tha
In convergence delta factor calculation, the GS configurations from Cottiner's paper are used.
To have a uniform sence of precision through looking at delta factor, the value is defined as delta factor per atom.
However, since it is hard to define delta per/atom for oxides, ACWF does not use per/atom value to represent results.
To compatible with it, the precision verification also use the structure delta.
It uses the nu factor which was defined in the ACWF paper.

For the oxides, it needs oxygen pseudopotential first, same as nitrides.
The verification needs to run for all know oxygen/nitrigen pseudopotentials filst. However, the cutoffs of them are not known and the cutoffs are input for the precision measure.
So the very first run is the convergence test on all oxygen/nitrigen pseudopotentials.
Once the recommended cutoffs are known, the precision measure can be run for all oxygen/nitrigen elements.

## Phonon frequencies specification

Expand Down Expand Up @@ -187,4 +192,4 @@ MIT

## Contact

📧 email: jusong.yu@epfl.ch
📧 email: jusong.yu@psi.ch
5 changes: 0 additions & 5 deletions aiida_sssp_workflow/protocol/control.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
precheck:
description: run on 150 v.s 200 v.s 300 Ry wavefunction cutoff with fix dual to give sense whether 200 Ry enough

# max_wfc: 0 # Not used if run precision measurement veri with this protocol, just raise exception.
wfc_scan: [150, 200, 300] # at fix rho
nc_dual_scan: [] # set empty so rho test not run
nonnc_dual_scan: []
Expand All @@ -11,7 +10,6 @@ precheck:
standard:
description: high wavefunction cutoff set and cutoffs dense interval therefore time consuming

max_wfc: 200 # The max wfc cut for precision measurement
wfc_scan: [30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 90, 100, 120, 150, 200] # at fix rho
nc_dual_scan: [2.0, 2.5, 3.0, 3.5, 4.0] # at fix wfc
nonnc_dual_scan: [6.0, 6.5, 7.0, 7.5, 8.0]
Expand All @@ -20,7 +18,6 @@ standard:
quick:
description: low wavefunction cutoff set and cutoffs sparse interval therefore can run on local

max_wfc: 200 # The max wfc cut for precision measurement
wfc_scan: [30, 40, 50, 60, 75, 100, 150, 200] # at fix rho
nc_dual_scan: [3.0, 3.5, 4.0] # at fix wfc
nonnc_dual_scan: [6.0, 7.0, 8.0]
Expand All @@ -29,7 +26,6 @@ quick:
test:
description: test only

max_wfc: 35 # The max wfc cut for precision measurement
wfc_scan: [30, 35] # at fix rho
nc_dual_scan: [] # at fix wfc
nonnc_dual_scan: [6.0, 8.0]
Expand All @@ -38,7 +34,6 @@ test:
opsp:
description: To running opsp verification, make the calculations finished fast.

max_wfc: 40 # The max wfc cut for precision measurement
wfc_scan: [30, 35] # at fix rho
nc_dual_scan: [2.0, 4.0] # at fix wfc
nonnc_dual_scan: [6.0, 8.0]
Expand Down
4 changes: 2 additions & 2 deletions aiida_sssp_workflow/workflows/measure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def define(cls, spec):
help='Pseudopotential to be verified')
spec.input('protocol', valid_type=orm.Str, required=True,
help='The protocol which define input calculation parameters.')
spec.input('cutoff_control', valid_type=orm.Str, default=lambda: orm.Str('standard'),
help='The control protocol where define max_wfc.')
spec.input('wavefunction_cutoff', valid_type=orm.Float, required=True, help='The wavefunction cutoff.')
spec.input('charge_density_cutoff', valid_type=orm.Float, required=True, help='The charge density cutoff.')
spec.input('options', valid_type=orm.Dict, required=True,
help='Optional `options` to use for the `PwCalculations`.')
spec.input('parallelization', valid_type=orm.Dict, required=True,
Expand Down
35 changes: 19 additions & 16 deletions aiida_sssp_workflow/workflows/measure/precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ class PrecisionMeasureWorkChain(_BaseMeasureWorkChain):

_NBANDS_FACTOR_FOR_LAN = 1.5

# ECUT for oxygen, remember to update this if the oxygen pseudo is changed
_O_ECUTWFC = 75.0
_O_ECUTRHO = 600.0

# ECUT for nitrogen, remember to update this if the nitrogen pseudo is changed
_N_ECUTWFC = 80.0
_N_ECUTRHO = 320.0

@classmethod
def define(cls, spec):
"""Define the process specification."""
Expand Down Expand Up @@ -135,6 +143,10 @@ def setup(self):

self._setup_pseudo_and_configuration()

# set up the ecutwfc and ecutrho
self.ctx.ecutwfc = self.inputs.wavefunction_cutoff.value
self.ctx.ecutrho = self.inputs.charge_density_cutoff.value

def setup_pw_parameters_from_protocol(self):
"""Input validation"""
# pylint: disable=invalid-name, attribute-defined-outside-init
Expand All @@ -157,11 +169,6 @@ def setup_pw_parameters_from_protocol(self):
if key not in clist:
self.ctx.structures.pop(key)

cutoff_control = get_protocol(
category="control", name=self.inputs.cutoff_control.value
)
self._ECUTWFC = cutoff_control["max_wfc"]

parameters = {
"CONTROL": {
"calculation": "scf",
Expand All @@ -178,8 +185,6 @@ def setup_pw_parameters_from_protocol(self):
},
}

self.ctx.ecutwfc = self._ECUTWFC

self.ctx.pw_parameters = update_dict(self.ctx.pw_parameters, parameters)

self.logger.info(f"The pw parameters for EOS step is: {self.ctx.pw_parameters}")
Expand Down Expand Up @@ -223,7 +228,8 @@ def _get_inputs(self, structure, configuration):
kpoints_distance = self.ctx.kpoints_distance

# Since non-NC oxygen pseudo is used
ecutrho = self.ctx.ecutwfc * 8
ecutwfc = max(self.ctx.ecutwfc, self._O_ECUTWFC)
ecutrho = max(self.ctx.ecutrho, self._O_ECUTRHO)

# need also increase nbands for Rare-earth oxides.
# See https://github.com/aiidateam/aiida-sssp-workflow/issues/161
Expand All @@ -249,10 +255,9 @@ def _get_inputs(self, structure, configuration):
pseudos = self.ctx.pseudos_unary
pw_parameters = self.ctx.pw_parameters
kpoints_distance = self.ctx.kpoints_distance
if pseudo_type in ["nc", "sl"]:
ecutrho = self.ctx.ecutwfc * 4
else:
ecutrho = self.ctx.ecutwfc * 8

ecutwfc = self.ctx.ecutwfc
ecutrho = self.ctx.ecutrho

if configuration == "GS" and self.ctx.element in MAGNETIC_ELEMENTS:
# specific setting for magnetic elements gs since mag on
Expand All @@ -272,10 +277,8 @@ def _get_inputs(self, structure, configuration):
pseudos = self.ctx.pseudos_magnetic
pw_parameters = update_dict(self.ctx.pw_parameters, pw_magnetic_parameters)

if pseudo_type in ["nc", "sl"]:
ecutrho = self.ctx.ecutwfc * 4
else:
ecutrho = self.ctx.ecutwfc * 8
ecutwfc = self.ctx.ecutwfc
ecutrho = self.ctx.ecutrho

if configuration == "RE":
# pseudos for nitrides
Expand Down

0 comments on commit 32bebe8

Please sign in to comment.