Skip to content

Commit

Permalink
Update trotter.py
Browse files Browse the repository at this point in the history
1维海森堡哈密顿量构建,周期性边界的相互作用系数由1更改为interaction_strength[interaction_idx]
  • Loading branch information
imppresser authored Dec 8, 2021
1 parent 99dee56 commit 8bc4ab0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions paddle_quantum/trotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,14 @@ def get_1d_heisenberg_hamiltonian(
# add interactions on (0, n) for closed periodic boundary condition
if periodic_boundary_condition:
boundary_sites = [0, length - 1]
for interaction in interactions:
for interaction_idx in range(len(interactions)):
term_str = ''
interaction = interactions[interaction_idx]
for idx_word in range(len(interaction)):
term_str += interaction[idx_word] + str(boundary_sites[idx_word])
if idx_word != len(interaction) - 1:
term_str += ', '
pauli_str.append([1, term_str])
pauli_str.append([interaction_strength[interaction_idx], term_str])

# add magnetic field, if h_z is a single value, then add a uniform field on each site
if isinstance(h_z, np.ndarray) or isinstance(h_z, list) or isinstance(h_z, tuple):
Expand Down

0 comments on commit 8bc4ab0

Please sign in to comment.