* Gromacs Runs On Most of All Computer Systems
*/
+#ifndef _constr_h
+#define _constr_h
#include "typedefs.h"
#ifdef __cplusplus
#ifdef __cplusplus
}
#endif
+#endif
* Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
*/
-
+#ifndef _gmxcpp_h
+#define _gmxcpp_h
typedef struct gmx_cpp *gmx_cpp_t;
/* The possible return codes for these functions */
NOT THREAD SAFE
*/
char *cpp_error(gmx_cpp_t *handlep,int status);
+#endif
+++ /dev/null
-/*
- *
- * 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
- * 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.
- *
- * 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.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gromacs Runs On Most of All Computer Systems
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef GROMACS_MAGIC
-#define GROMACS_MAGIC 0xff0d
-#endif
-
-#ifdef __cplusplus
-}
-#endif
extern "C" {
#endif
-gmx_bool gmx_parallel_env_initialized(void);
-/* 1 when running in a parallel environment, so could also be 1 if
- mdrun was started with: mpirun -np 1.
-
- Use this function only to check whether a parallel environment has
- been initialized, for example when checking whether gmx_finalize()
- needs to be called. Use PAR(cr) to check whether the simulation actually
- has more than one node/thread. */
-
-
void gmx_log_open(const char *fn,const t_commrec *cr,
gmx_bool bMasterOnly, unsigned long Flags, FILE**);
/* Open the log file, if necessary (nprocs > 1) the logfile name is
* (see network.h). The command line arguments are communicated so that they can be
* parsed on each processor.
* Arguments are the number of command line arguments, and a pointer to the
- * array of argument strings.
+ * array of argument strings. Both are allowed to be NULL.
*/
t_commrec *init_par_threads(const t_commrec *cro);
thread-local versions (a small memory leak results because we don't
deallocate the old shared version). */
-t_commrec *init_cr_nopar(void);
-/* Returns t_commrec for non-parallel functionality */
-
#ifdef __cplusplus
}
#endif
void gmx_abort(int nodeid,int nnodes,int errorno);
/* Abort the parallel run */
-void gmx_finalize(void);
-
+void gmx_finalize_par(void);
/* Finish the parallel run in an ordered manner */
#ifdef GMX_DOUBLE
* GRoups of Organic Molecules in ACtion for Science
*/
-#ifndef _constr_h
-#define _constr_h
+#ifndef _types_constr_h
+#define _types_constr_h
#ifdef __cplusplus
extern "C" {
* not be allocated.
*/
+#ifndef _trx_h
+#define _trx_h
+
#include "atoms.h"
-#include "../molfile_plugin.h"
-#include "../vmdio.h"
#ifdef __cplusplus
extern "C" {
#endif
+typedef struct gmxvmdplugin t_gmxvmdplugin;
+
typedef struct trxframe
{
int flags; /* flags for read_first/next_frame */
matrix box; /* the 3 box vectors */
gmx_bool bPBC;
int ePBC; /* the type of pbc */
- t_gmxvmdplugin vmdplugin;
+ t_gmxvmdplugin* vmdplugin;
} t_trxframe;
#ifdef __cplusplus
}
#endif
+#endif
}
#ifndef GMX_THREAD_MPI
- if (gmx_parallel_env_initialized())
{
int nnodes;
int noderank;
noderank = gmx_node_rank();
if (nnodes > 1)
+ {
fprintf(stderr,"Error on node %d, will try to stop all the nodes\n",
noderank);
+ }
gmx_abort(noderank,nnodes,-1);
}
- else
#endif
+
+ if (debug)
{
- if (debug)
- fflush(debug);
- if (bDebugMode()) {
- fprintf(stderr,"dump core (y/n):");
- fflush(stderr);
- if (toupper(getc(stdin))!='N')
- (void) abort();
+ fflush(debug);
+ }
+ if (bDebugMode())
+ {
+ fprintf(stderr,"dump core (y/n):");
+ fflush(stderr);
+ if (toupper(getc(stdin))!='N')
+ {
+ (void) abort();
}
}
perror(msg);
}
- if (!gmx_parallel_env_initialized())
+#ifdef GMX_THREAD_MPI
+ if (debug)
{
- if (debug)
- fflush(debug);
- if (bDebugMode()) {
- fprintf(stderr,"dump core (y/n):");
- fflush(stderr);
- if (toupper(getc(stdin))!='N')
- (void) abort();
+ fflush(debug);
+ }
+ if (bDebugMode())
+ {
+ fprintf(stderr,"dump core (y/n):");
+ fflush(stderr);
+ if (toupper(getc(stdin))!='N')
+ {
+ (void) abort();
}
}
+#endif
#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
bFinalize = TRUE;
#ifdef GMX_MPI
- if (gmx_parallel_env_initialized())
+ /* Check if we are calling on all processes in MPI_COMM_WORLD */
+ if (cr != NULL)
{
- /* Check if we are calling on all processes in MPI_COMM_WORLD */
- if (cr != NULL)
- {
- MPI_Comm_compare(cr->mpi_comm_mysim,MPI_COMM_WORLD,&result);
- }
- else
- {
- MPI_Comm_compare(dd->mpi_comm_all,MPI_COMM_WORLD,&result);
- }
- /* Any result except MPI_UNEQUAL allows us to call MPI_Finalize */
- bFinalize = (result != MPI_UNEQUAL);
+ MPI_Comm_compare(cr->mpi_comm_mysim,MPI_COMM_WORLD,&result);
}
+ else
+ {
+ MPI_Comm_compare(dd->mpi_comm_all,MPI_COMM_WORLD,&result);
+ }
+ /* Any result except MPI_UNEQUAL allows us to call MPI_Finalize */
+ bFinalize = (result != MPI_UNEQUAL);
#endif
if ((cr != NULL && MASTER(cr) ) ||
}
#ifdef GMX_MPI
- if (gmx_parallel_env_initialized())
+ if (bFinalize)
{
- if (bFinalize)
- {
- /* Broadcast the fatal error number possibly modified
- * on the master process, in case the user would like
- * to use the return status on a non-master process.
- * The master process in cr and dd always has global rank 0.
- */
- MPI_Bcast(&fatal_errno,sizeof(fatal_errno),MPI_BYTE,
- 0,MPI_COMM_WORLD);
-
- /* Finalize nicely instead of aborting */
- MPI_Finalize();
- }
- else
- {
- /* Let all other processes wait till the master has printed
- * the error message and issued MPI_Abort.
- */
- MPI_Barrier(MPI_COMM_WORLD);
- }
+ /* Broadcast the fatal error number possibly modified
+ * on the master process, in case the user would like
+ * to use the return status on a non-master process.
+ * The master process in cr and dd always has global rank 0.
+ */
+ MPI_Bcast(&fatal_errno,sizeof(fatal_errno),MPI_BYTE,
+ 0,MPI_COMM_WORLD);
+
+ /* Finalize nicely instead of aborting */
+ MPI_Finalize();
+ }
+ else
+ {
+ /* Let all other processes wait till the master has printed
+ * the error message and issued MPI_Abort.
+ */
+ MPI_Barrier(MPI_COMM_WORLD);
}
#endif
#define BUFSIZE 1024
-/* this is not strictly thread-safe, but it's only written to at the beginning
- of the simulation, once by each thread with the same value. We assume
- that writing to an int is atomic.*/
-static gmx_bool parallel_env_val;
-#ifdef GMX_THREAD_MPI
-tMPI_Thread_mutex_t parallel_env_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
-#endif
-
-
-/* returns 1 when running in a parallel environment, so could also be 1 if
- mdrun was started with: mpirun -np 1.
-
- Use this function only to check whether a parallel environment has
- been initialized, for example when checking whether gmx_finalize()
- needs to be called. Use PAR(cr) to check whether the simulation actually
- has more than one node/thread. */
-gmx_bool gmx_parallel_env_initialized(void)
-{
- gmx_bool ret;
-#ifdef GMX_THREAD_MPI
- tMPI_Thread_mutex_lock(¶llel_env_mutex);
-#endif
- ret=parallel_env_val;
-#ifdef GMX_THREAD_MPI
- tMPI_Thread_mutex_unlock(¶llel_env_mutex);
-#endif
- return ret;
-}
-
-static void set_parallel_env(gmx_bool val)
-{
-#ifdef GMX_THREAD_MPI
- tMPI_Thread_mutex_lock(¶llel_env_mutex);
-#endif
- if (!parallel_env_val)
- {
- /* we only allow it to be set, not unset */
- parallel_env_val=val;
- }
-#ifdef GMX_THREAD_MPI
- tMPI_Thread_mutex_unlock(¶llel_env_mutex);
-#endif
-}
-
static void par_fn(char *base,int ftp,const t_commrec *cr,
gmx_bool bAppendSimId,gmx_bool bAppendNodeId,
argv = *argv_ptr;
-#ifdef GMX_MPI
-#ifdef GMX_LIB_MPI
- pe = TRUE;
-#ifdef GMX_CHECK_MPI_ENV
- /* Do not use MPI calls when env.var. GMX_CHECK_MPI_ENV is not set */
- if (getenv(GMX_CHECK_MPI_ENV) == NULL)
- pe = FALSE;
-#endif /* GMX_CHECK_MPI_ENV */
-#endif /* GMX_LIB_MPI */
- set_parallel_env(pe);
- if (pe) {
- cr->sim_nodeid = gmx_setup(argc,argv,&cr->nnodes);
- } else {
- cr->nnodes = 1;
- cr->sim_nodeid = 0;
- }
-#else /* GMX_MPI */
- pe=FALSE;
- set_parallel_env(pe);
- cr->sim_nodeid = 0;
- cr->nnodes = 1;
-#endif /* GMX_MPI */
+#if defined GMX_MPI && !defined GMX_THREAD_MPI
+ cr->sim_nodeid = gmx_setup(argc,argv,&cr->nnodes);
if (!PAR(cr) && (cr->sim_nodeid != 0))
- gmx_comm("(!PAR(cr) && (cr->sim_nodeid != 0))");
-
- if (PAR(cr))
{
-#ifdef GMX_MPI
- cr->mpi_comm_mysim = MPI_COMM_WORLD;
- cr->mpi_comm_mygroup = cr->mpi_comm_mysim;
-#endif /* GMX_MPI */
+ gmx_comm("(!PAR(cr) && (cr->sim_nodeid != 0))");
}
+
+ cr->mpi_comm_mysim = MPI_COMM_WORLD;
+ cr->mpi_comm_mygroup = cr->mpi_comm_mysim;
+#else
+ /* These should never be accessed */
+ cr->mpi_comm_mysim = NULL;
+ cr->mpi_comm_mygroup = NULL;
+ cr->nnodes = 1;
+ cr->sim_nodeid = 0;
+#endif
+
cr->nodeid = cr->sim_nodeid;
cr->duty = (DUTY_PP | DUTY_PME);
/* Communicate arguments if parallel */
#ifndef GMX_THREAD_MPI
if (PAR(cr))
+ {
comm_args(cr,argc,argv_ptr);
+ }
#endif /* GMX_THREAD_MPI */
#ifdef GMX_MPI
/* and we start setting our own thread-specific values for things */
MPI_Initialized(&initialized);
if (!initialized)
+ {
gmx_comm("Initializing threads without comm");
- set_parallel_env(TRUE);
+ }
/* once threads will be used together with MPI, we'll
fill the cr structure with distinct data here. This might even work: */
cr->sim_nodeid = gmx_setup(0,NULL, &cr->nnodes);
return NULL;
#endif
}
-
-
-t_commrec *init_cr_nopar(void)
-{
- t_commrec *cr;
-
- snew(cr,1);
-
- cr->nnodes = 1;
- /* cr->nthreads = 1; */
- cr->sim_nodeid = 0;
- cr->nodeid = 0;
- /* cr->threadid = 0; */
- cr->duty = (DUTY_PP | DUTY_PME);
-
- return cr;
-}
}
-void gmx_finalize(void)
+void gmx_finalize_par(void)
{
#ifndef GMX_MPI
- gmx_call("gmx_finalize");
+ /* Compiled without MPI, no MPI finalizing needed */
+ return;
#else
- int ret;
+ int initialized,finalized;
+ int ret;
- /* just as a check; we don't want to finalize twice */
- int finalized;
- MPI_Finalized(&finalized);
- if (finalized)
- return;
+ MPI_Initialized(&initialized);
+ if (!initialized)
+ {
+ return;
+ }
+ /* just as a check; we don't want to finalize twice */
+ MPI_Finalized(&finalized);
+ if (finalized)
+ {
+ return;
+ }
/* We sync the processes here to try to avoid problems
* with buggy MPI implementations that could cause
#ifdef HAVE_SIGACTION
struct sigaction act;
act.sa_handler = signal_handler;
+ sigemptyset(&act.sa_mask);
act.sa_flags = SA_RESTART;
sigaction(signum,&act,NULL);
#else
#include <math.h>
#include "typedefs.h"
#include "smalloc.h"
+#include "vec.h"
#include "gmx_statistics.h"
-static double sqr(double x)
-{
- return x*x;
-}
-
-static int gmx_nint(double x)
+static int gmx_dnint(double x)
{
return (int) (x+0.5);
}
d2 = 0;
for(i=0; (i<N); i++)
{
- d2 += sqr(stats->x[i]-stats->y[i]);
+ d2 += dsqr(stats->x[i]-stats->y[i]);
if ((stats->dy[i]) && (weight == elsqWEIGHT_Y))
{
- w = 1/sqr(stats->dy[i]);
+ w = 1/dsqr(stats->dy[i]);
}
else
{
wtot += w;
- xx += w*sqr(stats->x[i]);
- xx_nw += sqr(stats->x[i]);
+ xx += w*dsqr(stats->x[i]);
+ xx_nw += dsqr(stats->x[i]);
- yy += w*sqr(stats->y[i]);
- yy_nw += sqr(stats->y[i]);
+ yy += w*dsqr(stats->y[i]);
+ yy_nw += dsqr(stats->y[i]);
yx += w*stats->y[i]*stats->x[i];
yx_nw += stats->y[i]*stats->x[i];
/* Compute average, sigma and error */
stats->aver = sy_nw/N;
- stats->sigma_aver = sqrt(yy_nw/N - sqr(sy_nw/N));
+ stats->sigma_aver = sqrt(yy_nw/N - dsqr(sy_nw/N));
stats->error = stats->sigma_aver/sqrt(N);
/* Compute RMSD between x and y */
yy_nw /= N;
sx_nw /= N;
sy_nw /= N;
- ssxx = N*(xx_nw - sqr(sx_nw));
- ssyy = N*(yy_nw - sqr(sy_nw));
+ ssxx = N*(xx_nw - dsqr(sx_nw));
+ ssyy = N*(yy_nw - dsqr(sy_nw));
ssxy = N*(yx_nw - (sx_nw*sy_nw));
- stats->Rdata = sqrt(sqr(ssxy)/(ssxx*ssyy));
+ stats->Rdata = sqrt(dsqr(ssxy)/(ssxx*ssyy));
/* Compute straight line through datapoints, either with intercept
zero (result in aa) or with intercept variable (results in a
{
dy = 1;
}
- chi2aa += sqr((stats->y[i]-(stats->aa*stats->x[i]))/dy);
- chi2 += sqr((stats->y[i]-(stats->a*stats->x[i]+stats->b))/dy);
+ chi2aa += dsqr((stats->y[i]-(stats->aa*stats->x[i]))/dy);
+ chi2 += dsqr((stats->y[i]-(stats->a*stats->x[i]+stats->b))/dy);
}
if (N > 2)
{
}
else
{
- nbins = gmx_nint((delta)/binwidth + 0.5);
+ nbins = gmx_dnint((delta)/binwidth + 0.5);
}
snew(*x,nbins);
snew(nindex,nbins);
chi2 = 0;
if (xd != NULL) {
for(i=0; i<n; i++)
- chi2 += sqr(yr[i] - ((*a)*xd[i] + (*b)));
+ chi2 += dsqr(yr[i] - ((*a)*xd[i] + (*b)));
} else {
for(i=0; i<n; i++)
- chi2 += sqr(yr[i] - ((*a)*xr[i] + (*b)));
+ chi2 += dsqr(yr[i] - ((*a)*xr[i] + (*b)));
}
if (n > 2)
gmx_fatal(FARGS,"Zero or negative weigths in linear regression analysis");
for (i=0; i<n; i++) {
- s_2 = sqr(1.0/dy[i]);
- sxx += s_2*sqr(x[i]);
+ s_2 = dsqr(1.0/dy[i]);
+ sxx += s_2*dsqr(x[i]);
sxy += s_2*y[i]*x[i];
- syy += s_2*sqr(y[i]);
+ syy += s_2*dsqr(y[i]);
sx += s_2*x[i];
sy += s_2*y[i];
w += s_2;
*chi2=0;
for(i=0; i<n; i++)
- *chi2+=sqr((y[i]-((*a)*x[i]+(*b)))/dy[i]);
+ *chi2+=dsqr((y[i]-((*a)*x[i]+(*b)))/dy[i]);
*chi2 = *chi2/w;
*da = sqrt(*chi2/((n-2)*dx2));
gmx_cmd(argv[1]);
}
}
- if (bExit) {
- if (gmx_parallel_env_initialized())
- /*gmx_abort(gmx_node_rank(),gmx_node_num(),0);*/
- gmx_finalize();
+ if (bExit)
+ {
+ gmx_finalize_par();
+
exit(0);
}
#undef FF
#include <ctype.h>
#include "sysstuff.h"
+#include "typedefs.h"
+#include "vmdio.h"
#include "string2.h"
#include "smalloc.h"
#include "pbc.h"
#include "confio.h"
#include "checkpoint.h"
#include "wgms.h"
-#include "vmdio.h"
#include <math.h>
/* defines for frame counter output */
return bRet;
}
-static void choose_ff(FILE *fp)
+static void choose_file_format(FILE *fp)
{
int i,m,c;
int rc;
initcount(status);
clear_mat(box);
- choose_ff(fp);
+ choose_file_format(fp);
for(m=0; (m<DIM); m++)
box[m][m]=status->BOX[m];
}
}
-static void init_ekinstate(ekinstate_t *eks)
+static void zero_ekinstate(ekinstate_t *eks)
{
eks->ekin_n = 0;
eks->ekinh = NULL;
state->sd_X = NULL;
state->cg_p = NULL;
- init_ekinstate(&state->ekinstate);
+ zero_ekinstate(&state->ekinstate);
init_energyhistory(&state->enerhist);
molfile_timestep_t ts;
- fr->bV = fr->vmdplugin.bV;
+ fr->bV = fr->vmdplugin->bV;
#ifdef GMX_DOUBLE
snew(ts.coords, fr->natoms*3);
}
#endif
- rc = fr->vmdplugin.api->read_next_timestep(fr->vmdplugin.handle, fr->natoms, &ts);
+ rc = fr->vmdplugin->api->read_next_timestep(fr->vmdplugin->handle, fr->natoms, &ts);
if (rc < -1) {
fprintf(stderr, "\nError reading input file (error code %d)\n", rc);
}
if (rc < 0)
{
- fr->vmdplugin.api->close_file_read(fr->vmdplugin.handle);
+ fr->vmdplugin->api->close_file_read(fr->vmdplugin->handle);
return 0;
}
vec[0] = .1*ts.A; vec[1] = .1*ts.B; vec[2] = .1*ts.C;
angle[0] = ts.alpha; angle[1] = ts.beta; angle[2] = ts.gamma;
matrix_convert(fr->box,vec,angle);
- if (fr->vmdplugin.api->abiversion>10)
+ if (fr->vmdplugin->api->abiversion>10)
{
fr->bTime = TRUE;
fr->time = ts.physical_time;
return 1;
}
-int load_vmd_library(const char *fn, t_gmxvmdplugin *vmdplugin)
+static int load_vmd_library(const char *fn, t_gmxvmdplugin *vmdplugin)
{
char pathname[GMX_PATH_MAX],filename[GMX_PATH_MAX];
const char *pathenv;
{
molfile_timestep_metadata_t *metadata=NULL;
- if (!load_vmd_library(fn,&(fr->vmdplugin)))
+ snew(fr->vmdplugin,1);
+ if (!load_vmd_library(fn,fr->vmdplugin))
{
return 0;
}
- fr->vmdplugin.handle = fr->vmdplugin.api->open_file_read(fn, fr->vmdplugin.filetype, &fr->natoms);
+ fr->vmdplugin->handle = fr->vmdplugin->api->open_file_read(fn, fr->vmdplugin->filetype, &fr->natoms);
- if (!fr->vmdplugin.handle) {
+ if (!fr->vmdplugin->handle) {
fprintf(stderr, "\nError: could not open file '%s' for reading.\n",
fn);
return 0;
snew(fr->x,fr->natoms);
- fr->vmdplugin.bV = 0;
- if (fr->vmdplugin.api->abiversion > 10 && fr->vmdplugin.api->read_timestep_metadata)
+ fr->vmdplugin->bV = 0;
+ if (fr->vmdplugin->api->abiversion > 10 && fr->vmdplugin->api->read_timestep_metadata)
{
- fr->vmdplugin.api->read_timestep_metadata(fr->vmdplugin.handle, metadata);
+ fr->vmdplugin->api->read_timestep_metadata(fr->vmdplugin->handle, metadata);
assert(metadata);
- fr->vmdplugin.bV = metadata->has_velocities;
- if (fr->vmdplugin.bV)
+ fr->vmdplugin->bV = metadata->has_velocities;
+ if (fr->vmdplugin->bV)
{
snew(fr->v,fr->natoms);
}
#define VMDIO_H_
#include "molfile_plugin.h"
-#include "types/simple.h"
+#include "types/trx.h"
#ifdef __cplusplus
extern "C" {
#endif
-struct trxframe;
-
-typedef struct
+struct gmxvmdplugin
{
molfile_plugin_t *api;
const char* filetype;
void* handle;
gmx_bool bV;
-} t_gmxvmdplugin;
+};
int read_first_vmd_frame(int *status,const char *fn, struct trxframe *fr,int flags);
gmx_bool read_next_vmd_frame(int status,struct trxframe *fr);
-int load_vmd_library(const char *fn, t_gmxvmdplugin *vmdplugin);
#ifdef __cplusplus
}
{
if (update_forcefield(fplog,
nfile,fnm,fr,
- mdatoms->nr,state->x,state->box)) {
- if (gmx_parallel_env_initialized())
- {
- gmx_finalize();
- }
+ mdatoms->nr,state->x,state->box))
+ {
+ gmx_finalize_par();
+
exit(0);
}
}
f,NULL,xcopy,
&(top_global->mols),mdatoms->massT,pres))
{
- if (gmx_parallel_env_initialized())
- {
- gmx_finalize();
- }
+ gmx_finalize_par();
+
fprintf(stderr,"\n");
exit(0);
}
"appropriate options have been given. Currently under",
"investigation are: polarizability and X-ray bombardments.",
"[PAR]",
- "The option [TT]-membed[dd] does what used to be g_membed, i.e. embed",
+ "The option [TT]-membed[tt] does what used to be g_membed, i.e. embed",
"a protein into a membrane. The data file should contain the options",
"that where passed to g_membed before. The [TT]-mn[tt] and [TT]-mp[tt]",
"both apply to this as well.",
nstepout,resetstep,nmultisim,repl_ex_nst,repl_ex_seed,
pforce, cpt_period,max_hours,deviceOptions,Flags);
- if (gmx_parallel_env_initialized())
- gmx_finalize();
+ gmx_finalize_par();
if (MULTIMASTER(cr)) {
thanx(stderr);
/* Check whether the box is unchanged */
-static void check_box(matrix f_box, matrix box, char fn[], warninp_t wi)
+static void check_box_unchanged(matrix f_box, matrix box, char fn[], warninp_t wi)
{
int i,ii;
gmx_bool bSame=TRUE;
read_trn(reffile, &header.step, &header.t, &header.lambda, f_box, &header.natoms, rotg->x_ref, NULL, NULL);
/* Check whether the box is unchanged and output a warning if not: */
- check_box(f_box,box,reffile,wi);
+ check_box_unchanged(f_box,box,reffile,wi);
}
else
{
for (ftype=0; (ftype < F_NRE); ftype++) {
if (interaction_function[ftype].flags & IF_BTYPE) {
pr = &(plist[ftype]);
- for (i=0; (i < pr->nr); ) {
+ j = 0;
+ for(i=0; i<pr->nr; i++) {
if ( (nshake != eshHBONDS) ||
(count_hydrogens (info,2,pr->param[i].a) > 0) ) {
/* append this bond to the shake list */
p.C0 = pr->param[i].C0;
p.C1 = pr->param[i].C2;
add_param_to_list (&(plist[F_CONSTR]),&p);
-
- /* move the last bond to this position */
- copy_bond (pr,i,pr->nr-1);
-
- /* should free memory here!! */
- pr->nr--;
+ } else {
+ copy_bond(pr,j++,i);
}
- else
- i++;
}
+ pr->nr = j;
}
}
}
#ifdef NOGMX
#define GMX_PARALLEL_ENV_INITIALIZED 1
#else
-#include "main.h"
-#define GMX_PARALLEL_ENV_INITIALIZED gmx_parallel_env_initialized()
+#ifdef GMX_MPI
+#define GMX_PARALLEL_ENV_INITIALIZED 1
+#else
+#define GMX_PARALLEL_ENV_INITIALIZED 0
+#endif
#endif
#ifdef GMX_LIB_MPI
}
-static void rotate(int x[]) {
+static void rotate_offsets(int x[]) {
int t=x[0];
/* x[0]=x[2];
x[2]=x[1];
/*input order is different for test program to match FFTW order
(important for complex to real)*/
if (plan->flags&FFT5D_BACKWARD) {
- rotate(xs);
- rotate(xl);
- rotate(xc);
- rotate(NG);
+ rotate_offsets(xs);
+ rotate_offsets(xl);
+ rotate_offsets(xc);
+ rotate_offsets(NG);
if (plan->flags&FFT5D_ORDER_YZ) {
- rotate(xs);
- rotate(xl);
- rotate(xc);
- rotate(NG);
+ rotate_offsets(xs);
+ rotate_offsets(xl);
+ rotate_offsets(xc);
+ rotate_offsets(NG);
}
}
if ((plan->flags&FFT5D_REALCOMPLEX) && ((!(plan->flags&FFT5D_BACKWARD) && s==0) || ((plan->flags&FFT5D_BACKWARD) && s==2))) {
#include <string.h>
#include "domdec.h"
#include "gmx_wallcycle.h"
+#include "gmx_cyclecounter.h"
#include "trnio.h"
#include "smalloc.h"
#include "network.h"
#include "pull_rotation.h"
#include "gmx_sort.h"
#include "copyrite.h"
-#include "gmx_cyclecounter.h"
static char *RotStr = {"Enforced rotation:"};
FILE *fplog;
/* Initiate */
- *cr = init_cr_nopar();
+ *cr = init_par(NULL,NULL);
gmx_log_open(log,*cr,FALSE,0,&fplog);
init_nrnb(&nrnb);
}
thanx(stderr);
- if (gmx_parallel_env_initialized())
- gmx_finalize();
+ gmx_finalize_par();
gmx_log_close(fplog);
fclose(fp);
}
- if (gmx_parallel_env_initialized())
- {
- gmx_finalize();
- }
+ gmx_finalize_par();
return 0;
}
"This is simple tool to compute SANS spectra using Debye formula",
"It currently uses topology file (since it need to assigne element for each atom)",
"[PAR]",
- "[TT]-pr[TT] Computes normalized g(r) function",
+ "[TT]-pr[tt] Computes normalized g(r) function",
"[PAR]",
- "[TT]-sq[TT] Computes SANS intensity curve for needed q diapason",
+ "[TT]-sq[tt] Computes SANS intensity curve for needed q diapason",
"[PAR]",
- "[TT]-startq[TT] Starting q value in nm",
+ "[TT]-startq[tt] Starting q value in nm",
"[PAR]",
- "[TT]-endq[TT] Ending q value in nm",
+ "[TT]-endq[tt] Ending q value in nm",
"[PAR]",
- "[TT]-qstep[TT] Stepping in q space",
+ "[TT]-qstep[tt] Stepping in q space",
"[PAR]",
"Note: When using Debye direct method computational cost increases as",
"1/2 * N * (N - 1) where N is atom number in group of interest"
#include "do_fit.h"
#include "rmpbc.h"
#include "wgms.h"
-#include "magic.h"
#include "pbc.h"
#include "xvgr.h"
#include "xdrf.h"
#include "do_fit.h"
#include "rmpbc.h"
#include "wgms.h"
-#include "magic.h"
#include "pbc.h"
#include "viewit.h"
#include "xvgr.h"