[ase-users] Attribute error with positions

Max Hoffmann mjhoffmann at gmail.com
Thu Jan 28 18:06:18 CET 2016


Hi

   if you include the python builtin functions, dir and type you fill most
likely get a good hint. Include something like 'print(dir(i))' and
'print(dir(i))' in your code and you will soon understand what is
happening. Furthermore I highly recommend ipython for debugging cases like
this or pudb if you want to look at your script at runtime. Lastly I try to
never use blank import like 'from ase import *', precisely because they
make debugging so hard. These statements just cluster your namespace and
are hard to backtrace.

Best,
Max.

On Thu, Jan 21, 2016 at 11:32 AM, Iyemperumal, Satish Kumar <
siyemperumal at wpi.edu> wrote:

> Hi Abhirup
>
> I use the following
>
> list = []
> s = read("fname.POSCAR")
> for i in s:
> list.append(i.position[2])
>
>
> Best,
> Satish
> ________________________________
> From: ase-users-bounces at listserv.fysik.dtu.dk [
> ase-users-bounces at listserv.fysik.dtu.dk] on behalf of Abhirup Patra [
> tuf43805 at temple.edu]
> Sent: Thursday, January 21, 2016 12:24 PM
> To: ase-users at listserv.fysik.dtu.dk
> Subject: [ase-users] Attribute error with positions
>
> Hi All,
>
> I am trying to get the inter layer distance between the layers of the
> surface slab from using the
> CONTCATR of the VASP .
>
> But when I am trying to read the z-coordinates of the atoms using
> 'positions' attribute
> I am getting the error as -
>
> AttributeError: 'file' object has no attribute 'positions'
>
> Here is what i have imported in my code-
>
> import ase.io<http://ase.io>
> from ase import Atoms
> from ase.io<http://ase.io> import read
> from ase.io<http://ase.io> import write
> from ase import *
> import numpy as np
>
> Can anyone please give me any idea where I am going wrong ?
>
> Thanks,
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>



-- 
Dr. Max J. Hoffmann
MAIL
Dept. of Chemical Engineering              PHONE:  +1 650 521 7187
Stanford University                                EMAIL:
maxjh at stanford.edu
4300
Shriram Center, room 315
443 Via Ortega
Stanford, CA 94035-4125
(U.S.A.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20160128/5a9481df/attachment.html>


More information about the ase-users mailing list