[gmx-developers] Coordinate scaling in pdbio.c

Anton Feenstra k.a.feenstra at vu.nl
Tue Apr 10 21:10:44 CEST 2012


On 09/04/12 21:47, Justin A. Lemkul wrote:
>
>
> Radhakrishna Bettadapura wrote:
>> All,
>>
>> I'm trying to figure out why a pdb input to pdb2gmx results in
>> coordinates that are scaled by a factor of 0.1. That is, if a line in
>> the PDB file reads
>>
>>
>> ATOM 1 N ALA B 3 -1.221 20.481 12.450 1.00 34.64 N
>>
>> then the corresponding line in the .gro file reads
>>
>> 3ALA N 1 -0.122 2.048 1.245
>>
>> The culprit seems to be the following lines in pdbio.c:
>>
>> static int read_atom(t_symtab *symtab,
>> char line[],int type,int natom,
>> t_atoms *atoms,rvec x[],int chainnum,gmx_bool bChange)
>> {
>>
>> // do stuff
>>
>> x[natom][XX]=strtod(xc,NULL)*0.1; /*all coordinates scaled by 0.1...
>> why?*/
>> x[natom][YY]=strtod(yc,NULL)*0.1;
>> x[natom][ZZ]=strtod(zc,NULL)*0.1;
>>
>> //do more stuff
>>
>> }
>>
>>
>> There's also a line in the output function that multiplies all
>> incoming coordinates by 10 before writing it to output:
>>
>> void write_pdbfile_indexed(FILE *out,const char *title,
>> t_atoms *atoms,rvec x[],
>> int ePBC,matrix box,char chainid,
>> int model_nr, atom_id nindex, atom_id index[],
>> gmx_conect conect, gmx_bool bTerSepChains)
>> {
>>
>>
>> //do stuff...
>>
>>
>> fprintf(out,pdbform,pdbtp[type],(i+1)%100000,nm,resnm,ch,resnr,
>> (resic == '\0') ? ' ' : resic,
>> 10*x[i][XX],10*x[i][YY],10*x[i][ZZ],occup,bfac,atoms->atom[i].elem);
>> // do more stuff...
>>
>> }
>>
>>
>> Can someone tell me why this coordinate scaling occurs? And why the
>> scale factor is a single hard-coded number than, say, something that
>> depends on the input?
>>
>
> PDB coordinates are in Angstrom, while .gro coordinates are in nm. Hence
> the conversion factor of 0.1.

What happened to A2NM and NM2A?
In my (4.0.5, yes that is very old) includes/physics.h I still see:

#define A2NM             (ANGSTROM/NANO)        /* NANO         */
#define NM2A             (NANO/ANGSTROM)        /* 10.0         */

Why aren't these still used for that?


-- 
Groetjes,

Anton
  _____________ _______________________________________________________
|             |                                                       |
|  _   _  ___,| K. Anton Feenstra                                     |
| / \ / \'| | | IBIVU/Bioinformatics - Free University  Amsterdam     |
|(   |   )| | | De Boelelaan 1083A - 1081 HV Amsterdam - Netherlands  |
| \_/ \_/ | | | Tel +31 20 59 87783 - Fax +31 20 59 87653 - Room P136 |
|             | Feenstra at few.vu.nl - www.few.vu.nl/~feenstra/         |
|             | "Shake Yourself" (YES)                                |
|_____________|_______________________________________________________|



More information about the gromacs.org_gmx-developers mailing list