# Tools for computing an electric field based on location of charges?

I have the positions of a large number of charges (the strengths are known, but are also variables). Are there any tools that will allow me to visualize the electric field induced by these charges (or by a subset of these charges)? Are there such tools that are connected to visualization routines, so that these can be converted into figures for presentations or articles?

• Are you in the presence of any conductors or dielectrics?
– Dan
Commented Apr 16, 2012 at 16:34
• Also, roughly how many charges are there?
– Dan
Commented Apr 16, 2012 at 16:35
• @Dan: Not really—this is for simulations based on molecular dynamics calculations, with no implicit solvent. The number of charges needs to be adaptable—anywhere from a few tens to a few thousands is possible here. Commented Apr 16, 2012 at 20:06
• Where are the FEM guys? @aeismail is asking for a solution to the 3D poisson equation of a set of point charges. Commented Apr 16, 2012 at 22:50

First, you need to get your molecules into PQR format. PQR is fairly straightforward and is whitespace delimited:

Field_name Atom_number Atom_name Residue_name Chain_ID Residue_number X Y Z Charge Radius


PQR is one line per atom. Field_name should always be ATOM. The next five fields all relate back to the residue naming scheme used by the older PDB format. If the only thing that you want to be able to do is to visualize the field, you can just use 0001 H DUM A 001 for those five fields for every atom, as long as you increment the Atom_number field by 1 on each line (0001, 0002, etc.). You'll want to pay special attention to the X Y Z fields, which are (obviously) the x y z coordinates of the atom, and to the Charge field, which (also obviously) is the partial charge of the atom. Since you have no implicit solvent, the Radius field is irrelevant and should probably be set to 0 for all atoms.

If you already have partial charges (I'm going to assume you already have coordinates), it should be straightforward to write a script that will create your PQR file. If you don't already have partial charges, or if your molecule happens to be in certain accepted formats (MOL2, PDB, or XML), you should probably figure out how to use the PDB2PQR tool in order to make your PQR file.

Install APBS and VMD, and then just follow the instructions here. One thing to note: since you have no implicit solvent, in step 3 of "Running the electrostatics calculation" you will need to set your solvent and solute dielectric constant equal to whatever dielectric constant you used in your MD simulation (if you don't know what it was, setting them both to 1 should be fine).

That should be it. If you have any questions, or if it doesn't work, please add some comments and I'll see what I can do to answer/fix it.

• Actually, it's not a protein—they're primarily small molecules, but multiple of them. Commented Apr 16, 2012 at 21:30
• @aeismail changed answer to a workflow that should be relevant to small molecules.
– tel
Commented Apr 16, 2012 at 23:51

If the number of charges isn't too large, hand-coding the formula for the potential and then taking the derivative symbolically with Sage or Mathematica should be easy enough.

If you have an enormous number of charges (several tens or more, in a file to long to convert to something by hand), you could read the charges and their positions into a python list, calculate the potential for each of them separately, and then add all the potentials together.

• To add to Dan's suggestion, it seems like Python + Mayavi might be a good open-source solution. This example of Mayavi + SciPy is particularly topical because it involves using Mayavi to plot a potential, forces associated with the gradient of the potential, and particle trajectories. Commented Apr 17, 2012 at 2:05