Skip to content

Commit

Permalink
Customize oxygen pseudo supported (#234)
Browse files Browse the repository at this point in the history
This change allow to pass oxygen pseudopotenital, if not provide, the
default oxygen pseudopotentieal will be used.
  • Loading branch information
unkcpz authored Nov 30, 2023
1 parent 61f1377 commit 2a3ae8f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions aiida_sssp_workflow/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
@options.OverridableOption(
"--pw-code", "pw_code", type=types.CodeParamType(entry_point="quantumespresso.pw")
)(required=True)
@click.option(
"--oxygen-pseudo",
"oxygen_pseudo",
type=click.Path(exists=True),
help="Oxygen pseudo to use for oxides precision measure workflow.",
)
@options.OverridableOption(
"--pw-code-large-memory",
"pw_code_large_memory",
Expand Down Expand Up @@ -115,6 +121,7 @@ def launch(
walltime,
num_mpiprocs,
pseudo,
oxygen_pseudo,
clean_workdir,
daemon,
comment,
Expand Down Expand Up @@ -240,6 +247,12 @@ def launch(
if pw_code_large_memory:
inputs["pw_code_large_memory"] = pw_code_large_memory

if oxygen_pseudo:
with open(oxygen_pseudo, "rb") as stream:
oxygen_pseudo = UpfData(stream)

inputs["measure"]["oxygen_pseudo"] = oxygen_pseudo

if len(configuration) == 0:
pass
elif len(configuration) == 1:
Expand Down
1 change: 1 addition & 0 deletions aiida_sssp_workflow/workflows/measure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def define(cls, spec):
help='The `pw.x` code use for the `PwCalculation`.')
spec.input('pseudo', valid_type=UpfData, required=True,
help='Pseudopotential to be verified')
spec.input('oxygen_pseudo', valid_type=UpfData, required=False)
spec.input('protocol', valid_type=orm.Str, required=True,
help='The protocol which define input calculation parameters.')
spec.input('wavefunction_cutoff', valid_type=orm.Float, required=True, help='The wavefunction cutoff.')
Expand Down
5 changes: 4 additions & 1 deletion aiida_sssp_workflow/workflows/measure/precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def _setup_pseudo_and_configuration(self):
# for the oxide, need to pseudo of oxygen,
# the pseudo is the one select after the oxygen verification and
# store in the `statics/upf/O.**.upf`
pseudo_O = get_pseudo_O()
if "oxygen_pseudo" in self.inputs:
pseudo_O = self.inputs.oxygen_pseudo
else:
pseudo_O = get_pseudo_O()
self.ctx.pseudos_oxide = {
self.ctx.element: self.inputs.pseudo,
"O": pseudo_O,
Expand Down

0 comments on commit 2a3ae8f

Please sign in to comment.