Signal handling is now enabled for the openmm platform.
authorRossen Apostolov <rossen@cbr.su.se>
Wed, 24 Mar 2010 13:27:20 +0000 (14:27 +0100)
committerRossen Apostolov <rossen@cbr.su.se>
Wed, 24 Mar 2010 13:27:20 +0000 (14:27 +0100)
src/kernel/md_openmm.c
src/kernel/openmm_wrapper.cpp
src/kernel/runner.c

index d5a357f1fc8c8acb8dd16b2229ea9a6f1898c792..9a0919fc70f1ef0d8d48488cde968f984aa35e52 100644 (file)
@@ -150,9 +150,7 @@ static void init_global_signals(globsig_t *gs,const t_commrec *cr,
 {
     int i;
 
-    {
-        gs->nstms = 1;
-    }
+    gs->nstms = 1;
 
     for(i=0; i<eglsNR; i++)
     {
@@ -423,7 +421,7 @@ double do_md_openmm(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
         bLastStep = (step_rel == ir->nsteps);
         t = t0 + step*ir->delta_t;
 
-        if (gs.set[eglsTERM] > 0 )
+        if (gs.set[eglsTERM] != 0 )
         {
             bLastStep = TRUE;
         }
@@ -532,36 +530,35 @@ double do_md_openmm(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
             (handledSignal!=last_signal_number_recvd) &&
             MASTERTHREAD(cr))
         {
-            if (bGotStopNextStepSignal || ir->nstlist == 0)
+            if (bGotStopNextStepSignal)
             {
-                gs.sig[eglsTERM] = 1;
+                gs.set[eglsTERM] = 1;
             }
             else
             {
-                gs.sig[eglsTERM] = -1;
+                gs.set[eglsTERM] = -1;
             }
             if (fplog)
             {
                 fprintf(fplog,
                         "\n\nReceived the %s signal, stopping at the next %sstep\n\n",
                         signal_name[last_signal_number_recvd], 
-                        gs.sig[eglsTERM]==-1 ? "NS " : "");
+                        gs.set[eglsTERM]==-1 ? "NS " : "");
                 fflush(fplog);
             }
             fprintf(stderr,
                     "\n\nReceived the %s signal, stopping at the next %sstep\n\n",
                     signal_name[last_signal_number_recvd], 
-                    gs.sig[eglsTERM]==-1 ? "NS " : "");
+                    gs.set[eglsTERM]==-1 ? "NS " : "");
             fflush(stderr);
             handledSignal=last_signal_number_recvd;
         }
-
         else if (MASTER(cr) &&
                  (max_hours > 0 && run_time > max_hours*60.0*60.0*0.99) &&
-                 gs.sig[eglsTERM] == 0)
+                 gs.set[eglsTERM] == 0)
         {
             /* Signal to terminate the run */
-            gs.sig[eglsTERM] = 1;
+            gs.set[eglsTERM] = 1;
             if (fplog)
             {
                 fprintf(fplog,"\nStep %s: Run time exceeded %.3f hours, will terminate the run\n",gmx_step_str(step,sbuf),max_hours*0.99);
@@ -576,7 +573,7 @@ double do_md_openmm(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
                             run_time >= nchkpt*cpt_period*60.0)) &&
             gs.set[eglsCHKPT] == 0)
         {
-            gs.sig[eglsCHKPT] = 1;
+            gs.set[eglsCHKPT] = 1;
         }
   
          
index 50f8f970bbe4965c538ea8292137217ed1d0ed19..53b69179c35b2c75a59581da5c91ab1119104774 100644 (file)
@@ -334,15 +334,22 @@ void checkGmxOptions(t_inputrec *ir, gmx_localtop_t *top)
     }
 
     /* Electroctstics */
-    if ((ir->coulombtype != eelPME) && (ir->coulombtype != eelRF) &&  (ir->coulombtype != eelEWALD))
+    if (
+         (ir->coulombtype != eelPME) && 
+         (ir->coulombtype != eelRF) &&  
+         (ir->coulombtype != eelEWALD) &&
+         // no-cutoff
+         ( !(ir->coulombtype == eelCUT && ir->rcoulomb == 0 &&  ir->rvdw == 0))
+       )
     {
         gmx_fatal(FARGS,"OpenMM supports only the following methods for electrostatics: NoCutoff (i.e. rcoulomb = rvdw = 0 ),Reaction-Field, Ewald or PME.\n");
     }
 
-    if ( (ir->etc != etcNO) && (ir->etc != etcANDERSEN) && (ir->etc != etcANDERSENINTERVAL))
-        gmx_fatal(FARGS,"In OpenMM temperature coupling can be achieved by "
-                "using either \n\t(1)\t\"md-vv\" or \"md-vvak\" integrators with \"andersen\" or "
-                "\"andersen-interval\" thermostat, or \n\t(2)\t\"sd\",\"sd1\" or \"bd\" integrators\n");
+    if ( (ir->etc != etcNO) &&
+         (ir->eI !=  eiSD1)  && 
+         (ir->eI !=  eiSD2)  && 
+         (ir->eI !=  eiBD) ) 
+        gmx_warning("OpenMM supports only Andersen thermostat with the md-vv/md-vvak integrators\n");
 
     if (ir->opts.ngtc > 1)
         gmx_fatal(FARGS,"OpenMM does not support multiple temperature coupling groups.\n");
@@ -356,7 +363,7 @@ void checkGmxOptions(t_inputrec *ir, gmx_localtop_t *top)
     if (ir->eConstrAlg != econtSHAKE)
         gmx_warning("Constraints in OpenMM are done by a combination "
                 "of SHAKE, SETTLE and CCMA. Accuracy is based on the SHAKE tolerance set "
-                "by the \"shake_tol\" option.");
+                "by the \"shake_tol\" option.\n");
 
     if (ir->nwall != 0)
         gmx_fatal(FARGS,"OpenMM does not support walls.\n");
@@ -700,7 +707,7 @@ void* openmm_init(FILE *fplog, const char *platformOptStr,
     Integrator* integ;
     if (ir->eI == eiVV || ir->eI == eiVVAK) {
         integ = new VerletIntegrator(ir->delta_t);
-        if ( ir->etc == etcANDERSEN) {
+        if ( ir->etc != etcNO) {
            real collisionFreq = ir->opts.tau_t[0] / 1000; /* tau_t (ps) / 1000 = collisionFreq (fs^-1) */
            AndersenThermostat* thermostat = new AndersenThermostat(ir->opts.ref_t[0], friction); /* TODO test this  */
            sys->addForce(thermostat);
index 1330d84dc0be8459b9b753b25fdf1f7e41d23707..7f6df5b71b0fe25473c912e47db92f274027714c 100644 (file)
@@ -634,7 +634,8 @@ int mdrunner(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
     }
 
 
-    if (integrator[inputrec->eI].func == do_md)
+    if ( (integrator[inputrec->eI].func == do_md) || 
+       (integrator[inputrec->eI].func == do_md_openmm))
     {
         /* Turn on signal handling on all nodes */
         /*