Tools

class tools.Grid(i, j)[source]

Supporting class for the plot_atoms function.

put(c, i, j, depth=1000000000.0)[source]
tools.ascii_atoms(atoms)[source]

Blatantly stolen from GPAW. Ascii-art plot of the atoms.

tools.compare_atoms(atoms1, atoms2, atol=1e-08, pbc=False)[source]

Check for system changes since last calculation.

tools.find_file(name, first=True, follow_symlinks=False, name_type='f')[source]

Locate name using call to bash find.

tools.find_runs(parent_dir)[source]
tools.getstatusoutput(*args, **kwargs)[source]

Helper function to replace the old commands.getstatusoutput.

Returns the returncode, stdout and sterr associated with the command.

getstatusoutput([command], stdin=subprocess.PIPE)

tools.handler(signum, frame)[source]

Signal handler for timed find_file.

tools.is_equal(a, b)[source]
tools.read_batchconf()[source]
tools.read_configuration(fname)[source]
tools.read_db(directory)[source]

Read the persistent data from a storq.db

Parameters:directory (str) – Path (relative or absolute) to the calculation directory.
Returns:data – Dictionary containing all the persistent data from storq.db
Return type:dict
tools.read_siteconf()[source]
tools.tail(fname)[source]

Quick way to read the last line of a file.

tools.timed_find_file(name, first=True, follow_symlinks=False, name_type='f')[source]

Timed version of find.

tools.timeit()[source]

Context manager for timing a piece of code.

tools.uniquify(seq)[source]

Make a sequence unique whilst preserving order.

tools.write_configuration(fname, config)[source]