Example #1
0
 def set_bfield(self,bfield):
     import bfield as bf
     if any(bfield != self.bfield):
         self.bfield = bfield
         self.H_int = [bf.calc_H_int(bfield,self.H_int_B0[n],self.xyz[n])
                       for n in range(len(self.H_int_B0))]
         self.H_hop = [bf.calc_H_hop(bfield,self.H_hop_B0[n],self.xyz[n],self.xyz[n+1])
                       for n in range(len(self.H_hop_B0))]
Example #2
0
 def set_bfield(self,bfield):
     import bfield as bf
     assert hasattr(self,'xyz')
     assert len(self.xyz.atoms) == self.N_orbitals
     if any(bfield != self.bfield):
         self.bfield = bfield
         if sum(array(self.bfield)**2) == 0:
             self.H = self.H_B0
         else:
             self.H = (
                 [ bf.calc_H_int(self.bfield,self.H_B0[0],self.xyz) ]
                 +
                 [ bf.calc_H_hop(self.bfield,self.H_B0[i],self.xyz,self.xyz_shifted[i-1]) for i in range(1,len(self.H_B0)) ]
             )
         if hasattr(self,'cache'):
             self.cache = {}
         (self._G_bulk,self._Gs_L,self._Gs_R) = (None,None,None)