def read_orbfile_stream(cls, stream: TextIO): version, orbs, spin_orbs = _read_header(stream) if spin_orbs: raise FileFormat('File represents spin orbitals') coeff, occ, energy, idx = _read_spatial_orbs(stream, orbs, version) return cls(orbs, coeff, occ, energy, idx)
def read_orbfile(cls, path: PathLike): with open(path, 'r') as f: version, orbs, spin_orbs = _read_header(f) if not spin_orbs: raise FileFormat('File represents spatial orbitals.') coeff, occ, energy, idx = _read_spin_orbs(f, orbs, version) return cls(orbs, coeff, occ, energy, idx)