Re: [AMBER] NAB+fortran

From: David A. Case <case.biomaps.rutgers.edu>
Date: Thu, 9 Feb 2012 11:44:56 -0500

On Mon, Feb 06, 2012, Daniel Hollas wrote:
>
> I have a small MD code written in fortran, which uses external
> procedures to obtain forces and energies needed to popagate dynamics.
> I want to use NAB for this purpose, specifically the mme2 function (i
> need Hessian). Right now, i'm doing this by calling external bash
> script.
>
> 1) Is it somehow possible to access the nab functions in the fortran
> code directly? What would be the best way to do this?

The idea behind nab is that the "driver" (top level) code would be written
in nab, but that subroutines being called could (and often would) be written
in C or Fortran. We do this all the time.

What you seem to want is to have the Fortran code be the "driver", and to call
NAB routines from it. This is probably possible, assuming that you understand
what NAB is really doing, and how it compiles and links.

Try this: use "nab -c" on your NAB file to get the C-code it puts out. Also
use "nab -v" to see how NAB links everything together into an executable.

Once you have the "C" code, you don't need the NAB compiler anymore. You
could change the C code in lots of ways, and still have it call routines
like mme2(). The next step is to translate this "C" code to Fortran (by hand,
pretty much), then insert your fortran MD code at the appropriate place.

Bottom line: this is by no means easy, and is well outside what NAB was
designed for. But if you have some experience (especially with mixed C and
Fortran codes), and are willing and able to understand and track down complier
and linker errors (which you almost certainly will get at some point), I think
it can be done.

...good luck....dac


_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Thu Feb 09 2012 - 09:00:04 PST
Custom Search