I have a PyMol session file I was using to create my figures. It contains a protein and ligand broken into several groups of atoms with a fair bit of overlap. There are also a few meshes built from a density map for a few figures.

Unfortunately, I wasn't quite done with refinement, and now Refmac has given me shiny new PDB and MTZ files with subtly different coordinates and terms. Is there a way to "update" my coordinates (despite the myriad groups, all the atoms still have the same name) with the new PDB? With all the groups I made that are shown/hidden/colored differently for several scenes to produce all the figures, I'd rather not recreate it all manually.

I'm more pessimistic about the map/mesh, but I created them via a script so I can repeat that. Should I also script the coordinate to figure stuff in the future if it's not finalized?

  • 9
    $\begingroup$ As a generale rule, I'd script as much as possible. If you don't do it, it will come back eventually and bite you in the... somewhere. I also think that this is more of a question for the official support channels provided by PyMol. $\endgroup$
    – tschoppi
    Commented Oct 13, 2014 at 14:33
  • 1
    $\begingroup$ Is your atomic structure coordinates from xray or NMR? GROMACS has a universal file format that can be read into many including pymol and VMD. I haven't used pymol but VMD at a basic level. Wouldn't SO a better place to post this q? $\endgroup$
    – bonCodigo
    Commented Jul 27, 2017 at 9:02
  • $\begingroup$ @bonCodigo x-ray. While there's some coding/scripting involved, this is more about usage of PyMol rather than a coding challenge, so it would probably get closed on SO. I'm a bit confused behind the (very high?) vote-to-view ratio (nearly 1 vote per 16 views), so it's not like there are a ton of people on the interwebgoogles that have this problem, but maybe a few really want an answer? Probably should be made into an issue for PyMol... $\endgroup$
    – Nick T
    Commented Nov 6, 2017 at 20:48
  • $\begingroup$ @NickT wow! X-ray crystallography! A lot of time, coders/scientists/students like to scoop a solution from someone else's resolutions. Due to time, due to the rush etc. So it looks like a lot in need for a solution - waiting for you to post it to PyMOL. Heard their response time isn't too bad. Just a speculation about votes: some who viewed possibly do not have a SE account, so can't vote and lazy to create one... And each time you view your own question with even 1 hr lap - I noticed the view count does update...(unique IP hmm..). 33 votes means to me, people are in need. $\endgroup$
    – bonCodigo
    Commented Nov 16, 2017 at 22:52
  • 1
    $\begingroup$ NickT and @bonCodigo, such questions are normally considered off topic on Chemistry SE because it's not about Chemistry but the software or coding itself, see the tour page. However a new Matter Modeling SE has recently launched where it is the focus to answer such computational chemistry software questions. $\endgroup$
    – Cody Aldaz
    Commented Jul 3, 2020 at 16:08

1 Answer 1


Until someone identifies an ‘update’ function in PyMol, I think the next best thing is to use scripting. (See the pymol wiki) It is an imperfect solution, but it may work for the situation presented in the original post if the session may be reproduced.

To begin capturing the commands in PyMol, including menu selections to a script file, select:

File -> Log File -> Open -> myscript.pml

When done with creating the display panels, select:

File -> Log File -> Close

The input data files and the script itself may then be updated or replaced. In a fresh PyMol session, execute the script with:

File -> Run Script -> myscript.pml

To test the above, I generated a PyMol session where I captured a script as above. I loaded the atomic coordinates of a small protein, a ligand and a 2mFobs-DFcalc electron density map. Then I displayed some panels along with mesh surface around the compound. The co-structure was then re-refined, thus generating modified atomic coordinates and electron density maps. I replaced the original files with the updates and executed the script in a fresh PyMol session. The display panels were updated accordingly.

I recommend the Advanced Scripting Workshop.


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