Normally protein coordinates are generated from electron density, such as that from X-ray scattering experiment. In my case, I want the reverse - PDB to electron density mesh. I thought it was more trivial and a program should be available. But Google did not give me any luck.

Is there any existing python library/program which converts protein coordinate (pdb) into electron density mesh (custom resolution)? If not, how should one proceed? The orbital and atomistic electron density varies among atom types.

Your suggestion appreciated.


The precision of electron density I am interested in is ~ 1-2A so hopefully DFT level might not be necessary in my case. The aim is to visually resolve sidechain atoms. Since there could be manipulation of the PDB upstream, some crystal structure information could be lost.

Indeed the raw electron density might provide such information but a unified treatment of PDB coordinate homogenizes structures, making a more fair comparison between them, specifically in my case.

  • $\begingroup$ If the electron density is derived from the coordinates only, using the independent atom approach, then the coordinates and the density carry equivalent information. It would be interesting to know whether you are comparing the calculated electron density to experimental data (such as derived from cryo-EM), are using this for teaching, or for some other purpose. Just to be clear, you could not use it for something like determination of partial charges or such. $\endgroup$
    – Karsten
    Commented Mar 19, 2020 at 17:12
  • $\begingroup$ I am using this to compare with X-ray crystallography experiment. Indeed with an independent atom approach, the partial charge cannot be deduced unless atomistic forcefield is used, like AMBER and CHARMM. $\endgroup$
    – Simon
    Commented Mar 20, 2020 at 23:21
  • $\begingroup$ phenix-online.org/pipermail/phenixbb/2020-March/024559.html --> Generating electron density from protein coordinate (PDB) $\endgroup$
    – pippo1980
    Commented Aug 13, 2022 at 13:31

2 Answers 2


For the more recent structures, you can view the density (based on measured diffraction data and the model, so-called 2Fo-Fc density) directly in the protein data bank, e.g. http://www.rcsb.org/3d-view/6QU9?preset=electronDensityMaps:

enter image description here

For a theoretical model or a model without deposited diffraction data, you would first have to generate structure factors, and then calculate the electron density. In the simplest case, the electron density would just reflect the density of isolated atoms (i.e. no deformation density). Program suites such as CCP4 (originally in Fortran) or Phenix (in python) are available to do these steps.

In these calculations, the electron density of individual atoms is encoded in so-called atomic form factors (see e.g. http://lampx.tugraz.at/~hadley/ss1/crystaldiffraction/atomicformfactors/formfactors.php), which are fourier transform coefficients of the model electron density for each atom.

  • $\begingroup$ Thank you Karsten. I am exploring Phenix and fmodel generates structure factor from pdb. However, I fail to find a way to turn structure factor into electron density. Although I can take its square norm of its fourier transform as electron density, my result will be off by some normalization constant. Do you happen to know the exact command/function? $\endgroup$
    – Simon
    Commented Mar 18, 2020 at 23:46
  • $\begingroup$ @Simon I don't know Phenix, but it might be phenix.maps: phenix-online.org/pipermail/phenixbb/2010-February/014521.html. You would calculate an Fc map (something like 0 Fo + 1 Fc). $\endgroup$
    – Karsten
    Commented Mar 19, 2020 at 0:42

What you've described is the field of electronic structure theory. To obtain the electronic density from the cartesian coordinates of the atoms requires immense amount of computation (assuming you have a protein in your pdb file). If you have a small molecule, you could use any number of common electronic structure packages. ORCA is open-source (assuming academic), or you could check if you have access to Gaussian (another widely used one) through a university.

EDIT: Having re-read your question, I see it is indeed a protein you are trying to get the electronic density of. In this case, you will not be able to use even the most basic electronic structure methods on the entire protein. If you need the electron density of a small section (<100-500 atoms, with 500 atoms already heavily straining most computational setups) of the protein (say an active site), then you could do it. (Worth noting that you could go beyond 500 atoms with some advanced computational setups, see the paper Ian Bush mentioned in the comments).

However, if you just need an approximate charge distribution, you can assign point charges located at the center of each atom (water can be modeled in that way or with more complicated methods with the TIP models, where TIP3P is the simple "point charge on each atom" approach). The tleap command in Ambertools will do that for you. You could also use VMD's built-in support of CHARMM to add point charges centered on each atom. This is the psfgen plugin for VMD.

  • 1
    $\begingroup$ You seem to be overlooking the context here. Computing (good enough) electron density from coordinate data is routine practice in the field of crystallography, from which most PDB data is drawn. Yes, there is a non-trivial computation involved (a symmetry-accommodating Fourier transform of a weighted sum of atomic scattering factors) that scales with the size of the problem, but "requires an immense amount of computation" just isn't a good characterization of the kind of calculation the OP seems actually to want to perform. $\endgroup$ Commented Mar 18, 2020 at 14:58
  • 2
    $\begingroup$ I guess it depends on how "respectable" you want to be, and to whom. Crystallographers know that the independent-atom model on which most crystallographic computations is based is an approximation, but it turns out to be quite a good enough one for the purpose, which is primarily to model the (three-dimensionally symmetric and periodic) atomic arrangements that give rise to specific diffraction patterns. Electron density is involved as the physical property that gives rise to (x-ray or electron) diffraction in the first place. This is the subject area of the question. $\endgroup$ Commented Mar 18, 2020 at 16:01
  • 2
    $\begingroup$ As for links, Wikipedia's overview article isn't too bad, but it doesn't go into diffraction theory to any significant degree. Most web sites don't, other than to make substantially the same assertions I have already done, as it isn't really a subject for general audiences. You would probably need to turn to the literature, which is extensive, or to crystallography reference works, such as the International Tables for Crystallography, for a discussion of details. $\endgroup$ Commented Mar 18, 2020 at 16:18
  • 2
    $\begingroup$ @jezzo Gicen a capable enough code and a suitably powerful computer you can do somewhat more than 500 atoms, especially for open systems. As an example from my own work pubs.acs.org/doi/10.1021/acs.jpcc.9b06533 , which does full structural optimisations at the B3LYP level on periodic systems with 2788 atoms pr unit cell. $\endgroup$
    – Ian Bush
    Commented Mar 18, 2020 at 16:57
  • 2
    $\begingroup$ @jezzo for your suggestion. I have just updated my inquiry to specify my interest. $\endgroup$
    – Simon
    Commented Mar 19, 2020 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.