Skip to content

Commit

Permalink
add a fig leaf of documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland Wirth committed Nov 7, 2018
1 parent 8c90b93 commit 574ab87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions imsrg/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ def __iter__(self):
return iter(self.cf)

def max_coincidence(self, other):
'''
Compute the maximum-coincidence representation of this SD and the given one.
Returns a 4-tuple (common, d1, d2, phase) containing the common sp states,
the states that are unique to this and the other SD, and the relative swap phase.
'''
nparticles = len(self)
if nparticles != len(other):
raise ValueError('Configurations must have the same number of particles')
Expand Down Expand Up @@ -44,6 +49,8 @@ def max_coincidence(self, other):

class SDBasis:
def __init__(self, basis, nparticles):
'''Construct an SD basis adapted to the pairing Hamiltonian with only filled or empty levels.'''

from itertools import combinations

def levels_to_comb(lvls):
Expand Down
4 changes: 4 additions & 0 deletions imsrg/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ def comm(self, other):
o1o1_comm = np.dot(self.o1, other.o1) - np.dot(other.o1, self.o1)

c2 = np.zeros((self.basis.ntpstates,self.basis.ntpstates))

# Local function for fine-grained profiling
def _calc_c2():
nonlocal c2

Expand Down Expand Up @@ -268,6 +270,8 @@ def _calc_c2():

# c1 multi-ref terms not implemented.
c1 = o1o1_comm.copy()

# Local function for fine-grained profiling.
def _calc_c1():
nonlocal c1
for (I, (p,r)), (J, (q,t)) in product(enumerate(self.basis.tpb), repeat=2):
Expand Down

0 comments on commit 574ab87

Please sign in to comment.