update example to use current library interface. No need to use the namespace.
This commit is contained in:
@ -28,13 +28,9 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "lammps.h" // these are LAMMPS include files
|
||||
#include "input.h"
|
||||
#include "atom.h"
|
||||
#define LAMMPS_LIB_MPI // to make lammps_open() visible
|
||||
#include "library.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
int main(int narg, char **arg)
|
||||
{
|
||||
// setup MPI and various communicators
|
||||
@ -74,7 +70,7 @@ int main(int narg, char **arg)
|
||||
char str1[32],str2[32],str3[32];
|
||||
|
||||
char **lmparg = new char*[8];
|
||||
lmparg[0] = NULL; // required placeholder for program name
|
||||
lmparg[0] = (char *) "LAMMPS"; // required placeholder for program name
|
||||
lmparg[1] = (char *) "-screen";
|
||||
sprintf(str1,"screen.%d",instance);
|
||||
lmparg[2] = str1;
|
||||
@ -86,13 +82,9 @@ int main(int narg, char **arg)
|
||||
sprintf(str3,"%g",temperature + instance*tdelta);
|
||||
lmparg[7] = str3;
|
||||
|
||||
// open N instances of LAMMPS
|
||||
// either of these methods will work
|
||||
// create N instances of LAMMPS
|
||||
|
||||
LAMMPS *lmp = new LAMMPS(8,lmparg,comm_lammps);
|
||||
|
||||
//LAMMPS *lmp;
|
||||
//lammps_open(8,lmparg,comm_lammps,(void **) &lmp);
|
||||
void *lmp = lammps_open(8,lmparg,comm_lammps,NULL);
|
||||
|
||||
delete [] lmparg;
|
||||
|
||||
@ -103,7 +95,7 @@ int main(int narg, char **arg)
|
||||
// query final temperature and print result for each instance
|
||||
|
||||
double *ptr = (double *)
|
||||
lammps_extract_compute(lmp,(char *) "thermo_temp",0,0);
|
||||
lammps_extract_compute(lmp,"thermo_temp",LMP_STYLE_GLOBAL,LMP_TYPE_SCALAR);
|
||||
double finaltemp = *ptr;
|
||||
|
||||
double *temps = new double[ninstance];
|
||||
@ -125,7 +117,7 @@ int main(int narg, char **arg)
|
||||
|
||||
// delete LAMMPS instances
|
||||
|
||||
delete lmp;
|
||||
lammps_close(lmp);
|
||||
|
||||
// close down MPI
|
||||
|
||||
|
||||
Reference in New Issue
Block a user