iodata.formats.wfn module

Gaussian/GAMESS-US WFN file format.

Only use this format if the program that generated it does not offer any alternatives that HORTON can load. The WFN format has the disadvantage that it cannot represent contractions and therefore expands all orbitals into a decontracted basis. This makes the post-processing less efficient compared to formats that do support contractions of Gaussian functions.

build_obasis(icenters, type_assignments, exponents, lit)[source]

Construct a basis set using the arrays read from a WFN or WFX file.

Parameters:
  • icenters (ndarray[Any, dtype[int]]) – The center indices for all basis functions. shape=(nbasis,). Lowest index is zero.

  • type_assignments (ndarray[Any, dtype[int]]) – Integer codes for basis function names. shape=(nbasis,). Lowest index is zero.

  • exponents (ndarray[Any, dtype[float]]) – The Gaussian exponents of all basis functions. shape=(nbasis,)

Return type:

tuple[MolecularBasis, ndarray[Any, dtype[int]]]

dump_one(f, data)[source]

Dump a single frame into a WFN file.

Parameters:
  • f (TextIO) – A writeable file object.

  • data (IOData) – An IOData instance which must have the following attributes initialized: atcoords, atnums, mo, obasis. If the following attributes are present, they are also dumped into the file: energy, title, extra.

Return type:

None

Notes

get_mocoeff_scales(obasis)[source]

Get the L2-normalization of the un-normalized Cartesian basis functions.

Parameters:

obasis (MolecularBasis) – The molecular orbital basis.

Return type:

ndarray[Any, dtype[float]]

Returns:

Scaling factors to be multiplied into the molecular orbital coefficients.

load_one(lit)[source]

Load a single frame from a WFN file.

Parameters:

lit (LineIterator) – The line iterator to read the data from.

Return type:

dict

Returns:

result (dict) – A dictionary with IOData attributes. The following attributes are guaranteed to be loaded: atcoords, atnums, energy, mo, obasis, title, extra.

load_wfn_low(lit)[source]

Load data from a WFN file into arrays.

Parameters:

lit (LineIterator) – The line iterator to read the data from.

Return type:

tuple

prepare_dump(data, allow_changes, filename)[source]

Check the compatibility of the IOData object with the WFN format.

Parameters:
  • data (IOData) – The IOData instance to be checked.

  • allow_changes (bool) – Whether conversion of the IOData object to a compatible form is allowed or not.

  • filename (str) – The file to be written to, only used for error messages.

Return type:

IOData

Returns:

data – The given IOData object or a shallow copy with some new attributes.

Raises: