output force on a frozen molecule

Hi all,

I’m trying to store and output the z direction force acting a frozen water molecule (the water was only froze on z direction ), The frozen water molecule was specified as group ‘freezewater’. All of the water in my system was specified as group ‘water’. The id numbers of H and O in that water were 6718, 6719 and 6720. This is the main body in my input script:

fix 2 water nvt temp 300.0 300.0 100.0
fix storeforcewater freezewater store/force
variable force1z equal f_storeforcewater[6718][3]
variable force2z equal f_storeforcewater[6719][3]
variable force3z equal f_storeforcewater[6720][3]
variable forcewater equal v_force1z+v_force2z+v_force3z

fix outputforce freezewater ave/time 5 1 5 v_forcewater file forcewater.txt

#neigh_modify exclude group freezewater water

fix setforcewater freezewater setforce NULL NULL 0
run 500000
unfix setforcewater
unfix outputforce
unfix storeforcewater
unfix 2

By using this input script, I always got the error: ERROR: Out of range atoms - cannot compute PPPM.

Only if I turned off the pair interaction between group ‘water’ and group ‘freezewater ’ by activating the command line ’ neigh_modify exclude group freezewater water’, I can get rid of that error. However, I think the subsequently calculated force wasn’t the one that I really needed because of the excluded pair interaction.

How can I correctly calculated the z-direction force acting on the water molecule ?

Many thanks in advance,

Hang

If you use fix store/force you will store the
force on the group atoms before the setforce
command clears it out. You can then sum
it and output it, for example.

Steve

Hi Steve,

Thanks for your comment!

Yes, I have used the fix store/force. But I always get the error:Out of range atoms - cannot compute PPPM.

Does it mean I should not fix the molecule only in one direction?

Hang

2012/11/16 Steve Plimpton <[email protected]>

That's due to bad dynamics. Your atoms are moving
too far before you reneighbor and PPPM can't map
their charge to the FFT grid. Reneighbor more aggressively.

Steve

Hi Steve,

I appreciate your explanations!

Instead of setforce command, I tried recenter command to fix the center of mass for the water molecule along z direction. I think this kind of method should be more close to the dynamic that I want.

The following is the main part of my input script.

fix 2 water nvt temp 300.0 300.0 100.0
compute COM freezewater com
fix onewater freezewater recenter NULL NULL 24.5 units box

variable force1x equal fx[6718]
variable force2x equal fx[6719]
variable force3x equal fx[6720]

variable force1y equal fy[6718]
variable force2y equal fy[6719]
variable force3y equal fy[6720]

variable force1z equal fz[6718]
variable force2z equal fz[6719]
variable force3z equal fz[6720]

variable forcewater_x equal v_force1x+v_force2x+v_force3x
variable forcewater_y equal v_force1y+v_force2y+v_force3y
variable forcewater_z equal v_force1z+v_force2z+v_force3z

fix outputforce_x freezewater ave/time 5 1 5 v_forcewater_x file forcex24.5
fix outputforce_y freezewater ave/time 5 1 5 v_forcewater_y file forcey24.5
fix outputforce_z freezewater ave/time 5 1 5 v_forcewater_z file forcez24.5

fix 7 masscenter ave/time 5 1 5 c_COM[1] c_COM[2] c_COM[3] file com24.5
run 500000
unfix 7
unfix onewater
unfix outputforce_x
unfix outputforce_y
unfix outputforce_z
unfix 2

However, I got very strange result that I can’t understand. Plead find attachment. It is a figure for force applying on that water molecule along z dimension as a function of simulation time. Before 0.17 ns, everything looks good. But the force became about zero after about 0.17ns. Do you know why is that? I suppose the value of force should always fluctuate during dynamic simulation.

Thanks very much!

Hang

2012/11/17 Steve Plimpton <[email protected]>

forcez-time.jpg

Hi Steve,

I appreciate your explanations!

Instead of setforce command, I tried recenter command to fix the center of
mass for the water molecule along z direction. I think this kind of method
should be more close to the dynamic that I want.

The following is the main part of my input script.

fix 2 water nvt temp 300.0 300.0 100.0
compute COM freezewater com
fix onewater freezewater recenter NULL NULL 24.5 units box

Have you looked at (visualized) the trajectory using VMD? (or AtomEye
or some other program?) (If not, see attached README file containing
instructions for VMD.)

From your graph, it seems like the other water molecules are no longer

in contact with your frozen molecule. Did the other water molecules
move away from it?

README_visualize.txt (2.42 KB)

Hi Andrew,

Thank your for your helpful suggestions.

In the manual, It is suggested that the reason for the decreasing of force is possibly due to the unpredictable dynamic of that freezing water if I didn’t use shift keyword to adjust the position of all atoms: ‘If you are thermostatting the entire system, then the solvent would be cooled to compensate’.

As you suggested, I checked the coordinate of that water but I didn’t find the other water move away. Instead, the water was froze on x,y,z dimensions after 0.17 ns.

I have tried not to integrate the equations of motion for the water that I want to fix. Just as you said, x,y,z coordinate of that water will be fixed during the simulation. But this is not what I want to do. I would like to only fix the z dimensional center of mass for that water and output the ‘real’ force on the water.

I found another command in the manual: ‘fix momentum’.
fix freeze freezewater momentum 1 linear 0 0 1

I hope the above command is able to zero out the linear momentum(velocity) of the water. Also, I hope the center of mass for that water won’t change with time. When I check the result of center of mass for that water, I found the center of mass along z dimension for the water changing with simulation time. But the range of changing was very small.

What I’m concerned is if this command will change the total force on that water. How did the ‘fix momentum’ command work? Can I get the true force on that water using this command?

Thank you!

Hangyan

2012/11/19 Andrew Jewett <jewett.aij@…24…>