iodata.test.common module

Utilities for unit tests.

check_orthonormal(mo_coeffs, ao_overlap, atol=1e-05)[source]

Check that molecular orbitals are orthogonal and normalized.

Parameters
  • mo_coeffs (np.ndarray, shape=(nbasis, mo_count)) – Molecular orbital coefficients.

  • ao_overlap (np.ndarray, shape=(nbasis, nbasis)) – Atomic orbital overlap matrix.

  • atol (float) – Absolute tolerance in deviation from identity matrix.

compare_mols(mol1, mol2, atol=1e-08, rtol=0.0)[source]

Compare two IOData objects.

compute_1rdm(iodata)[source]

Compute 1-RDM.

compute_mulliken_charges(iodata)[source]

Compute Mulliken charges.

load_one_warning(filename, fmt=None, match=None, **kwargs)[source]

Call load_one, catching expected FileFormatWarning.

Parameters
  • filename (str) – The file in the unit test data directory to load.

  • fmt (Optional[str]) – The name of the file format module to use. When not given, it is guessed from the filename.

  • match (Optional[str]) – When given, loading the file is expected to raise a warning whose message string contains match.

  • **kwargs – Keyword arguments are passed on to the format-specific load_one function.

Returns

The instance of IOData with data loaded from the input files.

Return type

out

truncated_file(fn_orig, nline, nadd, tmpdir)[source]

Make a temporary truncated copy of a file.

Parameters
  • fn_orig (str) – The file to be truncated.

  • nline (int) – The number of lines to retain.

  • nadd (int) – The number of empty lines to add.

  • tmpdir (str) – A temporary directory where the truncated file is stored.