[gmx-developers] Where can I define a truly global variable?

David van der Spoel spoel at xray.bmc.uu.se
Mon Aug 6 16:06:24 CEST 2007


Lee-Ping wrote:
> Dear community,
>
> I'm trying to add a feature to GROMACS which involves a variable being
> passed between all of the bonded and nonbonded force functions (in the same
> way that the total potential energy is passed).  I thought of increasing the
> number of variables with which each function is declared, but that leads to
> an immense amount of errors since each piece of code is intimately linked to
> so many others.  Currently I'm working around this problem by having each
> force function print numbers to a file, but this involves printf statements
> in the inner loops, which the program is not very happy about (it slows down
> considerably).  The other solution is to make the variable truly global, so
> I don't need to pass it between functions, but where would I declare a
> variable so global that I can, for example, call it from
> nonbonded_kernel330_c.c if I declared it in md.c or force.c?  Is this even
> possible?  If not, is there anywhere I can declare such a global variable
> (maybe in a .h file?)  Your input is appreciated.  Thanks,
>   
you can try adding it to the forcerec because it goes fromthe highest 
level almost down to the inner loops.




More information about the gromacs.org_gmx-developers mailing list