Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / gmxlib / orires.c
index 4ac89a04e1d699e0e1a0d640bf5cae2d375654f6..1d15a6a4cced171f4ff07036b3507da8aec92670 100644 (file)
@@ -1,82 +1,99 @@
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+/*
+ * This file is part of the GROMACS molecular simulation package.
  *
- *
- *                This source code is part of
- *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- *                        VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
  *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
  *
- * For more info, check our website at http://www.gromacs.org
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
  *
- * And Hey:
- * GROningen Mixture of Alchemy and Childrens' Stories
+ * 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);
@@ -349,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);
@@ -588,9 +605,9 @@ real calc_orires_dev(const gmx_multisim_t *ms,
 real orires(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
             const rvec x[], rvec f[], rvec fshift[],
             const t_pbc *pbc, const t_graph *g,
-            real lambda, real *dvdlambda,
-            const t_mdatoms *md, t_fcdata *fcd,
-            int *global_atom_index)
+            real gmx_unused lambda, real gmx_unused *dvdlambda,
+            const t_mdatoms gmx_unused *md, t_fcdata *fcd,
+            int gmx_unused *global_atom_index)
 {
     atom_id             ai, aj;
     int                 fa, d, i, type, ex, power, ki = CENTRAL;