[gmx-developers] Free Format gro File

Anton Feenstra k.a.feenstra at vu.nl
Mon Oct 8 10:56:58 CEST 2012


On 02/10/12 00:42, Mark Abraham wrote:
> On 2/10/2012 8:24 AM, Mirco Wahab wrote:
>> Am 02.10.2012 00:11, schrieb Mark Abraham:
>>> On 2/10/2012 8:06 AM, Jicun Li wrote:
>>>> How can I modify the source code to support the free format gro file?
>>>> Thank you very much.
>>>
>>> You could do that, but what's the advantage?
>>
>> Probably because in C/C++, you have to copy each data field
>> to a separate buffer in order to handle this data item correctly
>> and efficiently for yourself. This might even be a hard task
>> for a newbie, I'd think (and remember ...).
>>
>> If you can trust the data to be white-space separated, this task
>> will become trivial (sscanf, istreams and friends).
>
> scanf using formats with fixed widths is more trivial still. Designing
> and understanding the format strings is not easy, however. You can find
> useful forms in the GROMACS source, of course.

I don't know if it is still in the code (haven't looked there for a long 
time), but the gro input routine that I wrote/modified accepts arbitrary 
precision; IIRC it will infer the precision used from the first line, 
build a format string for sscanf (or similar) and use that for the rest 
of the file. The output routine can be given a precision to write in.

To be sure, my 4.5.5 trjconv says:
-ndec        int    3       Precision for .xtc and .gro writing in number of
                             decimal places



-- 
Groetjes,

Anton
  _____________ _______________________________________________________
|             |                                                       |
|  _   _  ___,| K. Anton Feenstra                                     |
| / \ / \'| | | IBIVU/Bioinformatics - Vrije Universiteit Amsterdam   |
|(   |   )| | | De Boelelaan 1081 - 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/         |
|             | "Out Of Register Space (Ugh)" (Vi)                    |
|_____________|_______________________________________________________|



More information about the gromacs.org_gmx-developers mailing list