Skip to content

Commit

Permalink
Merge b0fe63e into b170c4d
Browse files Browse the repository at this point in the history
  • Loading branch information
chenpeizhi committed Nov 13, 2019
2 parents b170c4d + b0fe63e commit 857bbd3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drudge/fock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ class BogoliubovDrudge(GenMBDrudge):
.. math::
\beta^\dagger_k = \sum_l u_{lk} c^\dagger_l v_{lk} c_l
\beta^\dagger_k = \sum_l u_{lk} c^\dagger_l + v_{lk} c_l
Then the Hamiltonian is going to be rewritten with matrix elements formatted
according to the given format. During the rewritten, the new matrix
Expand Down
2 changes: 1 addition & 1 deletion drudge/genquad.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def _swap_lattice_gens(vec1: Vec, vec2: Vec, bcast_swap_info):
comm_factor = -1 / phase
phase = 1 / phase
elif assume_comm:
comm = _NOUGHT
comm = parse_terms(_NOUGHT)
phase = _UNITY
comm_factor = _UNITY
else:
Expand Down
26 changes: 26 additions & 0 deletions tests/genquad_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Tests for the general quadratic algebra drudge"""

import pytest
from sympy import Integer
from drudge import Vec, GenQuadLatticeDrudge


def test_assume_comm(spark_ctx):
"""
Test the case where vectors are assumed to commute if there commutator
is not specified.
"""

v1 = Vec(r'v_1')
v2 = Vec(r'v_2')

dr = GenQuadLatticeDrudge(spark_ctx, order=(v1, v2), comms={},
assume_comm=True)
tensor = dr.sum(v1 | v2)

assert tensor.simplify() == Integer(0)





0 comments on commit 857bbd3

Please sign in to comment.