I want to create an interface between the Meta dynamics code and the LAMMPS code and both of them are written in two different languages. Meta dynamics is written in Fortran whereas LAMMPS is written in python. How to create an interface between the two?
This is not correct. LAMMPS is written in C++.
- LAMMPS already supports two different and widely use metadynamics implementations: Colvars (originally available in NAMD) and Plumed2. Before going through the pains of creating another interface to another code, you should consider using either of the existing one.
- The common ground between Fortran and C++ is the C programming language. C++ can call C functions, if properly prototyped and Fortran has the ISO_C_BINDINGS module which allows to write Fortran functions. LAMMPS has a library interface for embedding LAMMPS into other applications (including Python) on top of which there is a Fortran module, that uses this approach.
For the sake of completeness: the NumPy package has a tool, f2py, which allows building python modules which allow calling Fortran functions from Python. So theoretically it would be possible to call out from LAMMPS to Python using, e.g. fix python/move or fix python/invoke and then importing the interface to the Fortran code there and combine the two codes. However, that would be rather complex and inefficient.