subroutine eh c--calculate instantaneous E and H fields a moving charge j at position i c-------------------------------------------------------------------------- c include 'psizescom.h' c common/ehparm/xi,yi,zi,ex,ey,eez,hx,hy,hz,xj,yj,zj,gbxj,gbyj, . gbzj,gamma,qfac c-------------------------------------------------------------------------- c* c r = vector from j to i rx = xi - xj ry = yi - yj rz = zi - zj rxsq = rx**2 rysq = ry**2 rzsq = rz**2 rsq = rxsq + rysq + rzsq c skip if rsq = 0 if (rsq.lt.1.e-10) return c scalar product of gamma*beta(j) and r cosesq = (gbxj*rx + gbyj*ry + gbzj*rz)**2 c calculate field at i of moving charge j, assuming uniform velocity c at present value crsq = rsq + cosesq crsq = crsq*crsq*crsq qf = qfac c reduce the charge if superparticles are too close if (rxsq.lt.xsqsiz.and.rysq.lt.ysqsiz.and.rzsq.lt.zsqsiz) . qf = qf*sqrt(rxsq*rysq*rzsq)/xyzvol efac = qf/sqrt(crsq) exj = efac*rx eyj = efac*ry ezj = efac*rz ex = ex + exj*gamma ey = ey + eyj*gamma eez=eez + ezj*gamma hx = hx + gbyj*ezj - gbzj*eyj hy = hy + gbzj*exj - gbxj*ezj hz = hz + gbxj*eyj - gbyj*exj return end c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*