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.

  • 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 1-RDM.


Compute Mulliken charges.

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

Call load_one, catching expected FileFormatWarning.

  • 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.


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

Return type


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

Make a temporary truncated copy of a file.

  • 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.