On Mon, Sep 30, 2013 at 1:07 PM, Kepa K. Burusco <kekoburgo.yahoo.es> wrote:
> [30-IX-2013]
>
> Hi Jason,
>
> Thanks for your prompt answer. Actually, I only tried to "mirror" the rem
> variable because I found problems in doing it just as a new one. If there
> is a simpler way to declare my variable "myvar" as global (in md.h;
> parallel.h or any other file) and make it accesible to all the program I
> think that I would like to do that rather than editing many subrotines here
> and there.
>
> Since it is not an MPI variable, at the beginning I thought that it
> shouldn't be very difficult to create it. It is just an integer ("0" or
> "1"). And I also need it to be global because I will use it in a couple of
> subroutines in other if-statements.
>
There are two different ways to effectively declare a 'global' variable in
Fortran. The first is to add it to a common block (that is in md.h). You
will need to include that common block in any subroutine that requires
access to your variable.
The second is to use modules (that is how subroutines know about "rem", for
instance). The first is convenient particularly for MPI since common
blocks are assured to be continuous in memory, making it easier to
communicate the whole common block (that's what the BC_MDI parameter is for
-- perhaps standing for Broadcast Count of MD Integers).
If you are unfamiliar with parallel programming, this may be a complex
undertaking. Luckily the MPI API is not too complex as far as parallel
programming APIs go, but this project will likely be time-consuming.
HTH,
Jason
--
Jason M. Swails
BioMaPS,
Rutgers University
Postdoctoral Researcher
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Sep 30 2013 - 11:00:03 PDT