finished code. generates e field from potential file