Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / gmxlib / orires.c
index b354453c94cc8ee9e5a9577a224648393b940fff..1d15a6a4cced171f4ff07036b3507da8aec92670 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "typedefs.h"
-#include "smalloc.h"
-#include "vec.h"
-#include "nrjac.h"
-#include "network.h"
-#include "orires.h"
-#include "do_fit.h"
-#include "main.h"
-#include "copyrite.h"
-#include "pbc.h"
-#include "mtop_util.h"
+#include "gmxpre.h"
+
+#include "gromacs/legacyheaders/orires.h"
+
+#include "gromacs/legacyheaders/copyrite.h"
+#include "gromacs/legacyheaders/main.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/linearalgebra/nrjac.h"
+#include "gromacs/math/do_fit.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/ishift.h"
+#include "gromacs/pbcutil/mshift.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 void init_orires(FILE *fplog, const gmx_mtop_t *mtop,
                  rvec xref[],
                  const t_inputrec *ir,
-                 const gmx_multisim_t *ms, t_oriresdata *od,
+                 const t_commrec *cr, t_oriresdata *od,
                  t_state *state)
 {
-    int                     i, j, d, ex, nmol, nr, *nr_ex;
+    int                     i, j, d, ex, nmol, *nr_ex;
     double                  mtot;
     rvec                    com;
     gmx_mtop_ilistloop_t    iloop;
     t_ilist                *il;
     gmx_mtop_atomloop_all_t aloop;
     t_atom                 *atom;
+    const gmx_multisim_t   *ms;
+
+    od->nr = gmx_mtop_ftype_count(mtop, F_ORIRES);
+    if (0 == od->nr)
+    {
+        /* Not doing orientation restraints */
+        return;
+    }
+
+    if (DOMAINDECOMP(cr))
+    {
+        gmx_fatal(FARGS, "Orientation restraints do not work with more than one domain (ie. MPI rank).");
+    }
+    /* Orientation restraints */
+    if (!MASTER(cr))
+    {
+        /* Nothing to do */
+        return;
+    }
+    ms = cr->ms;
 
     od->fc  = ir->orires_fc;
     od->nex = 0;
     od->S   = NULL;
-
     od->M   = NULL;
     od->eig = NULL;
     od->v   = NULL;
 
-    od->nr = gmx_mtop_ftype_count(mtop, F_ORIRES);
-    if (od->nr == 0)
-    {
-        return;
-    }
-
     nr_ex = NULL;
 
     iloop = gmx_mtop_ilistloop_init(mtop);
@@ -350,7 +366,7 @@ real calc_orires_dev(const gmx_multisim_t *ms,
     if (od->nr == 0)
     {
         /* This means that this is not the master node */
-        gmx_fatal(FARGS, "Orientation restraints are only supported on the master node, use less processors");
+        gmx_fatal(FARGS, "Orientation restraints are only supported on the master rank, use fewer ranks");
     }
 
     bTAV  = (od->edt != 0);