Skip to content

Commit 4adf7d2

Browse files
committed
Updated usage of spin indices to carry both position and value
2 parents c033a15 + c074784 commit 4adf7d2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lips/particle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ def angles_for_squares(self):
332332
if self.l_sp_d is not None and self.r_sp_d is not None: # massive scalars do not have these defined
333333
self._l_sp_d, self._r_sp_d = self._r_sp_d.T, self._l_sp_d.T
334334
if hasattr(self, 'spin_index'):
335-
if self.spin_index == 'u':
335+
if self.spin_index[0] == 'u':
336336
self._l_sp_d *= -1
337-
elif self.spin_index == 'd':
337+
elif self.spin_index[0] == 'd':
338338
self._r_sp_d *= -1
339339
else:
340340
raise Exception("Spin index not understood.")

lips/particles.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def cluster(self, llIntegers, massive_fermions=None):
184184
selfClustered[leg]._r_sp_d = selfClustered[leg]._r_sp_d @ -LeviCivita # |bold leg> = |leg_I>
185185
else:
186186
raise Exception("Massive fermion spin index position must be either 'u' or 'd'.")
187-
selfClustered[leg].spin_index = index_position
187+
selfClustered[leg].spin_index = (index_position, index_value)
188188
if isinstance(index_value, int):
189189
selfClustered[leg]._r_sp_d = selfClustered[leg]._r_sp_d[:, index_value - 1:index_value]
190190
selfClustered[leg]._l_sp_d = selfClustered[leg]._l_sp_d[index_value - 1:index_value, :]
@@ -272,11 +272,11 @@ def subs(self, myDict):
272272
for mass in self.internal_masses:
273273
if isinstance(getattr(self, mass), (sympy.Add, sympy.Mul, sympy.Symbol)):
274274
setattr(self, mass, getattr(self, mass).subs(myDict))
275-
if isinstance(getattr(self, mass), sympy.Integer) and self.field.name == "finite field":
275+
if isinstance(getattr(self, mass), (sympy.Integer, ModP)) and self.field.name == "finite field":
276276
setattr(self, mass, ModP(getattr(self, mass), self.field.characteristic))
277-
elif isinstance(getattr(self, mass), sympy.Integer) and self.field.name == "padic":
277+
elif isinstance(getattr(self, mass), (sympy.Integer, PAdic)) and self.field.name == "padic":
278278
setattr(self, mass, PAdic(getattr(self, mass), self.field.characteristic, self.field.digits))
279-
else:
279+
elif not isinstance(getattr(self, mass), str):
280280
setattr(self, mass, sympy.poly(getattr(self, mass), modulus=self.field.characteristic ** self.field.digits).as_expr())
281281

282282
def fix_mom_cons(self, A=0, B=0, real_momenta=False, axis=1): # using real momenta changes both |⟩ and |] of A & B

0 commit comments

Comments
 (0)