[AMBER-Developers] Fortran module for LOCMEM?

From: Joe Krahn <krahn.niehs.nih.gov>
Date: Wed, 18 Mar 2009 18:47:11 +0000

It would be nice to be able to access LOCMEM globals without recursively
passing the stack arrays from the main SANDER routine, by putting them
into a module. PUPIL already does this, but it would be better to have a
standard module, where SANDER, PUPIL and others can USE the stack arrays.

The LOCMEM module can also include memory.h, so you can access a stack
index without having to access the whole set of LOCMEM index variable names.

It is pretty simple:

#include "dprec.h"
module memory
#include "memory.h"
    _REAL_, dimension(:), allocatable :: x
    integer, dimension(:), allocatable :: ix
    character(len=4), dimension(:), allocatable :: ih
end module memory

then in sander.f
   use memory, only: x, ix, ih

and pupildata.f:
   use memory, only: ixStack=>ix, realStack=>x, ihStack=>ih

Or, skip the "only:" part, and don't #include "memory.h".

It could also be used to hold general-purpose globals that are not part
of the LOCMEM arrays. In fact, the module could be called "globals"
instead of "memory".


AMBER-Developers mailing list
Received on Fri Mar 20 2009 - 01:10:26 PDT
Custom Search