未验证 提交 8bc4ab04 编写于 作者: qq_23215249's avatar qq_23215249 提交者: GitHub

Update trotter.py

1维海森堡哈密顿量构建,周期性边界的相互作用系数由1更改为interaction_strength[interaction_idx]
上级 99dee56a
......@@ -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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册