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

Running the Step6 tutorial crashes when running step6_part5.py #25

Open
rartino opened this issue Jun 26, 2020 · 1 comment
Open

Running the Step6 tutorial crashes when running step6_part5.py #25

rartino opened this issue Jun 26, 2020 · 1 comment

Comments

@rartino
Copy link
Member

rartino commented Jun 26, 2020

Received over email.

Running the Step6 tutorial crashes when running step6_part5.py with the following traceback:

Traceback (most recent call last):
  File "/home/hpleva/httk/src/httk/db/filteredcollection.py", line 925, in __getattr__
    typex = typedict[name]
KeyError: 'formula_symbols'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "step6_part5.py", line 28, in <module>
    search.add_all(search_struct.formula_symbols.is_in('O', 'Ca', 'Ti'))
  File "/home/hpleva/httk/src/httk/db/filteredcollection.py", line 961, in __getattr__
    raise Exception("Field "+name+" does not exist:"+str(e))
Exception: Field formula_symbols does not exist:'formula_symbols'

This happens, because in step6_part4.py we save UnitcellStructure (instead of Structure) in the database, which does not have the "formula_symbols" property.

If I modify scripts step6_part4.py and step6_part5.py so that Structure is used instead of UnitcellStructure, I get further, but encounter another problem in step6_part5.py:

Traceback (most recent call last):
  File "step6_part5.py", line 40, in <module>
    pd = StructurePhaseDiagram.create(structures, energies)
  File "/home/hpleva/httk/src/httk/atomistic/structurephasediagram.py", line 73, in create
    pd = setup_phasediagram(structures, energies)
  File "/home/hpleva/httk/src/httk/atomistic/structurephasediagram.py", line 101, in setup_phasediagram
    formula = struct.uc_formula
AttributeError: 'Structure' object has no attribute 'uc_formula'

The Structure class no longer has the "uc_formula" property, because it was removed in an old commit.
If I copy-paste the "uc_formula" back in the Structure class from an old commit, everything works and I the phase diagram figure is produced.

  • Should the Step6 tutorial be changed so that it uses Structure instead of the UnitcellStructure? The "3_phasediagram_pymatgen.py" example uses Structure, which points to the direction that the step6_part4.py and step6_part5.py scripts should be updated.
  • Should the setup_phasediagram() function not try to access the "uc_formula" property of a structure, or should the Structure class still contain the "uc_formula" property?
@rartino
Copy link
Member Author

rartino commented Jun 26, 2020

Thanks for bringing this up. I'm not sure how this bug happened without me noticing at some point.

The swap of UnitcellStructure instead of Structure was done to avoid the need for a symmetry finder to be installed to run the tutorial. It would be good if we can keep that.

As far as I recall uc_formula was removed, because it is the same thing as formula. And replacing uc_formula with formula in the code that breaks seems to come with no risk, since it is only used to label the phase diagram.

Should the Step6 tutorial be changed so that it uses Structure instead of the UnitcellStructure? The "3_phasediagram_pymatgen.py" example uses Structure, which points to the direction that the step6_part4.py and step6_part5.py scripts should be updated.

For now it probably should, so that this tutorial step does not break. In the longer run, we need to check that we have enough functionality in httk so that this example can run without an external symmetry finder.

Should the setup_phasediagram() function not try to access the "uc_formula" property of a structure, or should the Structure class still contain the "uc_formula" property?

No, this seems a bug; I believe the access should have been replaced with formula when uc_formula was removed.

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

No branches or pull requests

1 participant