exatomic.interfaces.cube module

Cube File Support

Cube files contain an atomic geometry and scalar field values corresponding to a physical quantity.

class exatomic.interfaces.cube.Meta(name, bases, clsdict)[source]

Bases: TypedMeta

atom

alias of Atom

frame

alias of Frame

field

alias of AtomicField

class exatomic.interfaces.cube.Cube(*args, **kwargs)[source]

Bases: Editor

An editor for handling cube files. Assumes scalar field values are arranged with the x axis as the outer loop and the z axis as the inner loop.

cube = Cube('my.cube')
cube.atom                # Displays the atom dataframe
cube.field               # Displays the field dataframe
cube.field.field_values  # Displays the list of field values
uni = cube.to_universe() # Converts the cube file editor to a universe
UniverseWidget(uni)      # Renders the cube file

Warning

Be sure your cube is in atomic units.

parse_atom()[source]

Parse the Atom object from the cube file in place.

parse_field()[source]

Parse the scalar field into an AtomicField.

Note

The AtomicField tracks both the field parameters (i.e. information about the discretization and shape of the field’s spatial points) as well as the field values (at each of those points in space). See make_fps() for more details.

classmethod from_universe(uni, idx, name=None, frame=None)[source]

Make a cube file format Editor from a given field in a Universe.

Parameters:
property atom
property field
property frame
exatomic.interfaces.cube.uni_from_cubes(adir, verbose=False, ncubes=None, ext='cube')[source]

Put a bunch of cubes into a universe.

uni = uni_from_cubes('/path/to/files/')       # Parse all cubes matching 'files/*cube'
uni = uni_from_cubes('files/', ext='cub')     # Parse all cubes matching 'files/*cub'
uni = uni_from_cubes('files/', verbose=True)  # Print file names when parsing
uni = uni_from_cubes('files/', ncubes=5)      # Only parse the first 5 cubes
                                              # sorted lexicographically by file name
Parameters:
  • verbose (bool) – print file names when reading cubes

  • ncubes (int) – get only the first ncubes

  • ext (str) – file extension of cube files

Returns:

uni (exatomic.core.universe.Universe)