TCM
UoC crest

Check2xsf and Python

Check2xsf has two output formats which are designed to facilitate interoperability with python. Both are inspired by the Atomic Simulation Environment for python (available for both python 2.x and 3.x), although one can also be used with other packages.

Dictionary format

The more flexible --py format produces output of the form:

structure = {'cell':[(2.730000,2.730000,0.000000),
                     (2.730000,0.000000,2.730000),
                     (0.000000,2.730000,2.730000)],
  'symbols':['Si','Si'],
  'scaled_positions':[
    (0.000000,0.000000,0.000000),
    (0.250000,0.250000,0.250000)],
  'pbc':True}

There are many ways that this could be used from python, but, assuming the above is stored in a file called Si2.py, then

>>> from ase import Atoms
>>> import Si2
>>> st=Atoms(**Si2.structure)
>>> print(st)

should work, as should the use of any module containing a datastructure similar to ASE's Atoms structure.

ASE format

The second format provided, --pya, is firmly tied to ASE, and produces output of the form:

from ase import Atoms
structure = Atoms(cell=[(2.730000,2.730000,0.000000),
                     (2.730000,0.000000,2.730000),
                     (0.000000,2.730000,2.730000)],
  symbols=['Si','Si'],
  scaled_positions=[
    (0.000000,0.000000,0.000000),
    (0.250000,0.250000,0.250000)],
  pbc=True)

Again assuming the above is stored in a file called Si2.py, this can be used as:

>>> from ase import Atoms
>>> import Si2
>>> print(Si2.structure)