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

create_generalized_contraction()[source]

Create a dummy IOData object with generalized contractions in the basis.

Return type:

IOData

create_generalized_orbitals()[source]

Create a dummy IOData object with generalized molecular orbitals.

Return type:

IOData

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

Call load_one, catching expected LoadWarning.

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.

Return type:

IOData

Returns:

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

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.