/usr/share/pyshared/ase/io/py.py is in python-ase 3.6.0.2515-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from ase.atoms import Atoms
def write_py(fileobj, images, **kwargs):
if isinstance(fileobj, str):
fileobj = open(fileobj, 'w')
fileobj.write('from ase import Atoms\n\n')
fileobj.write('import numpy as np\n\n')
if not isinstance(images, (list, tuple)):
images = [images]
fileobj.write('images = [\n')
for image in images:
fileobj.write(" Atoms(symbols='%s',\n"
" pbc=np.%s,\n"
" cell=np.array(\n %s,\n"
" positions=np.array(\n %s),\n" % (
image.get_chemical_symbols(reduce=True),
repr(image.pbc),
repr(image.cell)[6:],
repr(image.positions)[6:]))
fileobj.write(']')
|