[lammps-users] Lammps as a library, use of a FORTRAN driver code

Dear Lammps Users and Developers, I am in the need to call Lammps as a library from an already existent FORTRAN 77 code and I basically need to create a FORTRAN driver doing the same operations as c_driver.c included in the example directory. I know enough c++ to create my own pairwise potentials and subroutines for lammps command but I am not familiar enough with parallel FORTRAN to realize the right calls to the c++ file library.cpp and I believe that library.h needs an appropriate interface as well. I am wondering if some of you have been successfull in realizing this kind of operation and can help me with maybe an example or have already created the right fortran driver (also FORTRAN 90 / 95 could be helpfull) which you can share with me so that I can study and modify it as I need.

Thanks for your time,

Fabio Pavia
Brown University

dear fabio,

Dear Lammps Users and Developers, I am in the need to call Lammps as a
library from an already existent FORTRAN 77 code and I basically need to

fortran 77. ouch.

create a FORTRAN driver doing the same operations as c_driver.c included in
the example directory. I know enough c++ to create my own pairwise
potentials and subroutines for lammps command but I am not familiar enough
with parallel FORTRAN to realize the right calls to the c++ file
library.cpp and I believe that library.h needs an appropriate interface as

library.cpp needs to be compiled with c++ but actually defines a c interface.

well. I am wondering if some of you have been successfull in realizing this
kind of operation and can help me with maybe an example or have already
created the right fortran driver (also FORTRAN 90 / 95 could be helpfull)
which you can share with me so that I can study and modify it as I need.

the main issue is understanding the differences in data layout and
ABI between C and Fortran77 with different compilers. specifically
passing strings can be fun (with a negative coefficient).

i've done this many times with different codes, however not lammps.

the other problematic area is parallel execution. how do you plan to
handle this. having a communicator shared between C/C++ and Fortran
can be a pretty tricky thing.

you'd have to explain a bit more in detail about what the nature of your
interface is going to be and what your technical boundary conditions are.
it may be beneficial to secure the expertise of somebody locally that has
done interfacing between Fortran and C before. some of the issues are
difficult to explain via e-mail, but pretty simple.

cheers,
   axel.