[gmx-developers] local and global variables

Mark Abraham mark.j.abraham at gmail.com
Mon Jul 13 12:49:42 CEST 2015


On 13 Jul 2015 8:19 am, "mah maz" <mahmaz71 at gmail.com> wrote:
>
> Dear users,
>
> How can I find out that a variable is local or global?

There are no global variables. There's no such concept when doing MPI
programming. One must explicitly communicate if you want to coordinate
agreement on a single value.

> in state.h I see rvec *x and rvec *v, however I dont know if they are
local or global.

They're fields in a struct, so neither.

> In some subroutines I notice t_state * state and t_state_global
*state_global. what's the difference between these two?

state_global is the one present on the master rank e.g. after reading the
checkpoint or tpr, or writing the output trajectory. After domain
decomposition, it is not useful until (partially) re-filled via MPI
communication when it is time to do global operations like temperature
coupling or various output. But confusingly state and state_global have the
same value if one us using a single MPI rank (= domain).

> is it possible to refer coordinates, forces and velocities to
t_state_global or they are already defined in t_state?

Depends what you are doing.

Mark

> thanks!
>
> --
> Gromacs Developers mailing list
>
> * Please search the archive at
http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List before
posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
or send a mail to gmx-developers-request at gromacs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20150713/c24e45b0/attachment-0001.html>


More information about the gromacs.org_gmx-developers mailing list