Skip to content

Commit

Permalink
Merge pull request #106 from zhcui/master
Browse files Browse the repository at this point in the history
change the dimension of dm in use_general_spin
  • Loading branch information
hczhai committed Dec 16, 2021
2 parents 883b060 + 587b3ee commit 4e19a32
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pyblock2/driver/block2main
Original file line number Diff line number Diff line change
Expand Up @@ -1919,10 +1919,16 @@ if not pre_run:
dmr.deallocate()
dm = dm.reshape((dm.shape[0] // 2, 2, dm.shape[1] // 2, 2))
dm = np.transpose(dm, (0, 2, 1, 3))
dm = np.concatenate(
[dm[None, :, :, 0, 0], dm[None, :, :, 1, 1]], axis=0)
if "use_general_spin" in dic:
dm = dm[None]
else:
dm = np.concatenate(
[dm[None, :, :, 0, 0], dm[None, :, :, 1, 1]], axis=0)
if orb_idx is not None:
rev_idx = np.argsort(orb_idx)
if "trans_integral_to_spin_orbital" in dic:
rev_idx = np.array(list(zip(rev_idx*2, rev_idx*2+1))).ravel()
assert dm.shape[-1] == len(rev_idx)
dm[:, :, :] = dm[:, rev_idx, :][:, :, rev_idx]
return dm
else:
Expand Down

0 comments on commit 4e19a32

Please sign in to comment.