# Cmake modules/macros are in a subdirectory to keep this file cleaner
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
set(CMAKE_INSTALL_PREFIX "/usr/local/gromacs" CACHE STRING "Installation prefix (installation will need write permissions here)" FORCE)
endif()
enable_language(C)
+set(GMX_USE_RELATIVE_INSTALL_PATH OFF CACHE STRING "Use relative paths not absolute paths for cmake install. Has only an effect on cpack.")
+mark_as_advanced(GMX_USE_RELATIVE_INSTALL_PATH)
+
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_VENDOR "gromacs.org")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gromacs - a toolkit for high-performance molecular simulation")
-set(CPACK_SET_DESTDIR "ON")
+if (NOT GMX_USE_RELATIVE_INSTALL_PATH)
+ set(CPACK_SET_DESTDIR "ON")
+endif()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/admin/InstallWelcome.txt")
# Its GPL/LGPL, so they do not have to agree to a license for mere usage, but some installers require this...
set(GMX_X11 OFF CACHE BOOL "X11 not compatible with BlueGene, disabled!" FORCE)
set(GMX_THREAD_MPI OFF CACHE BOOL "Thread-MPI not compatible with BlueGene, disabled!" FORCE)
set(GMX_MPI ON CACHE BOOL "Use MPI on BlueGene" FORCE)
+# Access to /etc/passwd is not available on the back end of BlueGene,
+# despite being detected by CMake. This can cause linker warnings
+# about harmless things in src/gmxlib/string2.h.
+ set(HAVE_PWD_H OFF)
+# The automatic testing for endianness does not work for the BlueGene cross-compiler
+ set(GMX_IEEE754_BIG_ENDIAN_BYTE_ORDER 1 CACHE INTERNAL "BlueGene has big endian FP byte order (by default)" FORCE)
+ set(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER 1 CACHE INTERNAL "BlueGene has big endian FP word order (by default)" FORCE)
elseif(${GMX_ACCELERATION} STREQUAL "POWER6")
set(GMX_POWER6 1)
set(GMX_SOFTWARE_INVSQRT OFF CACHE BOOL "Do not use software reciprocal square root on Power6" FORCE)
########################################################################
# Specify install locations and which subdirectories to process #
########################################################################
-if ( DEFINED GMXLIB )
- set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${GMXLIB}")
+if (GMX_USE_RELATIVE_INSTALL_PATH)
+ set(GMX_INSTALL_PREFIX "" CACHE STRING "Prefix gets appended to CMAKE_INSTALL_PREFIX. For cpack it sets the root folder of the archive.")
+ mark_as_advanced(GMX_INSTALL_PREFIX)
else()
- set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
+ set(GMX_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
+endif()
+
+if ( NOT DEFINED GMXLIB )
+ set(GMXLIB lib)
endif()
-set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
-set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/gromacs)
-set(MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/man)
-set(INCL_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include)
+set(LIB_INSTALL_DIR "${GMX_INSTALL_PREFIX}${GMXLIB}")
+set(BIN_INSTALL_DIR ${GMX_INSTALL_PREFIX}bin)
+set(DATA_INSTALL_DIR ${GMX_INSTALL_PREFIX}share/gromacs)
+set(MAN_INSTALL_DIR ${GMX_INSTALL_PREFIX}share/man)
+set(INCL_INSTALL_DIR ${GMX_INSTALL_PREFIX}include)
set(GMXLIBDIR ${DATA_INSTALL_DIR}/top)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
- set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}")
+ set(CMAKE_INSTALL_RPATH "\\\$ORIGIN/../${GMXLIB}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
g_rdf|calculates radial distribution functions
g_rotacf|calculates the rotational correlation function for molecules
g_rotmat|plots the rotation matrix for fitting to a reference structure
+g_sans|computes the small angle neutron scattering spectra
g_traj|plots x, v, f, box, temperature and rotational energy
g_vanhove|calculates Van Hove displacement functions
END
HEAD|Kinetic properties
g_bar|calculates free energy difference estimates through Bennett's acceptance ratio
g_current|calculate current autocorrelation function of system
+g_dos|analyzes density of states and properties based on that
+g_dyecoupl|extracts dye dynamics from trajectories
+g_kinetics|analyzes kinetic constants from properties based on the Eyring model
g_principal|calculate principal axes of inertion for a group of atoms
g_tcaf|calculates viscosities of liquids
g_traj|plots x, v, f, box, temperature and rotational energy
int xtc_seek_frame(t_fileio *fio, int frame, int natoms);
-int xtc_seek_time(t_fileio *fio, real time, int natoms);
+int xtc_seek_time(t_fileio *fio, real time, int natoms,gmx_bool bSeekForwardOnly);
/* Add this to the comment string for debugging */
float xdr_xtc_estimate_dt(FILE *fp, XDR *xdrs, int natoms, gmx_bool * bOK);
-int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms);
+ int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms,gmx_bool bSeekForwardOnly);
int xdr_xtc_seek_frame(int frame, FILE *fp, XDR *xdrs, int natoms);
return ret;
}
-int xtc_seek_time(t_fileio *fio, real time, int natoms)
+int xtc_seek_time(t_fileio *fio, real time, int natoms,gmx_bool bSeekForwardOnly)
{
int ret;
gmx_fio_lock(fio);
- ret=xdr_xtc_seek_time(time, fio->fp, fio->xdr, natoms);
+ ret=xdr_xtc_seek_time(time, fio->fp, fio->xdr, natoms, bSeekForwardOnly);
gmx_fio_unlock(fio);
return ret;
-int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms)
+int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms,gmx_bool bSeekForwardOnly)
{
float t;
float dt;
int res;
int dt_sign = 0;
+ if (bSeekForwardOnly)
+ {
+ low = gmx_ftell(fp);
+ }
if (gmx_fseek(fp,0,SEEK_END))
{
return -1;
/* round to int */
high /= XDR_INT_SIZE;
high *= XDR_INT_SIZE;
- offset = ((high / 2) / XDR_INT_SIZE) * XDR_INT_SIZE;
+ offset = (((high-low) / 2) / XDR_INT_SIZE) * XDR_INT_SIZE;
if (gmx_fseek(fp,offset,SEEK_SET))
{
conv.d=x;
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER
+ /* In release-4-6 and later branches, only the test for
+ * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
hx=conv.i[0];
#else
hx=conv.i[1];
conv.d = x;
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER
+ /* In release-4-6 and later branches, only the test for
+ * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
conv.i[1] = 0;
#else
conv.i[0] = 0;
conv.d = x;
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER
+ /* In release-4-6 and later branches, only the test for
+ * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
hx=conv.i[0];
#else
hx=conv.i[1];
conv.d = x;
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER
+ /* In release-4-6 and later branches, only the test for
+ * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
conv.i[1] = 0;
#else
conv.i[0] = 0;
{
gmx_ana_index_reserve(sel->child->v.u.g, gmin->isize);
gmx_ana_index_copy(sel->child->v.u.g, gmin, FALSE);
- if (sel->child->u.cgrp.isize > 0)
+ if (sel->child->u.cgrp.nalloc_index > 0)
{
+ /* Keep the name as in evaluate_boolean_static_part(). */
+ char *name = sel->child->u.cgrp.name;
gmx_ana_index_reserve(&sel->child->u.cgrp, gmin->isize);
gmx_ana_index_copy(&sel->child->u.cgrp, gmin, FALSE);
+ sel->child->u.cgrp.name = name;
+ }
+ else
+ {
+ sel->child->u.cgrp.isize = sel->child->v.u.g->isize;
}
}
break;
char line[STRLEN];
gmx_structurefactors *gsf;
double a1,a2,a3,a4,b1,b2,b3,b4,c;
- int n,p;
+ int p;
int i;
int nralloc=10;
int line_no;
char atomn[32];
fp=libopen(datfn);
line_no = 0;
-
snew(gsf,1);
snew(gsf->atomnm,nralloc);
snew(gsf->a,nralloc);
snew(gsf->b,nralloc);
snew(gsf->c,nralloc);
- snew(gsf->n,nralloc);
snew(gsf->p,nralloc);
+ gsf->n=NULL;
gsf->nratoms=line_no;
while(get_a_line(fp,line,STRLEN)) {
i=line_no;
- if (sscanf(line,"%s %d %d %lf %lf %lf %lf %lf %lf %lf %lf %lf",
- atomn,&p,&n,&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&c) == 12) {
+ if (sscanf(line,"%s %d %lf %lf %lf %lf %lf %lf %lf %lf %lf",
+ atomn,&p,&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&c) == 11) {
gsf->atomnm[i]=strdup(atomn);
- gsf->n[i]=n;
gsf->p[i]=p;
snew(gsf->a[i],4);
snew(gsf->b[i],4);
srenew(gsf->a,nralloc);
srenew(gsf->b,nralloc);
srenew(gsf->c,nralloc);
- srenew(gsf->n,nralloc);
srenew(gsf->p,nralloc);
}
}
srenew(gsf->a,gsf->nratoms);
srenew(gsf->b,gsf->nratoms);
srenew(gsf->c,gsf->nratoms);
- srenew(gsf->n,gsf->nratoms);
srenew(gsf->p,gsf->nratoms);
fclose(fp);
sfree(sf->b);
sfree(sf->atomnm);
sfree(sf->p);
- sfree(sf->n);
sfree(sf->c);
sfree(sf);
* accuracy of the control over -b and -e options.
*/
if (bTimeSet(TBEGIN) && (fr->time < rTimeValue(TBEGIN))) {
- if (xtc_seek_time(status->fio, rTimeValue(TBEGIN),fr->natoms)) {
- gmx_fatal(FARGS,"Specified frame doesn't exist or file not seekable");
+ if (xtc_seek_time(status->fio, rTimeValue(TBEGIN),fr->natoms,TRUE)) {
+ gmx_fatal(FARGS,"Specified frame (time %f) doesn't exist or file corrupt/inconsistent.",
+ rTimeValue(TBEGIN));
}
initcount(status);
}
if (bRM && ((tern >= 0 && ntdb[tern] == NULL) ||
(terc >= 0 && ctdb[terc] == NULL))) {
- gmx_fatal(FARGS,"There is a dangling bond at at least one of the terminal ends and the force field does not provide terminal entries or files. Edit a .n.tdb and/or .c.tdb file.");
+ gmx_fatal(FARGS,"There is a dangling bond at at least one of the terminal ends and the force field does not provide terminal entries or files. Fix your terminal residues so that they match the residue database (.rtp) entries, or provide terminal database entries (.tdb).");
}
if (bRM && ((tern >= 0 && ntdb[tern]->nhack == 0) ||
(terc >= 0 && ctdb[terc]->nhack == 0))) {
- gmx_fatal(FARGS,"There is a dangling bond at at least one of the terminal ends. Select a proper terminal entry.");
+ gmx_fatal(FARGS,"There is a dangling bond at at least one of the terminal ends. Fix your coordinate file, add a new terminal database entry (.tdb), or select the proper existing terminal entry.");
}
}
if (cr->nnodes <= 18)
{
cr->npmenodes = 0;
+ if (fplog)
+ {
+ fprintf(fplog,"Using %d separate PME nodes, as there are too few total\n nodes for efficient splitting\n",cr->npmenodes);
+ }
}
else
{
cr->npmenodes = guess_npme(fplog,mtop,ir,box,cr->nnodes);
+ if (fplog)
+ {
+ fprintf(fplog,"Using %d separate PME nodes, as guessed by mdrun\n",cr->npmenodes);
+ }
}
}
- if (fplog)
+ else
{
- fprintf(fplog,"Using %d separate PME nodes\n",cr->npmenodes);
+ if (fplog)
+ {
+ fprintf(fplog,"Using %d separate PME nodes, per user request\n",cr->npmenodes);
+ }
}
}
md->dhc=NULL;
if (ir->fepvals->separate_dhdl_file == esepdhdlfileNO )
{
- snew(md->dhc, 1);
+ /* Currently dh histograms are only written with dynamics */
+ if (EI_DYNAMICS(ir->eI))
+ {
+ snew(md->dhc, 1);
- mde_delta_h_coll_init(md->dhc, ir);
+ mde_delta_h_coll_init(md->dhc, ir);
+ }
md->fp_dhdl = NULL;
}
else
int start,end,number_steps;
gmx_mdoutf_t *outf;
int i,k,m,n,nfmax,gf,step;
+ int mdof_flags;
/* not used */
real terminate;
do_x = do_per_step(step,inputrec->nstxout);
do_f = do_per_step(step,inputrec->nstfout);
- write_traj(fplog,cr,outf,MDOF_X | MDOF_F,
+ mdof_flags = 0;
+ if (do_x)
+ {
+ mdof_flags |= MDOF_X;
+ }
+
+ if (do_f)
+ {
+ mdof_flags |= MDOF_F;
+ }
+
+ write_traj(fplog,cr,outf,mdof_flags,
top_global,step,(real)step,state,state,f,f,NULL,NULL);
/* Do the linesearching in the direction dx[point][0..(n-1)] */
rrpr = rijx*tx+rijy*ty+rijz*tz;
if (rrpr < toler*mytol)
- error=ll;
+ error=ll+1;
else {
acor = omega*diff*m2[ll]/rrpr;
lagr[ll] += acor;
foreach(TOOL ${GMX_TOOLS_PROGRAMS} ${GMX_TOOLS_PROGRAMS_NOT_FOR_INSTALLATION})
add_executable(${TOOL} ${TOOL}.c)
- gmx_add_man_page(${TOOL})
+ if (NOT ${TOOL} STREQUAL "g_options")
+ gmx_add_man_page(${TOOL})
+ endif()
target_link_libraries(${TOOL} gmxana)
set_target_properties(${TOOL} PROPERTIES OUTPUT_NAME "${TOOL}${GMX_BINARY_SUFFIX}")
endforeach(TOOL ${GMX_TOOLS_PROGRAMS})
grpa,hb->a.grp[ia],a+1);
if (bMerge)
- if ((daSwap = isInterchangable(hb, d, a, grpd, grpa) || bContact) && d>a)
+ {
+
+ if (isInterchangable(hb, d, a, grpd, grpa) && d>a)
/* Then swap identity so that the id of d is lower then that of a.
*
* This should really be redundant by now, as is_hbond() now ought to return
* hbNo in the cases where this conditional is TRUE. */
{
+ daSwap = TRUE;
k = d;
d = a;
a = k;
gmx_fatal(FARGS,"Inconsistent acceptor groups, %d iso %d, atom %d",
grpa,hb->a.grp[ia],a+1);
}
+ }
if (hb->hbmap) {
/* Loop over hydrogens to find which hydrogen is in this particular HB */
rvec_sub(x[d],x[a],r_da);
/* Insert projection code here */
- /* if (d>a && ((isInterchangable(hb, d, a, grpd, grpa) && bMerge) || bContact)) */
-/* /\* Then this hbond will be found again, or it has already been found. *\/ */
-/* return hbNo; */
-
+ if (bMerge && d>a && isInterchangable(hb, d, a, grpd, grpa))
+ {
+ /* Then this hbond/contact will be found again, or it has already been found. */
+ /*return hbNo;*/
+ }
if (bBox){
- if (d>a && bMerge && (bContact || isInterchangable(hb, d, a, grpd, grpa))) { /* acceptor is also a donor and vice versa? */
+ if (d>a && bMerge && isInterchangable(hb, d, a, grpd, grpa)) { /* acceptor is also a donor and vice versa? */
/* return hbNo; */
daSwap = TRUE; /* If so, then their history should be filed with donor and acceptor swapped. */
}
rda2 = iprod(r_da,r_da);
if (bContact) {
- if (daSwap)
+ if (daSwap && grpa == grpd)
return hbNo;
if (rda2 <= rc2){
if (hb->bGem){
fprintf(stderr, "%-7i",data[i]);
}
-static void normalizeACF(real *ct, real *gt, int len)
+static void normalizeACF(real *ct, real *gt, int nhb, int len)
{
real ct_fac, gt_fac;
int i;
/* Xu and Berne use the same normalization constant */
ct_fac = 1.0/ct[0];
- gt_fac = (gt!=NULL && gt[0]!=0) ? 1.0/gt[0] : 0;
+ gt_fac = (nhb == 0) ? 0 : 1.0/(real)nhb;
+
printf("Normalization for c(t) = %g for gh(t) = %g\n",ct_fac,gt_fac);
for (i=0; i<len; i++)
{
{
sfree(dondata);
}
-
- normalizeACF(ct, NULL, nn);
+ normalizeACF(ct, NULL, 0, nn);
snew(ctdouble, nn);
snew(timedouble, nn);
for (j=0; j<nn; j++)
sfree(dondata);
}
- normalizeACF(ct, NULL, nn);
+ normalizeACF(ct, NULL, 0, nn);
fprintf(stderr, "\n\nACF successfully calculated.\n");
fprintf(stderr,"\n");
sfree(h);
sfree(g);
- normalizeACF(ct, gt, nn);
+ normalizeACF(ct, ght, nhb, nn);
/* Determine tail value for statistics */
tail = 0;
int id,ia,hh,x,y;
mat.nx=nframes;
- mat.ny=(bContact ? hb->nrdist : hb->nrhb);
+ mat.ny=hb->nrhb;
snew(mat.matrix,mat.nx);
for(x=0; (x<mat.nx); x++)
snew(fr,1);
out = xvgropen(ftp2fn(efXVG,NFILE,fnm),"LIE free energy estimate",
"Time (ps)","DGbind (kJ/mol)",oenv);
- do {
- bCont = do_enx(fp,fr);
- ct = check_times(fr->t);
+ while(do_enx(fp,fr))
+ {
+ ct = check_times(fr->t);
if (ct == 0) {
lie = calc_lie(ld,fr->ener,lie_lj,lie_qq,fac_lj,fac_qq);
lieaver += lie;
nframes ++;
fprintf(out,"%10g %10g\n",fr->t,lie);
}
- } while (bCont);
+ }
close_enx(fp);
ffclose(out);
fprintf(stderr,"\n");
{
searchtime = last_frame_time;
}
- if (xtc_seek_time(stfio,searchtime,fr.natoms))
+ if (xtc_seek_time(stfio,searchtime,fr.natoms,TRUE))
{
gmx_fatal(FARGS,"Error seeking to append position.");
}