XMLParameterIOHandler

class openff.toolkit.typing.engines.smirnoff.io.XMLParameterIOHandler[source]

Handles serialization/deserialization of SMIRNOFF ForceField objects from OFFXML format.

__init__()

Create a new ParameterIOHandler.

Methods

__init__()

Create a new ParameterIOHandler.

parse_file(source)

Parse a SMIRNOFF force field definition in XML format, read from a file.

parse_string(data)

Parse a SMIRNOFF force field definition in XML format.

to_file(file_path, smirnoff_data)

Write the current force field parameter set to a file.

to_string(smirnoff_data)

Write the current force field parameter set to an XML string.

parse_file(source)[source]

Parse a SMIRNOFF force field definition in XML format, read from a file.

Parameters:

source – File path of file-like object implementing a read() method specifying a SMIRNOFF force field definition in the SMIRNOFF XML format.

Raises:
parse_string(data: str) dict[source]

Parse a SMIRNOFF force field definition in XML format.

A SMIRNOFFParseError is raised if the XML cannot be processed.

Parameters:

data

A SMIRNOFF force field definition in the SMIRNOFF XML format.

to_file(file_path, smirnoff_data)[source]

Write the current force field parameter set to a file.

Parameters:
  • file_path – The path to the file to be written. The .offxml or .xml file extension must be present.

  • smirnoff_data – A dict structured in compliance with the SMIRNOFF data spec.

to_string(smirnoff_data: dict) str[source]

Write the current force field parameter set to an XML string.

Parameters:

smirnoff_data – A dictionary structured in compliance with the SMIRNOFF spec

Returns:

serialized_forcefield – XML String representation of this force field.