<p>You can use <a href="https://www.cgl.ucsf.edu/chimera/" rel="nofollow noreferrer">Chimera</a> for this. The following code cleans your pdb file and write new pdb file.</p>
<pre><code>import chimera
from DockPrep import prep
from chimera import runCommand, openModels

models = chimera.openModels.list(modelTypes=[chimera.Molecule])
prep(models)
runCommand(&quot;write format pdb 0 molecule.pdb&quot;)
</code></pre>
<p>You can run the code with</p>
<pre><code> chimera --nogui file.pdb code.py
</code></pre>

CC BY-SA 4.0
2022-11-27T20:54:42.077Z
how do I get chimera ?  pip install pychimera https://pypi.org/project/pychimera/ ??? is there a python3 version ?
pippo1980
CC BY-SA 4.0
2022-11-27T21:14:17.090Z
https://www.cgl.ucsf.edu/chimera/download.html
SuleymanSelim
CC BY-SA 4.0
2022-11-27T22:20:20.230Z
https://pychimera.readthedocs.io/en/latest/ --> Use UCSF Chimera packages in any Python 2.7 interpreter
pippo1980
CC BY-SA 4.0
2022-11-13T00:28:09.900Z
2022-11-13T00:28:09.900Z
SuleymanSelim
<p>I have 3884 PDB files generated by <a href="http://www.sbg.bio.ic.ac.uk/%7Ephyre2/PD2_ca2main/" rel="nofollow noreferrer">pd2_ca2main</a>. PD2 CA2main is server for reconstructing the backbone of Calpha proteins using Gaussian mixture models.</p>
<p>All of these files have duplicate atoms or alternate coordinates.</p>
<p>How can I clean these PDB files using Visual Molecular Dynamics (<a href="https://www.ks.uiuc.edu/Training/SumSchool/materials/sources/tutorials/01-vmd-tutorial/html/node2.html" rel="nofollow noreferrer">VMD</a>) or Scaleable Molecular Dynamics (NAMD) <strong>*</strong>?</p>
<p>Can anyone tell me what command I should use in console mode?</p>
<p><strong>*</strong> note, this server may be unavailable</p>

<protein-structure><pdb><protein-protein-interaction>
How can I clean a PDB file using VMD or NAMD?
# How can I clean a PDB file using VMD or NAMD?

(Asked by: username_0 on 2022-10-25)

I have 3884 PDB files generated by [pd2\_ca2main](http://www.sbg.bio.ic.ac.uk/%7Ephyre2/PD2_ca2main/). PD2 CA2main is server for reconstructing the backbone of Calpha proteins using Gaussian mixture models.

All of these files have duplicate atoms or alternate coordinates.

How can I clean these PDB files using Visual Molecular Dynamics ([VMD](https://www.ks.uiuc.edu/Training/SumSchool/materials/sources/tutorials/01-vmd-tutorial/html/node2.html)) or Scaleable Molecular Dynamics (NAMD) **\***?

Can anyone tell me what command I should use in console mode?

**\*** note, this server may be unavailable

**Tags:** protein-structure, pdb, protein-protein-interaction

---

## 1 answers

### Answer by username_1 on 2022-11-13. Score: 1

You can use Chimera for this. The following code cleans your pdb file and write new pdb file.
import chimera
from DockPrep import prep
from chimera import runCommand, openModels

models = chimera.openModels.list(modelTypes=[chimera.Molecule])
prep(models)
runCommand("write format pdb 0 molecule.pdb")

You can run the code with
 chimera --nogui file.pdb code.py

> **Comments:**
> **username_2**: how do I get chimera ?  pip install pychimera https://pypi.org/project/pychimera/ ??? is there a python3 version ?  
> **username_1**: https://www.cgl.ucsf.edu/chimera/download.html  
> **username_2**: https://pychimera.readthedocs.io/en/latest/ --> Use UCSF Chimera packages in any Python 2.7 interpreter  

---

