I divide my water into several bins, and I need to calculate the local temperature of water in every bin. So I need to postprocess by myself. But I don’t know how to calculate the temperature of my water while I am using fix_shake. I am trying to look at the code with this part. But I have difficult to find it.
Could anybody tell me how to calculate the number of degree of freedom in water system?
Do you have access to a copy of Allen and Tildesley? They discuss this on page 47. The short of it is that you need to subtract out the lost degrees of freedom from the constraints on each molecule - that is, the fixed bond length and fixed angle - from the DOF you would have in the absence of the constraints. Fix shake does this. The documentation says as much. Look at fix_shake.cpp . There is a section that counts the constrained DOF. It is clearly labeled.
Quoting shiziyuan <[email protected]>:
Thanks a lot. I don’t have a copy of Allen and Tildesley? Where can I get it?
Sorry. I just got you.I have this book. Thank you very much.
You could also use compute temp/region or fix ave/spatial with a variable
formula that calcs a temperature to get close to the answer you want.
You'd still have to correct for the SHAKE DOF subtraction.
I did use fix ave/spatial
compute ke water ke/atom
variable temp atom c_ke
fix 88 water ave/spatial 1 797000 800000 z lower 0.05 v_temp file tmp.profile units reduced
Then after I got the results, I use the number of atoms in a bin to postprocess to get the real value of my temperature. But my results showed a strong dependence of my bin size. Different bin size gives very different results.
So my concern is that I need to do statistical calculation based on water molecules not atoms. Cause we get the Shake DOF based on molecules.
Is there any way to do this?
As long as you have sufficiently big bins to have many atoms/molecules
you shouldn't get a strong dependence on bin size. You could also write
a formula yourself that counts the number of atoms, divides by 3 per molecule,
and subtracts out the right DOF per water molecule depending on what
you are constraining. The only ambiguity will be water molecules straddling
the region (which is why LAMMPS doesn't try to do this). But again,
if you have a largish #'s of molecules in the region it won't matter.
Thanks Steve. You gave me the exact answer I concerned.