[ase-users] Using the spacegroup

Alexander Held alexander.held at fmf.uni-freiburg.de
Thu Sep 13 14:42:44 CEST 2012


On 13.09.2012 13:18, khadija korichi wrote:
>
> Hi all
> when I run the following example  it give me this error message
>
> File "ss.py", line 23
>     tunnel =crystal([('Fe', (0.50000000, 0.25000000,   0.63040434),   
> magmom=0.0),
> ^
> SyntaxError: invalid syntax
> **************************************************************
>

Hi,

you are trying to use keyword arguments inside a tuple, which is not 
legal python syntax.
I guess, what you intended to do is to call the Atom constructor:

tunnel = crystal(
     [
         Atom('Fe', (0.50000000,   0.25000000,   0.63040434), magmom=0.0),
         Atom('Fe', (0.00000000,   0.50000000,   0.67009491), magmom=0.0),
         Atom('Fe', (0.00000000,   0.00000000,   0.67009491), magmom=0.0),
         Atom('Fe', (0.50000000,   0.25000000,   0.70978550), magmom=0.0),
         Atom('Fe', (0.00000000,   0.50000000,   0.74947608), magmom=0.0),
         Atom('Fe', (0.00000000,   0.00000000,   0.74947608), magmom=0.0),
         Atom('Fe', (0.50000000,   0.25000000,   0.78916665), magmom=0.0),
         Atom('Fe', (0.00000000,   0.50000000,   0.82749999), magmom=0.0),
         Atom('Fe', (0.00000000,   0.00000000,   0.82749999), magmom=0.0),
         Atom('Mg', (0.50000000,   0.25000000,   0.88773809), magmom=0.0),
         Atom('O',  (0.00000000,   0.50000000,   0.88773809), magmom=0.0),
         Atom('O',  (0.00000000,   0.00000000,   0.88773809), magmom=0.0),
         Atom('O',  (0.50000000,   0.25000000,   0.94386905), magmom=0.0),
         Atom('Mg', (0.00000000,   0.50000000,   0.94386905), magmom=0.0),
         Atom('Mg', (0.00000000,   0.00000000,   0.94386905), magmom=0.0),
         Atom('Mg', (0.50000000,   0.25000000,   0.00000000), magmom=0.0),
         Atom('O',  (0.00000000,   0.00000000,   0.00000000), magmom=0.0)
         ],
     spacegroup=47, cellpar=[a, b, c, 90, 90, 90]
     )

also, a closing ']' was missing and there was a trailing space in the 
'O' for Oxygen.

Alexander

> from ase import *
> import numpy as np
> from ase.calculators.jacapo import *
> from ase.lattice.cubic import *
> from ase.visualize import view
> from ase.lattice.spacegroup import crystal
>
> bo = 0.529177
> a =  5.473690*bo
> b = 10.947380*bo
> c = 69.016108*bo
>
>
>
> tunnel =crystal([('Fe', (0.50000000, 0.25000000,   0.63040434),   
> magmom=0.0),
>                      ('Fe', (0.00000000, 0.50000000,   0.67009491),   
> magmom=0.0),
>                      ('Fe', (0.00000000, 0.00000000,   0.67009491),   
> magmom=0.0),
>                      ('Fe', (0.50000000, 0.25000000,   0.70978550),   
> magmom=0.0),
>                      ('Fe', (0.00000000, 0.50000000,   0.74947608),   
> magmom=0.0),
>                      ('Fe', (0.00000000, 0.00000000,   0.74947608),   
> magmom=0.0),
>                      ('Fe', (0.50000000, 0.25000000,   0.78916665),   
> magmom=0.0),
>                      ('Fe', (0.00000000, 0.50000000,   0.82749999),   
> magmom=0.0),
>                      ('Fe', (0.00000000, 0.00000000,   0.82749999),   
> magmom=0.0),
>                      ('Mg', (0.50000000, 0.25000000,   0.88773809),   
> magmom=0.0),
>                      ('O ', (0.00000000, 0.50000000,   0.88773809),   
> magmom=0.0),
>                      ('O ', (0.00000000, 0.00000000,   0.88773809),   
> magmom=0.0),
>                      ('O ', (0.50000000, 0.25000000,   0.94386905),   
> magmom=0.0),
>                      ('Mg', (0.00000000, 0.50000000,   0.94386905),   
> magmom=0.0),
>                      ('Mg', (0.00000000, 0.00000000,   0.94386905),   
> magmom=0.0),
>                      ('Mg', (0.50000000, 0.25000000,   0.00000000),   
> magmom=0.0),
>                      ('O ', (0.00000000, 0.00000000,   0.00000000),   
> magmom=0.0),
>                 spacegroup=47, cellpar=[a, b, c, 90, 90, 90])
> view(tunnel)
> ******************************************************************
>
>
>
>
>
> _______________________________________________
> 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/20120913/f4db99a6/attachment.html>


More information about the ase-users mailing list