@classmethod<EOL><INDENT>def from_file(cls, filename):<DEDENT>
with open(filename) as f:<EOL><INDENT>molecule, origin, axes, nrep, subtitle, nuclear_charges =read_cube_header(f)<EOL>data = np.zeros(tuple(nrep), float)<EOL>tmp = data.ravel()<EOL>counter = <NUM_LIT:0><EOL>while True:<EOL><INDENT>line = f.readline()<EOL>if len(line) == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT>words = line.split()<EOL>for word in words:<EOL><INDENT>tmp[counter] = float(word)<EOL>counter += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>return cls(molecule, origin, axes, nrep, data, subtitle, nuclear_charges)<EOL>
Create a cube object by loading data from a file.

           *Arguemnts:*

           filename
                The file to load. It must contain the header with the
                description of the grid and the molecule.