If I have a CIF that is P1, is there a (preferably free) code that can map the structure to some user-specified space group? I know that there are ways to do similar things with molecular systems. For instance, ChemCraft has an option to detect the nearest point group and then apply it to the molecule. I'd like to do the same for a crystalline structure given a space group.

  • $\begingroup$ Do you mean, identifying underlying symmetry of the crystal? $\endgroup$
    – Thomas
    Commented May 2, 2020 at 2:17
  • 1
    $\begingroup$ I primarily mean updating the atomic positions to fit a given space group. While it'd be nice if the code can detect the closest symmetry, that is not a requirement. For instance, let's say you have a DFT-optimized structure. It'll probably have no symmetry unless the tolerances to detect the symmetry are somewhat loose. Are there codes that could map the structure to match a given symmetry? $\endgroup$ Commented May 2, 2020 at 2:21
  • 1
    $\begingroup$ As an aside, I know this can be done in Materials Studio, but that's paid software. For context to my question, my machine with Materials Studio is in lab, which I can't access because of the global pandemic, so I'm looking for an alternative... $\endgroup$ Commented May 2, 2020 at 2:24

3 Answers 3


While there are undoubtedly other programs that do this, it's fairly easy to do in Avogadro.

  • I start with a calculation on hexagonal SiC. As mentioned, it starts as $P_1$:

triclinic setting of a non-ideal SiC unit cell

  • Go to Crystallography -> Space Group -> Perceive Space Group

Avogadro menu item for Perceive Space Group...

  • The unit cell should update, including symmetrization if needed

enter image description here

  • 1
    $\begingroup$ Beautiful, thank you! I admit... I am feeling quite silly that I didn't realize this! I'll keep the question unanswered for now so others feel inclined to comment too. $\endgroup$ Commented May 2, 2020 at 4:05
  • 2
    $\begingroup$ It's a fairly common task - I don't know other materials builders well, but I suspect others can do this. $\endgroup$ Commented May 2, 2020 at 4:11
  • 1
    $\begingroup$ Since I was curious, just for completeness: like ASE below, avogadro actually also uses spglib to achieve this, specifically spg_get_dataset $\endgroup$ Commented Jul 5, 2021 at 22:58

This can be done using PyMOL (which, while not free for general use, does have a free student license) via the set_symmetry argument, as documented here. This allows for a user-specified spacegroup and will update the CIF to match.

  • 1
    $\begingroup$ PyMOL also has Open Source version, which is free for all users and has set_symmetry. $\endgroup$
    – marcin
    Commented May 5, 2020 at 17:03

This is possible via ASE as well. There are modules which can handle space groups via spglib. I will focus on an application that hasn't been discussed yet.

ASE has an advantage that you can enforce symmetry during an optimization of cell size / positions. Here is an example that can be run with GPAW which will load a geometry (POSCAR) and optimize the cell size and shape while keeping the original symmetry.

from ase.io import read
from ase.optimize.bfgs import BFGS
from ase.constraints import UnitCellFilter
from ase.spacegroup.symmetrize import FixSymmetry
from gpaw import GPAW, PW

atoms = read("POSCAR")

si.calc = GPAW(xc='PBE',
               mode=PW(400, dedecut='estimate'),
               kpts=(4, 4, 4),

uf = UnitCellFilter(si)
relax = BFGS(uf)

The full trajectory will be contained in stress.txt. Other calculators that ASE supports can be used by simply changing the GPAW based lines to another calculator. It will need to implement a stress tensor though, so this restricts use somewhat. For example, GPAW does not support stress tensor calculations in FD or LCAO modes currently.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .