integrate MDI wrapper directly into main.cpp
we can remove the header, since this dummy interface should not be used elsewhere.
This commit is contained in:
42
src/main.cpp
42
src/main.cpp
@ -14,7 +14,6 @@
|
|||||||
#include "lammps.h"
|
#include "lammps.h"
|
||||||
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "mdi_interface.h"
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
@ -27,6 +26,41 @@
|
|||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// import real or dummy calls to MolSSI Driver Interface library
|
||||||
|
#if defined(LMP_USER_MDI)
|
||||||
|
|
||||||
|
// true interface to MDI
|
||||||
|
#include <mdi.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// dummy interface to MDI
|
||||||
|
// needed for compiling when MDI is not installed
|
||||||
|
|
||||||
|
typedef int MDI_Comm;
|
||||||
|
static int MDI_Init(int *argc, char ***argv)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int MDI_Initialized(int *flag)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int MDI_MPI_get_world_comm(void *world_comm)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int MDI_Plugin_get_argc(int *argc)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int MDI_Plugin_get_argv(char ***argv)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -50,9 +84,9 @@ int main(int argc, char **argv)
|
|||||||
if (mdi_flag)
|
if (mdi_flag)
|
||||||
if (MDI_MPI_get_world_comm(&lammps_comm)) MPI_Abort(MPI_COMM_WORLD, 1);
|
if (MDI_MPI_get_world_comm(&lammps_comm)) MPI_Abort(MPI_COMM_WORLD, 1);
|
||||||
|
|
||||||
// enable trapping selected floating point exceptions.
|
// enable trapping selected floating point exceptions.
|
||||||
// this uses GNU extensions and is only tested on Linux
|
// this uses GNU extensions and is only tested on Linux
|
||||||
// therefore we make it depend on -D_GNU_SOURCE, too.
|
// therefore we make it depend on -D_GNU_SOURCE, too.
|
||||||
|
|
||||||
#if defined(LAMMPS_TRAP_FPE) && defined(_GNU_SOURCE)
|
#if defined(LAMMPS_TRAP_FPE) && defined(_GNU_SOURCE)
|
||||||
fesetenv(FE_NOMASK_ENV);
|
fesetenv(FE_NOMASK_ENV);
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
/* -*- c++ -*- ----------------------------------------------------------
|
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
|
||||||
|
|
||||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
||||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
|
||||||
certain rights in this software. This software is distributed under
|
|
||||||
the GNU General Public License.
|
|
||||||
|
|
||||||
See the README file in the top-level LAMMPS directory.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef LMP_MDI_INTERFACE_H
|
|
||||||
#define LMP_MDI_INTERFACE_H
|
|
||||||
|
|
||||||
#if defined(LMP_USER_MDI)
|
|
||||||
|
|
||||||
// true interface to MDI
|
|
||||||
// used when MDI is installed
|
|
||||||
|
|
||||||
#include "mdi.h"
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// dummy interface to MDI
|
|
||||||
// needed for compiling when MDI is not installed
|
|
||||||
|
|
||||||
typedef int MDI_Comm;
|
|
||||||
inline int MDI_Init(int* argc, char ***argv) {return 0;};
|
|
||||||
inline int MDI_Initialized(int* flag) {return 0;};
|
|
||||||
inline int MDI_MPI_get_world_comm(void* world_comm) {return 0;};
|
|
||||||
inline int MDI_Plugin_get_argc(int* argc) {return 0;};
|
|
||||||
inline int MDI_Plugin_get_argv(char*** argv) {return 0;};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user