This file is indexed.

/usr/share/python-ase/doc/ase/io.rst is in python-ase-doc 3.9.1.4567-3.

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.. module:: ase.io
   :synopsis: File input-output module


File input and output
=====================

The :mod:`ase.io` module has two basic functions: :func:`read` and
:func:`write`. The two methods are described here:

.. autofunction:: read
.. autofunction:: write

The :func:`read` function is only designed to retrieve the atomic configuration
from a file, but for the CUBE format you can import the function:

.. function:: read_cube_data


which will return a ``(data, atoms)`` tuple::

  from ase.io.cube import read_cube_data
  data, atoms = read_cube_data('abc.cube')


Examples
========

::

    from ase.lattice.surface import *
    adsorbate = Atoms('CO')
    adsorbate[1].z = 1.1
    a = 3.61
    slab = fcc111('Cu', (2, 2, 3), a=a, vacuum=7.0)
    add_adsorbate(slab, adsorbate, 1.8, 'ontop')

Write PNG image::

    write('slab.png', slab * (3, 3, 1), rotation='10z,-80x')

.. image:: io1.png

Write POVRAY file::

    write('slab.pov', slab * (3, 3, 1), rotation='10z,-80x')

This will write both a ``slab.pov`` and a ``slab.ini`` file.  Convert
to PNG with the command ``povray slab.ini`` or use the
``run_povray=True`` option:

.. image:: io2.png

Here is an example using ``bbox``::

    d = a / 2**0.5
    write('slab.pov', slab * (2, 2, 1),
          bbox=(d, 0, 3 * d, d * 3**0.5))

.. image:: io3.png

Note that the XYZ-format does not contain information about the unic cell:

>>> write('slab.xyz', slab)
>>> a = read('slab.xyz')
>>> a.get_cell()
array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]])
>>> a.get_pbc()
array([False, False, False], dtype=bool)

Use ASE's native format for writing all information:

>>> write('slab.traj', slab)
>>> b = read('slab.traj')
>>> b.get_cell()
array([[  5.10531096e+00,  -4.11836034e-16,   1.99569088e-16],
       [  2.55265548e+00,   4.42132899e+00,   7.11236625e-17],
       [  8.11559027e+00,   4.68553823e+00,   1.32527034e+01]])
>>> b.get_pbc()
array([ True,  True,  True], dtype=bool)

A script showing all of the povray parameters, and generating the image below,
can be found here: :download:`save_pov.py`

.. image:: NaCl_C6H6.png

An other example showing how to change colors and textures in pov can
be found here: :download:`../tutorials/saving_graphics.py`.