예제 #1
0
파일: operator.py 프로젝트: wettig/gpt
 def apply_dirdisp_operator(self, opcode, o, i, direction, disp):
     assert len(i.v_obj) == len(o.v_obj)
     assert len(i.v_obj) == (len(self.obj))**0.5
     if len(i.v_obj) == 1:
         cgpt.apply_fermion_operator_dirdisp(
             self.obj[0],
             opcode,
             i.v_obj[0],
             o.v_obj[0],
             direction,
             disp,
         )
     else:
         tmp = self.tmp  # dirdisp is on full grid by definition
         for n in range(len(i.v_obj)):
             for m in range(len(i.v_obj)):
                 cgpt.apply_fermion_operator_dirdisp(
                     self.obj[n * len(i.v_obj) + m],
                     opcode,
                     i.v_obj[n],
                     o.v_obj[m] if n == 0 else tmp.v_obj[m],
                     direction,
                     disp,
                 )
             if n != 0:
                 o += tmp
예제 #2
0
파일: operator.py 프로젝트: wettig/gpt
 def apply_dirdisp_operator(self, opcode, o, i, dir, disp):
     assert len(i.v_obj) == 1
     assert len(o.v_obj) == 1
     # Grid has different calling conventions which we adopt in cgpt:
     return cgpt.apply_fermion_operator_dirdisp(self.obj, opcode,
                                                i.v_obj[0], o.v_obj[0], dir,
                                                disp)
예제 #3
0
 def apply_dirdisp_operator(self, opcode, o, i, direction, disp):
     assert len(i.v_obj) == len(o.v_obj)
     assert len(i.v_obj) == (len(self.obj)) ** 0.5
     tmp = gpt.lattice(o)
     o[:] = 0.0
     for m in range(len(i.v_obj)):
         tmp[:] = 0.0
         for n in range(len(i.v_obj)):
             cgpt.apply_fermion_operator_dirdisp(
                 self.obj[n * len(i.v_obj) + m],
                 opcode,
                 i.v_obj[n],
                 tmp.v_obj[m],
                 direction,
                 disp,
             )
             o += tmp