Electromechanical simulations of dislocations