I have a 5 residue system with MET at each end and I want to freeze the sulfur atom positions. As per this post : https://github.com/openmm/openmm/issues/2665, and a couple of other ones, the only solution provided was to set the mass to zero.
I have tried that and it did not work for me, could that be because sulfur atoms are covalently-bonded to other atoms which are subject to forces?
I have tried a custom force using a harmonic potential to squeeze the atoms in that narrow potential and it has worked, but I was wondering why the setting the mass to zero does not work instead.
Best,
Hassan
Freezing atom positions
- Peter Eastman
- Posts: 2611
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Freezing atom positions
In what way did it not work? If an atom is massless, it won't move. It doesn't matter what element it is or what it's bonded to.
Remember that you need to set the mass before creating the Simulation/Context. Once the Context is created, any further changes to the System are ignored.
Remember that you need to set the mass before creating the Simulation/Context. Once the Context is created, any further changes to the System are ignored.
- Hassan Nadeem
- Posts: 11
- Joined: Tue Apr 04, 2023 8:20 am
Re: Freezing atom positions
The atoms seem to be moving in the simulation.
I used the following code to set the SD atoms mass to zero before creating the Simulation object
I used the following code to set the SD atoms mass to zero before creating the Simulation object
Code: Select all
totalrestrainedatoms=['SD']
for i, atom_crd in enumerate(parm.positions):
if parm.atoms[i].name in totalrestrainedatoms:
system.setParticleMass(i, 0.0)
- Hassan Nadeem
- Posts: 11
- Joined: Tue Apr 04, 2023 8:20 am
Re: Freezing atom positions
I figured it out, thanks.
My mistake was loading a checkpoint file after setting the masses to zero.
My mistake was loading a checkpoint file after setting the masses to zero.
- Peter Eastman
- Posts: 2611
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Freezing atom positions
Can you post your full script, along with any input files needed to reproduce it?