implementing dipole