8:47 AM
@EversonGomes I see that you have asked 8 questions until now. And 7 of them have received very useful and good answers. However none of the 7 questions, have an accepted answer. Please click on the tick mark next to the answer you think is the best. This way it acknowledges the effort that person has made to answer your question. Also it gives you +2 points ! Win-win 🏆 😃

1 hour later…
10:12 AM
@user1271772 hey been a while!
Sorry i couldn't collaborate
Any thoughts on this question?
2

Background I haven't seen this mauver done before but let's say, I have a thermal gas and I have a molecule with momentum $\vec p$. It undergoes a collision and now has momentum $\vec P$. Now, due to molecular chaos it should be possible to get the probability distribution function $P$ given $\ve... 7 hours later… 4:58 PM @bubucodex, Please join this chat room. I will try explaining the scheme @HemanthHaridas Yeah. Please explain. In the second example that I gave you, we are considering a water molecule. Thus we know that both hydrogens should be found in the vicinity of the oxygen atom. Right? @HemanthHaridas right Now, consider the case that this water molecule is at the edge of the simulation box. The oxygen atom and one of the hydrogen atoms, which i will call H1 has coordinates which are just below the box edge. However, the other hydrogen atom has coordinates that are just outside the simulation box. Is this clear? @HemanthHaridas I understood your point. 5:06 PM Do you have more questions about this? @HemanthHaridas Yes. I understood your example, but I don't think this answers my question. Let me explain why. Sure. @HemanthHaridas In your water example, you have mentioned that, unwrapped coordinate = wrapped coordinate near the positive edge + Length of the simulation box, if I have correctly understood. it is wrapped coordinate near the negative edge. @HemanthHaridas @HemanthHaridas right . 5:13 PM So how should it work? set total [atomselect top "resname ADE"] This line selects for all of your residues. replace ADE with the required residue name. ok I used resid 1. this is the interested one Please understand that my code works for a CHARMM FF simulation. If you are using something else, you might need to rewrite the code. But the idea will work. I am not speaking about the resid. What is the resname? ahhh. I am using amber. resname mol and for solvent? what is the resname? 5:16 PM Water @HemanthHaridas But suppose after the simulation is over, you get all the coordinates. Now, you are ready to unwrap those coordinates which are wrapped. Wrapped coordinates are those which have been brought from the outside of the simulation box to the negative edge of the box by employing PBC. But not all coordinates are wrapped. Am I right uptill now ? @Abd-ElazeemMohamed o Give me five minutes. I will get back to you/ @bubucodex Yes @HemanthHaridas Ok. Thanks @Abd-ElazeemMohamed And do you have something like segnames? I am asking this because I have never used amber. @HemanthHaridas I think, then, you cannot apply the unwrapping procedure to those coordinates which are not wrapped. You have to check which coordinates are wrapped or which are not. I am referencing an example code from the book by allen - tildelsely where unwrapping procedure is used. I think in this example the unwrapping has been done differently than your procedure. github.com/Allen-Tildesley/examples/blob/master/diffusion.f90 @HemanthHaridas see the subroutine unfold() 5:24 PM You do not have to. The unwrapping is done only for bonds that cross the boundary. You will have a file which contains the list of bonds. The visualization package will check for the lengths of these bonds, and if they are crossing the boundary, will be unwrapped to the original state. In the example that you have provided, It just applies the transformations that i gave in the answer in reverse. They first calculate the position of the image with respect to the original. Then they figure out where will the image appear in the box, if PBC is valid. Finally they add the position of the image to the original position to get unwrapped position. @HemanthHaridas What does " original " mean here ? The previous configuration. The coordinates at the previous step @HemanthHaridas I failed to understand the second step. Why is it required to figure out where will the image appear in the box ? Is it already not available ? The saved position is itself the image. Isn't it ? r = r - r_old ! Convert r to displacements relative to r_old r = r - ANINT ( r / box ) * box ! Apply periodic boundaries to displacements r = r + r_old ! Convert r back to absolute coordinates Here r is the current coordinates and r_old is the previous coordinates. Is this clear? 5:39 PM @HemanthHaridas The second and third steps are not clear. In the first step, you compute the displacement vector between the current frame particle and the previous frame particle. Then you transform that displacement vector to conform to PBC. ANINT is a routine to convert a fractional number to nearest integer what you do is you take a ratio of displacement and box length and scale the box length by the nearest integer to the ratio You then subtract that value from the displacement vector to find the displacement vector that respects PBC Now you have the distance that the particle travelled between two successive frames. Add this displacement vector to the previous coordinate, and this gives you the unwrapped coordinate in the current frame Please try drawing this out in 2D on a sheet of paper. Then it will be more clear to you @bubucodex Is it clear now? @HemanthHaridas Actually I am stuck at the second step. Why and how PBC has been applied to the displacement ? Please take a sheet of paper if you can I will try to walk you through and two pens of different colors @HemanthHaridas that will be great Draw a square of side length 10 mark the start as 0 and end as 10 so you will have (0,0), (0,10), (10,0) and (10,10) Done? 5:55 PM @HemanthHaridas Done Now mark a point at (9,1) Mark this with one color @HemanthHaridas done This is your coordinate at the previous step @HemanthHaridas okay Now mark a point at (1, 1) with a different color This is your coordinate at the current step which is wrapped 5:57 PM @HemanthHaridas right What is the displacement vector? It is (-8,0) right? @HemanthHaridas right Now you need to find the distance this particle would have travelled if there was no PBC right? @HemanthHaridas yes For that we need to find how many images have we crossed first. That is what AINT(r/box) * box does So divide -8 (which is the x-displacement) by 10 what do you get? which is the nearest integer? 6:00 PM @HemanthHaridas -1 So we crossed only one image Now multiply that by box length. What do you get? @HemanthHaridas -box Which is? -10 right? @HemanthHaridas yes Now subtract this from your displacement This will wrap the displacement around with PBC You should get 2 6:04 PM @HemanthHaridas Yes, - 8 - (-10) Now add this to your previous coordinates which is (9,1) You will get (11,1) This is your unwrapped coordinate You can verify that in both cases, the particle has travelled a distance of 2 from the previous step. Becase with PBC it is (9,1) -> (10,1) which is equal to (0,1) -> (1,1) distance travelled is 2. Now withour PBC, it is (9,1) -> (10,1) -> (11,1) Is it clear now? yes, ANINT( r / box ) * box will always yield either + box or - box right ? Yes, that is because you assume that the particle will only travel a maximum distance of (box/2) between two successive frames Now if your question is answered, please mark my answer as accepted, and upvote it. Thanks Even if the particle moves more than box/2 but less than box, I think then also that operation will yeild " + box " True. But the standard assumption is what i just mentioned. That is because the displacement is evaluated by keeping the previous frame at the origin. So you only have +(box/2) <-> -(box/2) to move. So you either move to +(box/2) or you move to -(box/2) 6:17 PM Okay. Thanks for your effort. The discussion has been really been helpful. please mark my answer as accepted, and upvote it. sure Thank you. Are you a PhD student? or a Masters student? PhD student Me too @Abd-ElazeemMohamed Lets continue the discussion. Did you try the script? 6:20 PM @HemanthHaridas In general, we can have segnames, but in my case I don't have Can you set them? If not what is an id that will tell the five molecules apart? Ok. Let me try Sure It is close to midnight where i live. You can leave me a message. I will respond to it tomorrow morning Ok. Thanks. In general, it didn't work. I got this error wrong # args At which line? 6:28 PM it seems segnames one This one? set segnames [lsort -unique [$total get segname]]

This line when I wrote. it gave me a bracket {}
I think I need to use residue instead of segname. I will try

7:22 PM
I tried I still have an error with this part
foreach residue $residues { set sel [atomselect top "resname mol and residue$residue"]
set rcom [measure center $sel weight mass] set distance [vecnorm [vecsub$rcom $tcom]] # calculate the distance between each residue COM and total COM lappend dist$distance # append it to a list

set totaldistance 0
foreach distance $dist { set totaldistance [expr {$totaldistance + $distance}] } puts$output "$totaldistance" } close$output
mol delete all

7:34 PM
This line is the reason for the error set distance [vecnorm [vecsub $rcom$tcom]]
I don't know why