# Recentering the protein and extracting frames

**URL:** <https://gromacs.bioexcel.eu/t/recentering-the-protein-and-extracting-frames/1745>\
**Category:** User discussions\
**Tags:** gmx-trjconv\
**Created:** [March 13, 2021, 11:26am UTC](https://gromacs.bioexcel.eu/t/recentering-the-protein-and-extracting-frames/1745 "2021-03-13T11:26:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gromacsash](https://avatars.discourse-cdn.com/v4/letter/g/d6d6ee/32.png) [@gromacsash](https://gromacs.bioexcel.eu/u/gromacsash)\
**Post date:** [March 13, 2021, 11:26am UTC](https://gromacs.bioexcel.eu/t/recentering-the-protein-and-extracting-frames/1745/1 "2021-03-13T11:26:07Z")

</div>

GROMACS version:  
GROMACS modification: Yes/No  
Here post your question

Dear All,

I have run a simulation for a protein of 123 residues and after simulation when I open the .xtc file with .gro , the protein is seen outside the simulation box. I tried to use -pbc commands (with mol and whole ) and -center -ur compact but it is still outside.

I need to center this protein and then extract frames (.pdb) at regular interval.

Also, I could do the same in vmd using pbc wrap command but then don’t know how to save the new centered coordinates as .xtc so as to use in gromacs ?  
OR Is there any method to extract the individual frames using vmd (In vmd, we can save as .dcd file, but how to use it to extract frames as .pdb at regular interval)?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![milosz.wieczor](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@milosz.wieczor](https://gromacs.bioexcel.eu/u/milosz.wieczor)\
**Post date:** [March 14, 2021, 4:17pm UTC](https://gromacs.bioexcel.eu/t/recentering-the-protein-and-extracting-frames/1745/2 "2021-03-14T16:17:40Z")

</div>

Hi,

If all default settings fail, I usually resort to a two-step protocol as follows:

1. use gmx trjconv -center, using a single-atom group (chosen as close to the molecule center as possible) for centering; this moves the system so that the whole molecule should be in the box
2. then use gmx trjconv -pbc mol (or -pbc res if mol fails) to keep the molecule inside the box

In trjconv, you can use a combination of -dt and -sep to extract frames in regular intervals. In VMD, you can stride while saving the trajectory, but they will be all written to a single file (though you’re still free to write a TCL script that saves frames individually).

Best,  
Miłosz
