Skip to content

Commit

Permalink
[tet.py] Allow user to set hamiltonian term on the same positions mul…
Browse files Browse the repository at this point in the history
…tiple times.

It allows user to use `state.hamiltonians[positions]+=tensor`.
Previously, the program will throw error saying hamiltonian term has
already been set, but recently, some models need adding term on the
same positions.
  • Loading branch information
hzhangxyz committed Nov 19, 2023
1 parent fa70a7e commit 6490602
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
without read all configurations.
+ *tetragono*: Yield measurement result before save state and configuration in gradient descent of sampling lattice.
Since user may want to update attributes out of yield.
+ *tetragono*: Allow user to set hamiltonian term on the same positions multiple times, which allows user to use
=state.hamiltonians[positions]+=tensor=. Previously, the program will throw error saying hamiltonian term has already
been set, but recently, some models need adding term on the same positions.
*** Deprecated
*** Removed
+ *tetragono*: Remove ansatz product state support, which may be added again in the future, but it require many updates.
Expand Down
2 changes: 0 additions & 2 deletions tetragono/tetragono/abstract_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,6 @@ def _set_hamiltonian(self, points, tensor):
raise ValueError("Wrong hamiltonian edge")
if edge_out.conjugated() != edge_in:
raise ValueError("Wrong hamiltonian edge")
if points in self._hamiltonians:
raise RuntimeError("This hamiltonian term is already set")

if tensor.norm_max() != 0:
self._hamiltonians[points] = tensor
Expand Down

0 comments on commit 6490602

Please sign in to comment.