<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
How to remove the artificial<br>translation when processing the coordinates?<br><br></td></tr></tbody></table></blockquote></div><br>If boxc[] = a,b,c<br>of an orthorhombic cell and the origin is in 0,0,0<br>a piece of the C code for storing the variables to be<br>
correlated in a molecular liquid at time t is:<br><br> for(k=0;k<3;k++) {<br> boxcm[k]=0.5*boxc[k];<br> }<br><br> for(im=0; im<nmol; im++) {<br> for(ia=0; ia<natom; ia++) {<br>
for (k=0;k<3;k++,crdiold++) {<br> dri=(*crdi-*crdiold);<br> *crdiold=*crdi;<br> if(dri > boxcm[k]) (*jumppi)++;<br> if(dri < -boxcm[k]) (*jumpmi)++;<br> x = (*crdi++)-(*jumppi-*jumpmi)*boxc[k];<br>
*stor++ = x;<br> jumppi++; jumpmi++;<br> }<br> }<br> }<br><br>All arrays are nmol*natom*(x,y,z) arrays. stor is ndt*nmol*natom*(x,y,z),<br>where ndt is the number of points in the msqd.<br>
The procedure of storing and correlating is that of Allen & Tildesley<br>book. In the Frenkel's book (Algorithm 8, the code at page 82) stor corresponds to x0(i,t).<br>It can be adapted to an arbitrary cell, applying to dri the usual cartesian-to-cell transformation. If co is the cell written in the xsf snapshot<br>
(PRIMVEC entry):<br><br>/* calculation of cell_to_cart (see wikipedia: Fractional coordinates) */<br> a=sqrt(co[0]*co[0]+co[1]*co[1]+co[2]*co[2]);<br> b=sqrt(co[3]*co[3]+co[4]*co[4]+co[5]*co[5]);<br> c=sqrt(co[6]*co[6]+co[7]*co[7]+co[8]*co[8]);<br>
cos_alpha = (co[3]*co[6]+co[4]*co[7]+co[5]*co[8])/(b*c);<br> cos_beta = (co[0]*co[6]+co[1]*co[7]+co[2]*co[8])/(a*c);<br> cos_gamma = (co[0]*co[3]+co[1]*co[4]+co[2]*co[5])/(a*b);<br> sin_gamma = sqrt(1.-cos_gamma*cos_gamma);<br>
v = sqrt(1.-cos_gamma*cos_gamma<br> -cos_alpha*cos_alpha<br> -cos_beta*cos_beta<br> +2.*cos_alpha*cos_beta*cos_gamma );<br> cell_to_cart[1][1] = a;<br> cell_to_cart[1][2] = 0.;<br>
cell_to_cart[1][3] = 0.;<br> cell_to_cart[2][1] = b*cos_gamma;<br> cell_to_cart[2][2] = b*sin_gamma;<br> cell_to_cart[2][3] = 0.;<br> cell_to_cart[3][1] = c*cos_beta;<br> cell_to_cart[3][2] = c*(cos_alpha - cos_beta*cos_gamma)/sin_gamma;<br>
cell_to_cart[3][3] = c*v/sin_gamma;<br> invert(cell_to_cart,3,3,cart_to_cell);<br><br>Once in fractional coordinates, the test on dri is made using 1/2.<br>I never had non-orthorhombic cells, I work with solution, so I did not<br>
check the second part.<br>There are special cases where the test above is not safe, but they<br>should be very rare.<br><br> Giovanni<br>============================================================<br>Giovanni La Penna - National research council (Cnr)<br>
Institute for chemistry of organo-metallic compounds (Iccom)<br>via Madonna del Piano 10,<br>I-50019 Sesto Fiorentino, Firenze, Italy<br>tel.: +39 055 522-5264, fax: +39 055 522-5203<br>e-mail: <a href="mailto:glapenna@iccom.cnr.it">glapenna@iccom.cnr.it</a> - <a href="http://www.iccom.cnr.it/lapenna">http://www.iccom.cnr.it/lapenna</a><br>
skype: giovannilapenna<br>============================================================<br>