[gmx-users] correct processing of #define statements by grompp in gromacs 4.0.2 requires exactly one space after #define
chris.neale at utoronto.ca
chris.neale at utoronto.ca
Wed Nov 26 06:35:02 CET 2008
Nice trick with %n on sscanf. I went with the manual replacement but I
do appreciate learning new things, thanks Berk,
Chris.
###
Hi,
That is an annoying bug.
I fixed it for 4.0.3.
If you want it fixed now, the diff is below.
Berk
RCS file: /home/gmx/cvs/gmx/src/kernel/gmxcpp.c,v
retrieving revision 1.9
diff -r1.9 gmxcpp.c
121,122c121,122
< sscanf(define,"%s",name);
< ptr = define + strlen(name);
---
> sscanf(define,"%s%n",name,&i);
> ptr = define + i;
> Date: Tue, 25 Nov 2008 16:32:57 -0500
> From: chris.neale at utoronto.ca
> To: gmx-users at gromacs.org
> Subject: [gmx-users] correct processing of #define statements by
> grompp in gromacs 4.0.2 requires exactly one space after #define
>
> When two spaces are included the #define KEYWORD is incompletely
> removed from the file.
> In case my conclusion about the exact nature of the error is
> incorrect, here is more information.
>
> I have a ffcharmbon.itp file that contains:
>
> [ dihedraltypes ]
> #define improper_NC2_X_X_C_ 180.00000 83.68000 2
>
> And an .itp file that contains:
>
> [ dihedrals ]
> 1 2 5 8 1 improper_NC2_X_X_C_
>
> where grompp -pp returns
>
> [ dihedrals ]
> 1 2 5 8 1 _ 180.00000 83.68000 2
>
> and the floating '_' character causes the error message:
>
> ERROR 1 [file my.itp, line 77]:
> No default Proper Dih. types
>
> I tried to fix this by removing the trailing underscore character
> from my defined string in both files,
> but now I get a trailing 'C'
>
> [ dihedrals ]
> 1 2 5 8 1 C 180.00000 83.68000 2
>
> So it appears that the define statement is simply not being entirely removed.
>
> When I then replaced
> #define improper_NC2_X_X_C_ 180.00000 83.68000 2
> by
> #define improper_NC2_X_X_C_ 180.00000 83.68000 2
> (only one space between '#define' and 'improper...')
> it works correctly.
>
> Note that cpp handled this original define statement properly in
> gromacs 3.3.1.
>
> Chris.
>
>
>
>
More information about the gromacs.org_gmx-users
mailing list