[ase-users] Bug in ASE package
Ask Hjorth Larsen
asklarsen at gmail.com
Sun May 10 14:47:01 CEST 2020
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200510/4e4e1c4c/attachment.html>
More information about the ase-users
mailing list