-
Notifications
You must be signed in to change notification settings - Fork 1
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
Variables not included for properties when class is initialized in parent normalization #108
Comments
Sadly, there is no solution. Thing is that normalize() is only run if the class has been instantiated and appended, otherwise it won't. The logic is a bit convoluted: if the parser does not add it, it is easy to instantiate The solution might be to define a unknown_energy = UnknownEnergy()
unknown_energy.m_cache['normalize'] = false and in the TotalEnergy.normalize function: if self.contributions is None:
contribution = UnknownEnergy()
contribution .m_cache['normalize'] = true
self.contributions.append(contribution)
if contributions is not None and isinstance(contributions.m_def, UnknownEnergy) and contributions.m_cache['normalize']:
contributions.normalize(archive, logger) @ladinesa what do you think? |
not sure if I understood the problem fully but I think this is one of the cases where a separate normalizer class is really necessary. One can also leverage the after_normalization abstract method of a parser. |
I'd kind of avoid having yet another layer of normalizations on top. After the weekend, I am pretty convinced that this will be about checking if Something similar happens for |
Ok, I see. I will try to implement this when I have a chance. |
This occurred in the energies example in Part 4 of Tutorial 14, with the relevant code from the schema solution within the vasp-plugin.
Here the
UnknownEnergy
class is added to total energy contributions in the normalizer ofTotalEnergy()
. The idea was for this to always happen, even if the parser does not add this class to the archive. However, in this case the normalization of the child class is not run.Do we have a general solution to this?
The text was updated successfully, but these errors were encountered: