OTF Parser

class flare.otf_parser.OtfAnalysis(filename, calculate_energy=False)

Parse the OTF log file to get trajectory, training data, thermostat, and build GP model.

Parameters:
  • filename (str) – name of the OTF log file.
  • calculate_energy (bool) – if the potential energy is computed and needs to be parsed, then set to True. Default False.
make_gp(cell=None, call_no=None, hyps=None, init_gp=None, hyp_no=None, **kwargs)

Build GP model from the training frames parsed from the log file. The cell, hyps and gp can be reset with customized values.

Parameters:
  • cell (np.ndarray) – Default None to use the cell from the log file. A customized cell can be input as a 3x3 numpy array.
  • call_no (int) – Default None to use all the DFT frames as training data for building GP. If not None, then the frames 0 to call_no will be added to GP.
  • hyps (np.ndarray) – Default None to use the hyperparameters from the log file. Customized hyps can be input as an array.
  • init_gp (GaussianProcess) – Default to None to use no initial settings or training data. an initial GP can be used, and then the frames parsed in the log file will add to the initial GP. Then the final GP uses the hyps and kernels of init_gp, and consists of training data from init_gp and the data from the log file. NOTE: if a log file from restarted OTF is parsed, then an initial GP needs to be parsed from the prior log file as the init_gp of the restarted log file.
  • hyp_no (int) – Default None to use the final optimized hyperparameters to build GP. If not None, then use the hyps from the `hyp_no`th optimization step.
  • kwargs – if a new GP setting is needed without inputing init_gp, the GP initial args can be input as kwargs.
output_md_structures()

Returns structure objects corresponding to the MD frames of an OTF run. :return:

parse_pos_otf(blocks)

Exclusively parses MD run information :param filename: :return:

to_xyz(xyz_file)

Convert OTF trajectory from log file to .xyz file. :Parameters: xyz_file (str) – the file name of the .xyz file to output

Returns:A list of ASE Atoms objects.
flare.otf_parser.append_atom_lists(species_list: List[str], position_list: List[<sphinx.ext.autodoc.importer._MockObject object at 0x7f53be91ee50>], force_list: List[<sphinx.ext.autodoc.importer._MockObject object at 0x7f53bec91ed0>], uncertainty_list: List[<sphinx.ext.autodoc.importer._MockObject object at 0x7f53be042150>], velocity_list: List[<sphinx.ext.autodoc.importer._MockObject object at 0x7f53be042f50>], lines: List[str], index: int, noa: int, dft_call: bool, noh: int) → None

Update lists containing atom information at each snapshot.

flare.otf_parser.extract_gp_info(block, mae_list, maf_list, atoms_list, hyps_list, noh)

Exclusively parses DFT run information :param filename: :return:

flare.otf_parser.parse_frame_line(frame_line)

parse a line in otf output. :param frame_line: frame line to be parsed :type frame_line: string :return: species, position, force, uncertainty, and velocity of atom :rtype: list, np.arrays

flare.otf_parser.parse_header_information(lines) → dict

Get information about the run from the header of the file :param outfile: :return:

flare.otf_parser.parse_snapshot(lines, index, noa, dft_call, noh)

Parses snapshot of otf output file.

flare.otf_parser.strip_and_split(line)

Helper function which saves a few lines of code elsewhere :param line: :return: