Commit 83408b19 authored by sjplimp's avatar sjplimp Committed by GitHub
Browse files

Merge pull request #342 from epfl-cosmo/ipi-multiinit-bug

Bugfix in the fix_ipi initialization - prevents multiple open_socket calls
parents cd7bdf92 f3a82f45
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -219,6 +219,9 @@ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) :

  // create instance of Irregular class
  irregular = new Irregular(lmp);
  
  // yet, we have not assigned a socket
  socketflag = 0;
}

/* ---------------------------------------------------------------------- */
@@ -248,9 +251,12 @@ int FixIPI::setmask()
void FixIPI::init()
{
  //only opens socket on master process
  if (master) open_socket(ipisock, inet, port, host, error);
  else ipisock=0;
  if (master) {
	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
  // tell lammps we have assigned a socket
  socketflag = 1;

  // asks for evaluation of PE at first step
  modify->compute[modify->find_compute("thermo_pe")]->invoked_scalar = -1;
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ class FixIPI : public Fix {

 protected:
  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 reset_flag;