-
Notifications
You must be signed in to change notification settings - Fork 10
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
170 broken parsing of 0d systems in crystal #177
170 broken parsing of 0d systems in crystal #177
Conversation
@ladinesa Let me know if you prefer that Lauri reviews, since he originally wrote the Crystal parser. |
e12f13f
to
0564737
Compare
Note, the conversion in However, the first print-out of the geometric structure is fully Cartesian. You can find it under the line |
On the same thought, should we consider changing our communication of the PBC conditions? Technically, the code converts any non-periodic axis to one with 500 Angstrom. It is pretty verbose about this, printing it out in the lattice parameters. However, when a 0D system is run, it no longer prints out the lattice... |
electronicparsers/crystal/parser.py
Outdated
"lattice_positions_raw", | ||
fr'AT\.IRR\.\s+AT\s+AT\.N\.\s+X\s+Y\s+Z\s*{br}' +\ | ||
fr'((?:\s+{integer}\s+{integer}\s+{integer}\s+{flt}\s+{flt}\s+{flt}{br})+)', | ||
shape=(-1, 6), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first time I have seen shape -1, good to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot that I left this capturing group in... It didn't work, but I fixed it now. Still, it isn't used anywhere atm.
Looks good. thanks for the fix |
So, the problem lies with line 629: # If any geometry edits (supercells, substitutions, dispplacements,
# deformations, nanotube construction, etc.) are done on top of the
# original system, they override the original system.
if system_edited is not None:
if system_edited["labels_positions_nanotube"] is not None: # pylint: disable=E1136
labels_positions = system_edited["labels_positions_nanotube"] # pylint: disable=E1136
else:
labels_positions = system_edited["labels_positions"] # pylint: disable=E1136
# TODO adjust re pattern for other formats e.g. with R(ANGS)
if labels_positions is not None:
atomic_numbers = labels_positions[:, 2] # pylint: disable=E1136
atom_labels = labels_positions[:, 3] # pylint: disable=E1136
atom_pos = labels_positions[:, 4:7] # pylint: disable=E1136
if system_edited["lattice_parameters"] is not None: # pylint: disable=E1136
lattice = system_edited["lattice_parameters"] # pylint: disable=E1136 Here, the format may be changed to include a mixture of scaled and Cartesian coordinates. |
What do I do with |
Not sure what this is for, it is the starting structure? if I understand the issue right, probably you can set the argument to to_system for dimensionality to 0 for labels_positions_raw. |
Indeed,
So you see that we have 2 options on how to deal with this. |
Just maybe use labels_positions. Leave the defintion for labels_positions_raw for now. |
I fixed the lattice parameter assignment causing the bug in issue #170.
It now uses the
dimensionality
to assigncart_pos
, rather than the system type.I also cleaned up
to_system
, which assigned the Cartesian positions.I slightly extended the tests, but I can see to also include an actual sample of the original bug report.
All examples from the bug report now pass, see figure.