Skip to content

Bug with makeStr.py for arrows #126

@nhew1994

Description

@nhew1994

I'm trying Ex. 6: Including displacement directions in the enumeration of a
concentration restricted cell. in EXAMPLES.

../../src/enum.x arrow_enum_struct_enum.in works and generates the expected number of unique configurations. However, there appears to be a bug when I try to use makeStr.py.

command: makeStr.py all -displace 0.3
error:
Traceback (most recent call last):
File "/mnt/c/Users/nigel/OneDrive/Desktop/enumlib/aux_src/makeStr.py", line 1416, in
run(_parser_options())
File "/mnt/c/Users/nigel/OneDrive/Desktop/enumlib/aux_src/makeStr.py", line 1412, in run
_make_structures(args)
File "/mnt/c/Users/nigel/OneDrive/Desktop/enumlib/aux_src/makeStr.py", line 1179, in _make_structures
_write_POSCAR(system, space_data, structure, args)
File "/mnt/c/Users/nigel/OneDrive/Desktop/enumlib/aux_src/makeStr.py", line 1107, in _write_POSCAR
directions.append(array(arrow_directions[int(arrow)]))
~~~~~~~~~~~~~~~~^^^^^^^^^^^^
IndexError: list index out of range

The source of this error is the following. In struct_enum.out, the arrows column numbers go from 0 to 6 (7 elements). In makeStr.py line 1068 in def _write_POSCAR, arrow_directions only has 6 elements. Thus, an arrow number of 6 will trigger the error above.

Also, in the current state, an arrow number of 0 will trigger a displacement of [1, 0 0] times the lattice constant. Shouldn't 0 mean no displacement be applied?

To fix this issue, I think the following change should be made in makeStr.py:
arrow_directions = [
[0, 0, 0],
[1, 0, 0],
[-1, 0, 0],
[0, 1, 0],
[0, -1, 0],
[0, 0, 1],
[0, 0, -1],
]

Please let me know your thoughts.

Nigel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions