[ase-users] spacegroup, primitive cell

Jesper Friis jesper.friis at sintef.no
Thu Jan 20 20:52:35 CET 2011

Hi Georg,
below is an example of a function that returns what you are looking for:

def primitive_from_conventional_cell(atoms, spacegroup=1, setting=1):
    """Returns primitive cell given an Atoms object for a conventional
    cell and it's spacegroup."""
    from ase.lattice.spacegroup import Spacegroup
    from ase.utils.geometry  import cut
    sg = Spacegroup(spacegroup, setting)
    prim_cell = sg.scaled_primitive_cell  # Check if we need to transpose
    return cut(atoms, a=prim_cell[0], b=prim_cell[1], c=prim_cell[2])

# Simple test
import ase
from ase.lattice.spacegroup import crystal

# fcc
al = crystal('Al', [(0, 0, 0)], spacegroup=225, cellpar=4.05)
al_prim = primitive_from_conventional_cell(al, 225)

# bcc
fe = crystal('Fe', [(0,0,0)], spacegroup=229, cellpar=2.87)
fe_prim = primitive_from_conventional_cell(fe, 229)

This seems to work fine for cubic structures. If you could verify that the above also works for arbitrary non-cubic systems it would be great. Maybe we could consider to add an option "primitive_cell=false" to ase.lattice.spacegroup.crystal() function? I think that could be useful.

Best regards

From: ase-users-bounces at listserv.fysik.dtu.dk [ase-users-bounces at listserv.fysik.dtu.dk] On Behalf Of Georg Madsen [georg.madsen at rub.de]
Sent: Thursday, January 20, 2011 2:06 PM
To: ase-users at listserv.fysik.dtu.dk
Subject: [ase-users] spacegroup, primitive cell

In all examples using the spacegroup package, the conventional cell is
returned. Usually you would want to do calculations on the primitive
cell. Is there a way to get spacegroup to return this ?

 Best wishes


ase-users mailing list
ase-users at listserv.fysik.dtu.dk

More information about the ase-users mailing list