コード例 #1
0
ファイル: spatial_orbfile.py プロジェクト: graggi/OpenMolcas
 def reindex(self, new_idx: Sequence[Sequence[int]], inplace: bool = False):
     if inplace:
         self.coeff = [
             coeff[:, idx] for idx, coeff in zip(new_idx, self.coeff)
         ]
         self.energy = _reindex(self.energy, new_idx)
         self.idx = _reindex(self.idx, new_idx)
         self.occ = _reindex(self.occ, new_idx)
     else:
         new = self.copy()
         new.reindex(new_idx, inplace=True)
         return new
コード例 #2
0
 def reindex(self,
         new_idx: Sequence[Sequence[int]], inplace: bool=False):
     if inplace:
         self.coeff = {
             spin:
                 [coeff[:, idx] for idx, coeff in zip(new_idx, spin_values)]
             for spin, spin_values in self.coeff.items()}
         self.energy = _spin_reindex(self.energy, new_idx)
         self.idx = _reindex(self.idx, new_idx)
         self.occ = _spin_reindex(self.occ, new_idx)
     else:
         new = self.copy()
         new.reindex(new_idx, inplace=True)
         return new