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

Lee-Ping leeping at MIT.EDU
Thu Aug 2 17:17:30 CEST 2007


Sorry, I should mention that currently I'm not too worried about performance
optimization; it's just that printing to a text file in the inner loops is
far too slow.  I would rather put everything into a global variable and then
print once after all the force calculations are done, because I imagine this
wouldn't cause such a dramatic slowdown (is this true?).  

If my additions were to ever make it into official GROMACS, I would
definitely change the structure of all the functions so as to not cause
memory / performance issues.

- Lee-Ping

-----Original Message-----
From: gmx-developers-bounces at gromacs.org
[mailto:gmx-developers-bounces at gromacs.org] On Behalf Of Lee-Ping
Sent: Thursday, August 02, 2007 11:11 AM
To: gmx-developers at gromacs.org
Subject: [gmx-developers] Where can I define a truly global variable?

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,

- Lee-Ping, a novice programmer

_______________________________________________
gmx-developers mailing list
gmx-developers at gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-developers
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to gmx-developers-request at gromacs.org.




More information about the gromacs.org_gmx-developers mailing list