[ase-users] Bug in ASE package
Jakob Schiøtz
schiotz at fysik.dtu.dk
Fri May 15 11:23:04 CEST 2020
Dear all,
Sorry for being late in replying.
Miller indices in the hexagonal structures are normally given with four indices, not three. There are at least two equally good but incompatible ways to define a 3-number Miller index in hexagonal structures (with 60 and 120 degrees between the basis vectors in real and reciprocal space, or vice versa), but one consistent (and less confusing) way to define a four-index version.
See e.g.
https://en.wikipedia.org/wiki/Miller_index#Case_of_hexagonal_and_rhombohedral_structures
https://nirajchawake.wordpress.com/2015/01/11/hexagonal-system-and-miller-bravais-notations-i-hk/
Best regards
Jakob
--
Jakob Schiøtz, professor, Ph.D.
Department of Physics
Technical University of Denmark
DK-2800 Kongens Lyngby, Denmark
http://www.fysik.dtu.dk/~schiotz/
> On 10 May 2020, at 14.47, Ask Hjorth Larsen via ase-users <ase-users at listserv.fysik.dtu.dk> wrote:
>
> Dear Shibu,
>
> Am Sa., 9. Mai 2020 um 21:55 Uhr schrieb SHIBU MEHER via ase-users <ase-users at listserv.fysik.dtu.dk>:
> Hello,
> I found a bug in ase.lattice.hexagonal.find_direction.
> Using the given code. Following error is occurring.
> ValueError: not enough values to unpack (expected 4, got 3)
>
> To correct replace the for loop with following chunk.
> for obj in zip(directions,miller):
> if obj[1] is not None:
> a = obj[0][0]
> b = obj[0][1]
> c = obj[0][2]
> d = obj[1]
> if a + b + c != 0:
> raise ValueError(
> ("(%d,%d,%d,%d) is not a valid hexagonal Miller " +
> "index, as the sum of the first three numbers " +
> "should be zero.") % (a,b,c,d))
> x = 4*a + 2*b
> y = 2*a + 4*b
> z = 3*d
> obj[i] = (x,y,z)
>
> Am I correct? This code now is working fine.
>
> A bit more context would be beneficial here (unless someone else is an expert in this particular function and confirms).
>
> Do you have a small standalone example which should work, but fails due to this error, and will work after applying this change?
>
> (You're also more than welcome to add that example as a unittest and open a merge request with the fix.)
>
> Best regards
> Ask
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
More information about the ase-users
mailing list