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

miller_index_from_sites gives wrong miller index #1301

Closed
utf opened this issue Oct 19, 2018 · 4 comments
Closed

miller_index_from_sites gives wrong miller index #1301

utf opened this issue Oct 19, 2018 · 4 comments

Comments

@utf
Copy link
Member

utf commented Oct 19, 2018

The pymatgen.core.surface.miller_index_from_sites method gives incorrect results. It also seems quite temperamental about the choice of coordinates. E.g.

from pymatgen.core.structure import Structure
from pymatgen.core.surface import miller_index_from_sites

structure = Structure(
    [10, 0, 0, 0, 10, 0, 0, 0, 10],
    ['Fe', 'Fe', 'Fe'],
    [[0.5, 0.8, 0.8], [0.5, 0.4, 0.2], [0.5, 0.3, 0.7]]
)

miller_index_from_sites(structure.lattice.matrix, structure.cart_coords)

Gives [-1.04, 0. , 0. ] rather than [1, 0. , 0. ].

Also, changing the atom coordinates slightly to:

[[0.5, 0.8, 0.8], [0.5, 0.6, 0.6], [0.5, 0.3, 0.3]]

Gives [nan, nan, nan].

@shyuep
Copy link
Member

shyuep commented Oct 19, 2018

@richardtran415 Pls investigate.

@CifLord
Copy link
Contributor

CifLord commented Oct 19, 2018

Looking into it

@utf
Copy link
Member Author

utf commented Oct 19, 2018

I've got a fix for this. Just doing some testing but will submit a PR tomorrow.

@utf
Copy link
Member Author

utf commented Oct 24, 2018

Fixed in #1302

@utf utf closed this as completed Oct 24, 2018
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

3 participants