Skip to content

Commit

Permalink
added manual input option for random proj
Browse files Browse the repository at this point in the history
  • Loading branch information
AntimoMarrazzo committed Feb 5, 2019
1 parent 859b2f5 commit 07339ed
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions aiida_wannier90_theosworkflows/workflows/W90.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,12 @@ def setup(self):# pylint: disable=too-many-statements; # noqa: MC0001
)

self.report("SCDM mu is auto-set using projectability.")

try:
self.ctx.random_projections = control_dict['random_projections']
if self.ctx.random_projections:
self.report("projections override: set to random from input.")
except KeyError:
self.ctx.random_projections = False

# We expect either a KpointsData with given mesh or a desired distance between k-points
# if all([key not in self.inputs for key in ['kpoints_mesh', 'kpoints_distance']]):
Expand Down Expand Up @@ -461,7 +466,7 @@ def run_wannier90_pp(self): # pylint: disable=inconsistent-return-statements,too
inputs['kpoints'] = self.ctx.workchain_nscf.inp.kpoints
structure = self.inputs.structure
inputs['structure'] = structure
inputs['settings'] = ParameterData(dict={'postproc_setup': True})

wannier_pp_options = inputs.pop('pp_options', None)
inputs.pop('options', None) #Need to pop it !

Expand Down Expand Up @@ -504,6 +509,13 @@ def run_wannier90_pp(self): # pylint: disable=inconsistent-return-statements,too
self.abort_nowait(
'WARNING: set_mu_and_sigma_from_projection failed!')
inputs['parameters'] = results['output_parameters']

settings_dict_pp = {'postproc_setup': True}

if self.ctx.random_projections:
settings_dict_pp['random_projections'] = True

inputs['settings'] = ParameterData(dict=settings_dict_pp)

self.ctx.bands_plot = bands_plot
if bands_plot:
Expand Down Expand Up @@ -620,6 +632,12 @@ def run_wannier90(self): # pylint:disable=inconsistent-return-statements,too-man
settings = inputs['settings']
except KeyError:
settings = None

if self.ctx.random_projections:
if settings is not None:
settings['random_projections'] = True
else:
settings = {'random_projections':True}
#Check if the hamiltonian needs to be retrieved or not
if self.ctx.retrieve_ham:
if settings is None:
Expand Down

0 comments on commit 07339ed

Please sign in to comment.