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

UnboundLocalError: local variable 'single_atom_energies' referenced before assignment #326

Closed
ThePauliPrinciple opened this issue Oct 24, 2022 · 1 comment · Fixed by #327

Comments

@ThePauliPrinciple
Copy link

Describe the bug
Using the development branch:
When using the flare/scripts/otf_train.py script, I get the following error UnboundLocalError: local variable 'single_atom_energies' referenced before assignment.
An else statement handling this case should probably be added here:

species_map = {flare_config.get("species")[i]: i for i in range(n_species)}
sae_dct = flare_config.get("single_atom_energies", None)
if sae_dct is not None:
assert n_species == len(
sae_dct
), "'single_atom_energies' should be the same length as 'species'"
single_atom_energies = {i: sae_dct[i] for i in range(n_species)}
sgp = SGP_Wrapper(
kernels=kernels,
descriptor_calculators=descriptors,
cutoff=cutoff,
sigma_e=flare_config.get("energy_noise"),
sigma_f=flare_config.get("forces_noise"),
sigma_s=flare_config.get("stress_noise"),
species_map=species_map,
variance_type=flare_config.get("variance_type", "local"),
single_atom_energies=single_atom_energies,
energy_training=flare_config.get("energy_training", True),
force_training=flare_config.get("force_training", True),
stress_training=flare_config.get("stress_training", True),
max_iterations=max_iterations,
opt_method=opt_algorithm,
bounds=bounds,
)

@YuuuXie YuuuXie linked a pull request Oct 24, 2022 that will close this issue
YuuuXie added a commit that referenced this issue Oct 25, 2022
@YuuuXie
Copy link
Collaborator

YuuuXie commented Oct 25, 2022

close by #327

@YuuuXie YuuuXie closed this as completed Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants