cube module

cube.py

Read a cube file to an array for manipulation. Use the translational symmtry of a supercell to average a cube file into a smaller subsection, eg the unit cell. The number of grid points must be exactly divisible by the folding factors, FX FY FZ.

Modified version for faps, provides Cube object.

class cube.Cube(filename=None, fold=None, debug=False)[source]

Bases: object

Container for a .cube file. Very specific for folding symmetry.

error_name

File name with _folded inserted for output.

folded_name

File name with _folded inserted for output.

maxima(sigma=2.0, radius=0.31, cutoff=0.0, write=False)[source]

Smooth with gaussian blur then use the spacing to determine nearest neighbours to estimate positions of maxima. Return the cartesian positions of maxima in a tuple with their magnitudes from the smoothed data.

read_file(filename=None, fold=None, trim_atoms=True, crop_atoms=False)[source]

Read the gridded cubedata and fold

smoothed_name

File name with _smooth inserted for output.

write_cube(outname=None)[source]

Write out the data, already folded

write_generic(data, outname)[source]

Write data to a Gaussian ‘.cube’ file.

cube.compressed_open(filename)[source]

Return file objects for either compressed and uncompressed files

cube.extract_atoms(header_block, fold)[source]

Trim the atoms to just the first block. Assumes that subcell are in sequential blocks.

cube.in_cell(header_block, grid, cell)[source]

Cut any atoms that are not in the box from the header block