Skip to content
Snippets Groups Projects
Commit f3a82f45 authored by Michele Ceriotti's avatar Michele Ceriotti
Browse files

Included a flag to prevent multiple open_socket calls if run is included...

Included a flag to prevent multiple open_socket calls if run is included multiple times in the LAMMPS input
parent c31f1e9f
No related branches found
No related tags found
No related merge requests found
...@@ -219,6 +219,9 @@ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) : ...@@ -219,6 +219,9 @@ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) :
// create instance of Irregular class // create instance of Irregular class
irregular = new Irregular(lmp); irregular = new Irregular(lmp);
// yet, we have not assigned a socket
socketflag = 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
...@@ -248,9 +251,12 @@ int FixIPI::setmask() ...@@ -248,9 +251,12 @@ int FixIPI::setmask()
void FixIPI::init() void FixIPI::init()
{ {
//only opens socket on master process //only opens socket on master process
if (master) open_socket(ipisock, inet, port, host, error); if (master) {
else ipisock=0; if (!socketflag) open_socket(ipisock, inet, port, host, error);
} else ipisock=0;
//! should check for success in socket opening -- but the current open_socket routine dies brutally if unsuccessful //! should check for success in socket opening -- but the current open_socket routine dies brutally if unsuccessful
// tell lammps we have assigned a socket
socketflag = 1;
// asks for evaluation of PE at first step // asks for evaluation of PE at first step
modify->compute[modify->find_compute("thermo_pe")]->invoked_scalar = -1; modify->compute[modify->find_compute("thermo_pe")]->invoked_scalar = -1;
......
...@@ -35,7 +35,7 @@ class FixIPI : public Fix { ...@@ -35,7 +35,7 @@ class FixIPI : public Fix {
protected: protected:
char *host; int port; int inet, master, hasdata; char *host; int port; int inet, master, hasdata;
int ipisock, me; double *buffer; long bsize; int ipisock, me, socketflag; double *buffer; long bsize;
int kspace_flag; int kspace_flag;
int reset_flag; int reset_flag;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment