<DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><SPAN>On 11/04/12, <B class=name>Erik Marklund </B>&lt;erikm@xray.bmc.uu.se&gt; wrote:</SPAN>
<BLOCKQUOTE style="BORDER-LEFT: #00f 1px solid; PADDING-LEFT: 13px; MARGIN-LEFT: 0px" class=iwcQuote cite=mid:16741CBC-0C4C-446D-8405-0D3B5A4C4938@xray.bmc.uu.se type="cite">
<TABLE>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space">
<P><br />
<DIV>
<DIV>11 apr 2012 kl. 01.38 skrev Mark Abraham:</DIV><BR class=Apple-interchange-newline>
<BLOCKQUOTE type="cite">
<DIV>On 11/04/2012 5:21 AM, David van der Spoel wrote:<br />
<BLOCKQUOTE type="cite">On 2012-04-10 21:10, Anton Feenstra wrote:<br /></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">On 09/04/12 21:47, Justin A. Lemkul wrote:<br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">Radhakrishna Bettadapura wrote:<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">All,<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">I'm trying to figure out why a pdb input to pdb2gmx results in<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">coordinates that are scaled by a factor of 0.1. That is, if a line in<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">the PDB file reads<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">ATOM 1 N ALA B 3 -1.221 20.481 12.450 1.00 34.64 N<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">then the corresponding line in the .gro file reads<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">3ALA N 1 -0.122 2.048 1.245<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">The culprit seems to be the following lines in pdbio.c:<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">static int read_atom(t_symtab *symtab,<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">char line[],int type,int natom,<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">t_atoms *atoms,rvec x[],int chainnum,gmx_bool bChange)<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">{<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">// do stuff<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">x[natom][XX]=strtod(xc,NULL)*0.1; /*all coordinates scaled by 0.1...<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">why?*/<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">x[natom][YY]=strtod(yc,NULL)*0.1;<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">x[natom][ZZ]=strtod(zc,NULL)*0.1;<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">//do more stuff<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">}<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">There's also a line in the output function that multiplies all<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">incoming coordinates by 10 before writing it to output:<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">void write_pdbfile_indexed(FILE *out,const char *title,<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">t_atoms *atoms,rvec x[],<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">int ePBC,matrix box,char chainid,<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">int model_nr, atom_id nindex, atom_id index[],<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">gmx_conect conect, gmx_bool bTerSepChains)<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">{<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">//do stuff...<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">fprintf(out,pdbform,pdbtp[type],(i+1)%100000,nm,resnm,ch,resnr,<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">(resic == '\0') ? ' ' : resic,<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">10*x[i][XX],10*x[i][YY],10*x[i][ZZ],occup,bfac,atoms-&gt;atom[i].elem);<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">// do more stuff...<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">}<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">Can someone tell me why this coordinate scaling occurs? And why the<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">scale factor is a single hard-coded number than, say, something that<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">depends on the input?<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">PDB coordinates are in Angstrom, while .gro coordinates are in nm. Hence<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">the conversion factor of 0.1.<br /></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">What happened to A2NM and NM2A?<br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">In my (4.0.5, yes that is very old) includes/physics.h I still see:<br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">#define A2NM (ANGSTROM/NANO) /* NANO */<br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">#define NM2A (NANO/ANGSTROM) /* 10.0 */<br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite">Why aren't these still used for that?<br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE type="cite">At some stage macros were removed from the code, even though these seem rather harmless. I agree that it is confusing to hard code these numbers. If we cannot use macro's like this we should probably replace them by<br /></BLOCKQUOTE>
<BLOCKQUOTE type="cite">static const real ANGSTROM=1e-10;<br /></BLOCKQUOTE>
<BLOCKQUOTE type="cite">static const real NANO=1e-9;<br /></BLOCKQUOTE>
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE>
<BLOCKQUOTE type="cite">etc.<br /></BLOCKQUOTE>
<BLOCKQUOTE type="cite"><br /></BLOCKQUOTE>
<BLOCKQUOTE type="cite">Comments?<br /></BLOCKQUOTE><br />include/physics.h still has these macros. IMO, hard-coded constants are a greater evil than macros to prevent that, though I expect we will transition to const values at some stage soon.<br /></DIV></BLOCKQUOTE>
<DIV><br /></DIV><DIV>But are these the kind of macros we want to avoid? Aren't function-like macros the ones to kill in the first place?</DIV></DIV></TD></TR></TBODY></TABLE></BLOCKQUOTE>
<DIV>&nbsp;They're taking no parameters, so they're hardly function-like. The code fragments above are compiled into constants by the pre-processor. A macro that is used as</DIV><DIV>&nbsp;</DIV><DIV>dist_in_nm&nbsp;= dist_in_angstrom * A2NM;</DIV><DIV>&nbsp;</DIV><DIV>is much less evil than a macro&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>dist_in_nm&nbsp;= A2NM(dist_in_angstrom);</DIV><DIV>&nbsp;</DIV><DIV>and physics.h has only the first type. Inlined functions of the second type&nbsp;would be best of all, of&nbsp;course.&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Mark&nbsp;</DIV>