[ase-users] tuple in atoms.center ?

Jens Jørgen Mortensen jensj at fysik.dtu.dk
Mon May 5 12:52:11 CEST 2014


Den 02-05-2014 22:42, Peterson, Andrew skrev:
> I just checked in a version that allows you to pass in a list/tuple. I 
> think the old version's intention was that you'd call center 
> sequentially if you wanted it on two axes, but this is a little 
> clearer for the user now.

Yes, this is much better.  I've updated the docstring also:

https://wiki.fysik.dtu.dk/ase/ase/atoms.html#ase.atoms.Atoms.center

Jens Jørgen

>
> Note we couldn't change that line to "tuple(axis)" as it would crash 
> if axis is not iterable; e.g., if axis=0 is passed. Thus, the new 
> version checks if it is iterable then converts to a tuple if not.
>
> Andy
>
>
> On Thu, May 1, 2014 at 10:44 AM, Matt Addicoat <madd.cluster at gmail.com 
> <mailto:madd.cluster at gmail.com>> wrote:
>
>     Hi,
>
>     In the center function, if no axis is passed, a tuple, (0,1,2) is
>     created. If you do pass as axis, the else block is clearly meaning to
>     also create a tuple from whatever is passed as the axes parameter.
>
>     However when I pass a list; [0, 1], it actually creates a tuple of one
>     element; ([0, 1],) and the subsequent np.dot fails.
>
>     Changing the line:
>
>     axes = (axis,)
>
>     to
>     axes = tuple(axis)
>
>     creates the expected tuple; (0,1) and everything else appears to
>     work fine.
>
>     Is this a minor bug? If not, how should one pass the axes to this
>     function?
>
>     Warm Regards,
>     Matt
>
>     _______________________________________________
>     ase-users mailing list
>     ase-users at listserv.fysik.dtu.dk
>     <mailto:ase-users at listserv.fysik.dtu.dk>
>     https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>
>
> -- 
> Andrew Peterson
> Assistant Professor
> Brown University School of Engineering
> Barus & Holley 247
> 184 Hope Street
> Providence, RI 02912
> (401) 863-2153
> http://brown.edu/go/catalyst
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20140505/c878a0ac/attachment.html>


More information about the ase-users mailing list