# Position restraints of positions relative to moving center of mass

**URL:** <https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269>\
**Category:** User discussions\
**Created:** [April 24, 2023, 8:43pm UTC](https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269 "2023-04-24T20:43:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![di\_jin](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@di\_jin](https://gromacs.bioexcel.eu/u/di_jin)\
**Post date:** [April 24, 2023, 8:43pm UTC](https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269/1 "2023-04-24T20:43:44Z")

</div>

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

Hi,

I want to pull the center of mass of a group of atoms in x-direction by using the harmonic potential, but I also want each atom in the group to stay static relative to the group’s center of mass. I can freeze y and z coordinates, but what should I do with the x-coordinates so that they travel at the constant designated pulling velocity without diffusing in x? Is this done through position restrains?

---

<div class="post-metadata">

**Author:** ![MichelePellegrino](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/michelepellegrino/32/628_2.png) [@MichelePellegrino](https://gromacs.bioexcel.eu/u/MichelePellegrino)\
**Post date:** [August 9, 2023, 6:51am UTC](https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269/2 "2023-08-09T06:51:50Z")

</div>

Hi di\_jin,  
Did you find a way to achieve relative position restrains? I would like to do a similar thing, but I fear this may not be supported in the current Gromacs release. In any case I would be interested in any follow-up on this question.

---

<div class="post-metadata">

**Author:** ![di\_jin](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@di\_jin](https://gromacs.bioexcel.eu/u/di_jin)\
**Post date:** [August 9, 2023, 7:54am UTC](https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269/3 "2023-08-09T07:54:08Z")

</div>

Hi Michele, Unfortunately I haven’t found a solution yet but I am still thinking about it. Let’s update each other if there is any progress.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [August 10, 2023, 9:18am UTC](https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269/4 "2023-08-10T09:18:30Z")

</div>

I don’t see why position restraints would not work for this. You can turn on free-energy and supply an “A” and “B” position restraint file which differ only in x-coordaintes and then pull using delta-lambda.

---

<div class="post-metadata">

**Author:** ![MichelePellegrino](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/michelepellegrino/32/628_2.png) [@MichelePellegrino](https://gromacs.bioexcel.eu/u/MichelePellegrino)\
**Post date:** [August 11, 2023, 8:13pm UTC](https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269/5 "2023-08-11T20:13:03Z")

</div>

Hi Berk,

This solution may be sufficient for di\_jin’s particular problem, but I think the general problem is a bit more complicated. We would like to restrain atoms to distances related to the centre of mass, but not the centre of mass itself. That is, the COM is free to move (or be pulled), while atoms are restrained to a fixed x/y/z coordinate w.r.t it.

E.g this might be necessary for an accurate calculation of solid liquid friction, I can explain why in person.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [August 14, 2023, 9:22am UTC](https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269/6 "2023-08-14T09:22:21Z")

</div>

But that is exactly what position restraints with refcoord-scaling does, right? At least if you need a single group only.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [August 14, 2023, 9:42am UTC](https://gromacs.bioexcel.eu/t/position-restraints-of-positions-relative-to-moving-center-of-mass/6269/7 "2023-08-14T09:42:09Z")

</div>

Ah, no position restraints with refcoord-scaling fixes the COM relative to the box.

To use the actual COM, one would need to compute it. This can be problematic in a periodic system and this will be expensive when running in parallel.
