Merge branch 'release-4-5-patches'
authorRossen Apostolov <rossen@cbr.su.se>
Tue, 7 Sep 2010 13:19:40 +0000 (15:19 +0200)
committerRossen Apostolov <rossen@cbr.su.se>
Tue, 7 Sep 2010 13:19:40 +0000 (15:19 +0200)
1  2 
src/kernel/runner.c
src/mdlib/minimize.c

diff --combined src/kernel/runner.c
index ba6e24b4c7fb7ec20ecae6e9ff6010747ca995fe,6e04582041222199ce534cadd32834593dff72ab..d40bc968777486ae7117cd232aed94851e8fbebf
@@@ -72,7 -72,6 +72,7 @@@
  #include "sighandler.h"
  #include "tpxio.h"
  #include "txtdump.h"
 +#include "gmx_membed.h"
  
  #include "md_openmm.h"
  
@@@ -353,7 -352,6 +353,7 @@@ int mdrunner(int nthreads_requested, FI
      gmx_edsam_t ed=NULL;
      t_commrec   *cr_old=cr; 
      int         nthreads=1;
 +    gmx_membed_t *membed=NULL;
  
      /* CAUTION: threads may be started later on in this function, so
         cr doesn't reflect the final parallel state right now */
      }
      /* END OF CAUTION: cr is now reliable */
  
 +    /* g_membed initialisation *
 +     * Because we change the mtop, init_membed is called before the init_parallel *
 +     * (in case we ever want to make it run in parallel) */
 +    if (opt2bSet("-membed",nfile,fnm))
 +    {
 +      fprintf(stderr,"Entering membed code");
 +        snew(membed,1);
 +        init_membed(fplog,membed,nfile,fnm,mtop,inputrec,state,cr,&cpt_period);
 +    }
 +
      if (PAR(cr))
      {
          /* now broadcast everything to the non-master nodes/threads: */
          fprintf(stderr,"Loaded with Money\n\n");
      }
  
-     if (PAR(cr) && !((Flags & MD_PARTDEC) || EI_TPI(inputrec->eI)))
+     if (PAR(cr) && !((Flags & MD_PARTDEC) ||
+                      EI_TPI(inputrec->eI) ||
+                      inputrec->eI == eiNM))
      {
          cr->dd = init_domain_decomposition(fplog,cr,Flags,ddxyz,rdd,rconstr,
                                             dddlb_opt,dlb_scale,
                                        fcd,state,
                                        mdatoms,nrnb,wcycle,ed,fr,
                                        repl_ex_nst,repl_ex_seed,
 +                                      membed,
                                        cpt_period,max_hours,
                                        deviceOptions,
                                        Flags,
      finish_run(fplog,cr,ftp2fn(efSTO,nfile,fnm),
                 inputrec,nrnb,wcycle,&runtime,
                 EI_DYNAMICS(inputrec->eI) && !MULTISIM(cr));
 +    
 +    if (opt2bSet("-membed",nfile,fnm))
 +    {
 +        sfree(membed);
 +    }
  
      /* Does what it says */  
      print_date_and_time(fplog,cr->nodeid,"Finished mdrun",&runtime);
diff --combined src/mdlib/minimize.c
index ffda4608d5724ba54be7f9a46af4e9b24586ad7d,588544caf74446180f237dbc56dd5150a9cfae10..ebc766cbc8c9c34f9087e99637f90a0f03d70e6e
@@@ -75,7 -75,6 +75,7 @@@
  #include "mtop_util.h"
  #include "gmxfio.h"
  #include "pme.h"
 +#include "gmx_membed.h"
  
  typedef struct {
    t_state s;
@@@ -407,8 -406,11 +407,11 @@@ void init_em(FILE *fplog,const char *ti
      snew(*enerd,1);
      init_enerdata(top_global->groups.grps[egcENER].nr,ir->n_flambda,*enerd);
  
-     /* Init bin for energy stuff */
-     *mdebin = init_mdebin((*outf)->fp_ene,top_global,ir,NULL); 
+     if (mdebin != NULL)
+     {
+         /* Init bin for energy stuff */
+         *mdebin = init_mdebin((*outf)->fp_ene,top_global,ir,NULL); 
+     }
  
      clear_rvec(mu_tot);
      calc_shifts(ems->s.box,fr->shift_vec);
@@@ -876,7 -878,6 +879,7 @@@ double do_cg(FILE *fplog,t_commrec *cr
               gmx_edsam_t ed,
               t_forcerec *fr,
               int repl_ex_nst,int repl_ex_seed,
 +             gmx_membed_t *membed,
               real cpt_period,real max_hours,
               const char *deviceOptions,
               unsigned long Flags,
@@@ -1397,7 -1398,6 +1400,7 @@@ double do_lbfgs(FILE *fplog,t_commrec *
                  gmx_edsam_t ed,
                  t_forcerec *fr,
                  int repl_ex_nst,int repl_ex_seed,
 +                gmx_membed_t *membed,
                  real cpt_period,real max_hours,
                  const char *deviceOptions,
                  unsigned long Flags,
@@@ -2032,7 -2032,6 +2035,7 @@@ double do_steep(FILE *fplog,t_commrec *
                  gmx_edsam_t ed,
                  t_forcerec *fr,
                  int repl_ex_nst,int repl_ex_seed,
 +                gmx_membed_t *membed,
                  real cpt_period,real max_hours,
                  const char *deviceOptions,
                  unsigned long Flags,
@@@ -2237,13 -2236,11 +2240,12 @@@ double do_nm(FILE *fplog,t_commrec *cr
               gmx_edsam_t ed,
               t_forcerec *fr,
               int repl_ex_nst,int repl_ex_seed,
 +             gmx_membed_t *membed,
               real cpt_period,real max_hours,
               const char *deviceOptions,
               unsigned long Flags,
               gmx_runtime_t *runtime)
  {
-     t_mdebin   *mdebin;
      const char *NM = "Normal Mode Analysis";
      gmx_mdoutf_t *outf;
      int        natoms,atom,d;
              state_global,top_global,state_work,&top,
              &f,&f_global,
              nrnb,mu_tot,fr,&enerd,&graph,mdatoms,&gstat,vsite,constr,
-             nfile,fnm,&outf,&mdebin);
+             nfile,fnm,&outf,NULL);
      
      natoms = top_global->natoms;
      snew(fneg,natoms);
      
      if (MASTER(cr)) 
      {
-         print_ebin(NULL,FALSE,FALSE,FALSE,fplog,atom,t,eprAVER,
-                    FALSE,mdebin,fcd,&(top_global->groups),&(inputrec->opts));
-       
          fprintf(stderr,"\n\nWriting Hessian...\n");
          gmx_mtxio_write(ftp2fn(efMTX,nfile,fnm),sz,sz,full_matrix,sparse_matrix);
      }