Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix in setting the number of electrons in kcp in spin-polarized calculations #223

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/koopmans/workflows/_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ def __init__(self, atoms: Atoms,

self.parameters.pseudo_directory = pseudo_dir.resolve()

# For any kwargs...
for key, value in kwargs.items():
match = False
# if they correspond to any valid calculator parameter, set it
for calc_params in calculator_parameters.values():
if calc_params.is_valid(key):
calc_params[key] = value
match = True
# if not a calculator, workflow, or plotting keyword, raise an error
if not match and not self.parameters.is_valid(key) and not self.plotting.is_valid(key) \
and not self.ml.is_valid(key):
raise ValueError(f'{key} is not a valid setting')

# Before saving the calculator_parameters, automatically generate some keywords and perform some sanity checks
if self.parameters.task != 'ui' and autogenerate_settings:
# Automatically calculate nelec/nelup/neldw/etc using information contained in the pseudopotential files
Expand Down Expand Up @@ -301,19 +314,6 @@ def __init__(self, atoms: Atoms,
# Initialize self.parent
self.parent: Optional[Workflow] = None

# For any kwargs...
for key, value in kwargs.items():
match = False
# if they correspond to any valid calculator parameter, set it
for calc_params in self.calculator_parameters.values():
if calc_params.is_valid(key):
calc_params[key] = value
match = True
# if not a calculator, workflow, or plotting keyword, raise an error
if not match and not self.parameters.is_valid(key) and not self.plotting.is_valid(key) \
and not self.ml.is_valid(key):
raise ValueError(f'{key} is not a valid setting')

# Adding excluded_bands info to self.projections
if self.projections:
for spin in ['up', 'down', None]:
Expand Down
Loading