initial commit

This commit is contained in:
ljwoods2
2024-11-12 14:30:10 -07:00
parent a445545ffb
commit 15999f6518
2 changed files with 704 additions and 101 deletions

File diff suppressed because it is too large Load Diff

View File

@ -56,6 +56,9 @@ FixStyle(imd,FixIMD);
#include <pthread.h>
#endif
/* IMDv3 session information */
struct IMDSessionInfo;
/* prototype for c wrapper that calls the real worker */
extern "C" void *fix_imd_ioworker(void *);
@ -69,8 +72,11 @@ class FixIMD : public Fix {
void init() override;
void setup(int) override;
void post_force(int) override;
void end_of_step() override;
void post_force_respa(int, int, int) override;
double memory_usage() override;
// Fix nevery at 1, use trate to skip in 'end_of_step`
int nevery = 1;
protected:
int imd_port;
@ -80,13 +86,17 @@ class FixIMD : public Fix {
int num_coords; // total number of atoms controlled by this fix
int size_one; // bytes per atom in communication buffer.
int maxbuf; // size of atom communication buffer.
void *comm_buf; // communication buffer
void *coord_data; // communication buffer for coordinates
void *vel_data; // communication buffer for velocities
void *force_data; // communication buffer for forces
void *idmap; // hash for mapping atom indices to consistent order.
tagint *rev_idmap; // list of the hash keys for reverse mapping.
int imd_forces; // number of forces communicated via IMD.
void *force_buf; // force data buffer
double imd_fscale; // scale factor for forces. in case VMD's units are off.
int imd_version; // version of the IMD protocol to be used.
int imd_forces; // number of forces communicated via IMD.
void *recv_force_buf; // force data buffer
double imd_fscale; // scale factor for forces. in case VMD's units are off.
int imd_inactive; // true if IMD connection stopped.
int imd_terminate; // true if IMD requests termination of run.
@ -96,12 +106,20 @@ class FixIMD : public Fix {
int nowait_flag; // true if LAMMPS should not wait with the execution for VMD.
int connect_msg; // flag to indicate whether a "listen for connection message" is needed.
/* IMDv3-only */
IMDSessionInfo *imdsinfo; // session information for IMDv3
int me; // my MPI rank in this "world".
int nlevels_respa; // flag to determine respa levels.
int msglen;
char *msgdata;
private:
void handle_step_v2();
void handle_client_input_v3();
void handle_output_v3();
#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