mirror of https://github.com/lammps/lammps.git
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@6618 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
05e812d16c
commit
5b57bbd2f8
|
@ -1,7 +1,7 @@
|
|||
The files in this directory are a user-contributed package for LAMMPS.
|
||||
|
||||
The person who created these files is Axel Kohlmeyer
|
||||
(axel.kohlmeyer@temple.edu). Contact him directly if you
|
||||
(akohlmey@gmail.com). Contact him directly if you
|
||||
have questions or for example scripts that use it.
|
||||
|
||||
This package implements a "fix imd" command which can be used in a
|
||||
|
@ -9,6 +9,12 @@ LAMMPS input script. IMD stands for interactive molecular dynamics,
|
|||
and allows realtime visualization and manipulation of MD simulations
|
||||
through the IMD protocol, initially implemented in VMD and NAMD.
|
||||
|
||||
If LAMMPS is compiled with the preprocessor flag -DLAMMPS_ASYNC_IMD
|
||||
then fix imd will use posix threads to spawn a thread on MPI rank 0
|
||||
in order to offload data reading and writing from the main execution
|
||||
thread and potentiall lower the inferred latencies for slow
|
||||
communication links. This feature has only been tested under linux.
|
||||
|
||||
There are example scripts for using this package with LAMMPS in
|
||||
examples/USER/imd. Additional examples and a driver for use with the
|
||||
Novint Falcon game controller as haptic device can be found at:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
@ -52,6 +52,13 @@ FixStyle(imd,FixIMD)
|
|||
|
||||
#include "fix.h"
|
||||
|
||||
#if defined(LAMMPS_ASYNC_IMD)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
/* prototype for c wrapper that calls the real worker */
|
||||
extern "C" void *fix_imd_ioworker(void *);
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixIMD : public Fix {
|
||||
|
@ -65,7 +72,7 @@ class FixIMD : public Fix {
|
|||
void post_force_respa(int, int, int);
|
||||
double memory_usage();
|
||||
|
||||
private:
|
||||
protected:
|
||||
int imd_port;
|
||||
void *localsock;
|
||||
void *clientsock;
|
||||
|
@ -92,6 +99,21 @@ class FixIMD : public Fix {
|
|||
int me; // my MPI rank in this "world".
|
||||
int nlevels_respa; // flag to determine respa levels.
|
||||
|
||||
int msglen;
|
||||
char *msgdata;
|
||||
|
||||
#if defined(LAMMPS_ASYNC_IMD)
|
||||
int buf_has_data; // flag to indicate to the i/o thread what to do.
|
||||
pthread_mutex_t write_mutex; // mutex for sending coordinates to i/o thread
|
||||
pthread_cond_t write_cond; // conditional variable for coordinate i/o
|
||||
pthread_mutex_t read_mutex; // mutex for accessing data receieved by i/o thread
|
||||
pthread_t iothread; // thread id for i/o thread.
|
||||
pthread_attr_t iot_attr; // i/o thread attributes.
|
||||
public:
|
||||
void ioworker(void);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
int reconnect();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue