From: Mark Abraham Date: Fri, 24 Jul 2015 14:40:41 +0000 (+0200) Subject: Merge branch release-5-1 X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=5750bfe806310856448a1e7baf46a7d648d1185e;hp=-c;p=alexxy%2Fgromacs.git Merge branch release-5-1 Conflicts: src/gromacs/commandline/shellcompletions.cpp Removed line no longer appropriate, now that zsh completion is supported. Master had changed the previous line, which git flags as a merge conflict. Change-Id: Id9d37615b2bd121b1206ca0e6e8eac62fcf38f01 --- 5750bfe806310856448a1e7baf46a7d648d1185e diff --combined src/gromacs/commandline/shellcompletions.cpp index a0ef63e4c6,ce9f08a717..520ff46909 --- a/src/gromacs/commandline/shellcompletions.cpp +++ b/src/gromacs/commandline/shellcompletions.cpp @@@ -59,9 -59,9 +59,9 @@@ #include "gromacs/options/optionsvisitor.h" #include "gromacs/utility/arrayref.h" #include "gromacs/utility/exceptions.h" -#include "gromacs/utility/file.h" #include "gromacs/utility/gmxassert.h" #include "gromacs/utility/stringutil.h" +#include "gromacs/utility/textwriter.h" namespace gmx { @@@ -107,7 -107,7 +107,7 @@@ class OptionsListWriter : public Option class OptionCompletionWriter : public OptionsVisitor { public: - explicit OptionCompletionWriter(File *out) : out_(*out) {} + explicit OptionCompletionWriter(TextWriter *out) : out_(*out) {} virtual void visitSubSection(const Options §ion) { @@@ -121,7 -121,7 +121,7 @@@ void writeOptionCompletion(const OptionInfo &option, const std::string &completion); - File &out_; + TextWriter &out_; }; void OptionCompletionWriter::visitOption(const OptionInfo &option) @@@ -196,8 -196,8 +196,8 @@@ class ShellCompletionWriter::Imp return formatString("_%s_%s_compl", binaryName_.c_str(), moduleName); } - std::string binaryName_; - boost::scoped_ptr file_; + std::string binaryName_; + boost::scoped_ptr file_; }; ShellCompletionWriter::ShellCompletionWriter(const std::string &binaryName, @@@ -210,22 -210,21 +210,21 @@@ ShellCompletionWriter::~ShellCompletion { } -File *ShellCompletionWriter::outputFile() +TextOutputStream &ShellCompletionWriter::outputStream() { - return impl_->file_.get(); + return impl_->file_->stream(); } void ShellCompletionWriter::startCompletions() { - impl_->file_.reset(new File(impl_->binaryName_ + "-completion.bash", "w")); + impl_->file_.reset(new TextWriter(impl_->binaryName_ + "-completion.bash")); - impl_->file_->writeLine("shopt -s extglob"); } void ShellCompletionWriter::writeModuleCompletions( const char *moduleName, const Options &options) { - File &out = *impl_->file_; + TextWriter &out = *impl_->file_; out.writeLine(formatString("%s() {", impl_->completionFunctionName(moduleName).c_str())); out.writeLine("local IFS=$'\\n'"); out.writeLine("local c=${COMP_WORDS[COMP_CWORD]}"); diff --combined src/gromacs/gmxpreprocess/grompp.cpp index 8a6e43c666,2f976b8d2e..d8a6737091 --- a/src/gromacs/gmxpreprocess/grompp.cpp +++ b/src/gromacs/gmxpreprocess/grompp.cpp @@@ -38,20 -38,20 +38,20 @@@ #include "grompp.h" -#include #include #include -#include #include +#include + +#include + #include #include "gromacs/commandline/pargs.h" #include "gromacs/fileio/confio.h" #include "gromacs/fileio/enxio.h" -#include "gromacs/fileio/gmxfio.h" #include "gromacs/fileio/tpxio.h" -#include "gromacs/fileio/trnio.h" #include "gromacs/fileio/trxio.h" #include "gromacs/gmxpreprocess/add_par.h" #include "gromacs/gmxpreprocess/convparm.h" @@@ -84,7 -84,6 +84,7 @@@ #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/futil.h" +#include "gromacs/utility/gmxassert.h" #include "gromacs/utility/smalloc.h" #include "gromacs/utility/snprintf.h" @@@ -189,7 -188,7 +189,7 @@@ static void check_cg_sizes(const char * maxsize = 0; for (cg = 0; cg < cgs->nr; cg++) { - maxsize = max(maxsize, cgs->index[cg+1]-cgs->index[cg]); + maxsize = std::max(maxsize, cgs->index[cg+1]-cgs->index[cg]); } if (maxsize > MAX_CHARGEGROUP_SIZE) @@@ -291,7 -290,7 +291,7 @@@ static void check_bonds_timestep(gmx_mt if (debug) { fprintf(debug, "fc %g m1 %g m2 %g period %g\n", - fc, m1, m2, sqrt(period2)); + fc, m1, m2, std::sqrt(period2)); } if (period2 < limit2) { @@@ -336,7 -335,7 +336,7 @@@ *w_moltype->name, w_a1+1, *w_moltype->atoms.atomname[w_a1], w_a2+1, *w_moltype->atoms.atomname[w_a2], - sqrt(w_period2), bWarn ? min_steps_warn : min_steps_note, dt, + std::sqrt(w_period2), bWarn ? min_steps_warn : min_steps_note, dt, bWater ? "Maybe you asked for fexible water." : "Maybe you forgot to change the constraints mdp option."); @@@ -812,7 -811,7 +812,7 @@@ static void read_posres(gmx_mtop_t *mto rvec com, warninp_t wi) { - gmx_bool bFirst = TRUE, *hadAtom; + gmx_bool *hadAtom; rvec *x, *v, *xp; dvec sum; double totmass; @@@ -828,7 -827,7 +828,7 @@@ get_stx_coordnum(fn, &natoms); if (natoms != mtop->natoms) { - sprintf(warn_buf, "The number of atoms in %s (%d) does not match the number of atoms in the topology (%d). Will assume that the first %d atoms in the topology and %s match.", fn, natoms, mtop->natoms, min(mtop->natoms, natoms), fn); + sprintf(warn_buf, "The number of atoms in %s (%d) does not match the number of atoms in the topology (%d). Will assume that the first %d atoms in the topology and %s match.", fn, natoms, mtop->natoms, std::min(mtop->natoms, natoms), fn); warning(wi, warn_buf); } snew(x, natoms); @@@ -937,7 -936,7 +937,7 @@@ if (rc_scaling != erscNO) { - assert(npbcdim <= DIM); + GMX_ASSERT(npbcdim <= DIM, "Only DIM dimensions can have PBC"); for (mb = 0; mb < mtop->nmolblock; mb++) { @@@ -995,6 -994,8 +995,6 @@@ static void gen_posres(gmx_mtop_t *mtop rvec com, rvec comB, warninp_t wi) { - int i, j; - read_posres (mtop, mi, FALSE, fnA, rc_scaling, ePBC, com, wi); /* It is safer to simply read the b-state posres rather than trying * to be smart and copy the positions. @@@ -1091,7 -1092,7 +1091,7 @@@ interpolate1d( double xmin int ix; double a, b; - ix = (x-xmin)/dx; + ix = static_cast((x-xmin)/dx); a = (xmin+(ix+1)*dx-x)/dx; b = (x-xmin-ix*dx)/dx; @@@ -1181,7 -1182,7 +1181,7 @@@ setup_cmap (int grid_spaci void init_cmap_grid(gmx_cmap_t *cmap_grid, int ngrid, int grid_spacing) { - int i, k, nelem; + int i, nelem; cmap_grid->ngrid = ngrid; cmap_grid->grid_spacing = grid_spacing; @@@ -1308,19 -1309,22 +1308,19 @@@ static real calc_temp(const gmx_mtop_t const t_inputrec *ir, rvec *v) { - double sum_mv2; gmx_mtop_atomloop_all_t aloop; t_atom *atom; int a; - int nrdf, g; - - sum_mv2 = 0; + double sum_mv2 = 0; aloop = gmx_mtop_atomloop_all_init(mtop); while (gmx_mtop_atomloop_all_next(aloop, &a, &atom)) { sum_mv2 += atom->m*norm2(v[a]); } - nrdf = 0; - for (g = 0; g < ir->opts.ngtc; g++) + double nrdf = 0; + for (int g = 0; g < ir->opts.ngtc; g++) { nrdf += ir->opts.nrdf[g]; } @@@ -1345,7 -1349,7 +1345,7 @@@ static real get_max_reference_temp(cons } else { - ref_t = max(ref_t, ir->opts.ref_t[i]); + ref_t = std::max(ref_t, ir->opts.ref_t[i]); } } @@@ -1367,6 -1371,7 +1367,6 @@@ static void set_verlet_buffer(const gmx matrix box, warninp_t wi) { - int i; verletbuf_list_setup_t ls; real rlist_1x1; int n_nonlin_vsite; @@@ -1392,18 -1397,18 +1392,18 @@@ } printf("Calculated rlist for %dx%d atom pair-list as %.3f nm, buffer size %.3f nm\n", - 1, 1, rlist_1x1, rlist_1x1-max(ir->rvdw, ir->rcoulomb)); + 1, 1, rlist_1x1, rlist_1x1-std::max(ir->rvdw, ir->rcoulomb)); ir->rlistlong = ir->rlist; printf("Set rlist, assuming %dx%d atom pair-list, to %.3f nm, buffer size %.3f nm\n", ls.cluster_size_i, ls.cluster_size_j, - ir->rlist, ir->rlist-max(ir->rvdw, ir->rcoulomb)); + ir->rlist, ir->rlist-std::max(ir->rvdw, ir->rcoulomb)); printf("Note that mdrun will redetermine rlist based on the actual pair-list setup\n"); if (sqr(ir->rlistlong) >= max_cutoff2(ir->ePBC, box)) { - gmx_fatal(FARGS, "The pair-list cut-off (%g nm) is longer than half the shortest box vector or longer than the smallest box diagonal element (%g nm). Increase the box size or decrease nstlist or increase verlet-buffer-tolerance.", ir->rlistlong, sqrt(max_cutoff2(ir->ePBC, box))); + gmx_fatal(FARGS, "The pair-list cut-off (%g nm) is longer than half the shortest box vector or longer than the smallest box diagonal element (%g nm). Increase the box size or decrease nstlist or increase verlet-buffer-tolerance.", ir->rlistlong, std::sqrt(max_cutoff2(ir->ePBC, box))); } } @@@ -1480,7 -1485,9 +1480,9 @@@ int gmx_grompp(int argc, char *argv[] "with [TT]-cpi[tt]. If you wish to change the ensemble or things", "like output frequency, then supplying the checkpoint file to", "[THISMODULE] with [TT]-t[tt] along with a new [REF].mdp[ref] file", - "with [TT]-f[tt] is the recommended procedure.[PAR]", + "with [TT]-f[tt] is the recommended procedure. Actually preserving", + "the ensemble (if possible) still requires passing the checkpoint", + "file to [gmx-mdrun] [TT]-cpi[tt].[PAR]", "By default, all bonded interactions which have constant energy due to", "virtual site constructions will be removed. If this constant energy is", @@@ -1512,21 -1519,26 +1514,21 @@@ t_molinfo *mi, *intermolecular_interactions; gpp_atomtype_t atype; t_inputrec *ir; - int natoms, nvsite, comb, mt; + int nvsite, comb, mt; t_params *plist; t_state *state; matrix box; - real max_spacing, fudgeQQ; + real fudgeQQ; double reppow; char fn[STRLEN], fnB[STRLEN]; const char *mdparin; int ntype; gmx_bool bNeedVel, bGenVel; gmx_bool have_atomnumber; - int n12, n13, n14; - t_params *gb_plist = NULL; - gmx_genborn_t *born = NULL; output_env_t oenv; gmx_bool bVerbose = FALSE; warninp_t wi; char warn_buf[STRLEN]; - unsigned int useed; - t_atoms IMDatoms; /* Atoms to be operated on interactively (IMD) */ t_filenm fnm[] = { { efMDP, NULL, NULL, ffREAD }, @@@ -1594,7 -1606,7 +1596,7 @@@ if (ir->ld_seed == -1) { ir->ld_seed = (gmx_int64_t)gmx_rng_make_seed(); - fprintf(stderr, "Setting the LD random seed to %"GMX_PRId64 "\n", ir->ld_seed); + fprintf(stderr, "Setting the LD random seed to %" GMX_PRId64 "\n", ir->ld_seed); } if (ir->expandedvals->lmc_seed == -1) @@@ -1773,7 -1785,7 +1775,7 @@@ if (bRenum) { renum_atype(plist, sys, ir->wall_atomtype, atype, bVerbose); - ntype = get_atomtype_ntypes(atype); + get_atomtype_ntypes(atype); } if (ir->implicit_solvent != eisNO) @@@ -1853,6 -1865,7 +1855,6 @@@ } do_index(mdparin, ftp2fn_null(efNDX, NFILE, fnm), sys, bVerbose, ir, - bGenVel ? state->v : NULL, wi); if (ir->cutoff_scheme == ecutsVERLET && ir->verletbuf_tol > 0 && @@@ -1999,8 -2012,8 +2001,8 @@@ set_warning_line(wi, mdparin, -1); warning_error(wi, "Some of the Fourier grid sizes are set, but all of them need to be set."); } - max_spacing = calc_grid(stdout, box, ir->fourier_spacing, - &(ir->nkx), &(ir->nky), &(ir->nkz)); + calc_grid(stdout, box, ir->fourier_spacing, + &(ir->nkx), &(ir->nky), &(ir->nkz)); } /* MRS: eventually figure out better logic for initializing the fep diff --combined src/gromacs/options/filenameoptionmanager.cpp index 212c6a26a5,e33443b8b1..1a627cd85c --- a/src/gromacs/options/filenameoptionmanager.cpp +++ b/src/gromacs/options/filenameoptionmanager.cpp @@@ -81,7 -81,7 +81,7 @@@ const char *const c_compressedExtension */ std::string findExistingExtension(const std::string &prefix, const FileNameOptionInfo &option, - const FileInputRedirectorInterface *redirector) + const IFileInputRedirector *redirector) { ConstArrayRef types = option.fileTypes(); ConstArrayRef::const_iterator i; @@@ -117,7 -117,7 +117,7 @@@ class FileNameOptionManager::Imp } //! Redirector for file existence checks. - const FileInputRedirectorInterface *redirector_; + const IFileInputRedirector *redirector_; //! Global default file name, if set. std::string defaultFileName_; //! Whether input option processing has been disabled. @@@ -138,7 -138,7 +138,7 @@@ FileNameOptionManager::~FileNameOptionM } void FileNameOptionManager::setInputRedirector( - const FileInputRedirectorInterface *redirector) + const IFileInputRedirector *redirector) { impl_->redirector_ = redirector; } @@@ -268,15 -268,14 +268,14 @@@ std::string FileNameOptionManager::comp std::string FileNameOptionManager::completeDefaultFileName( const std::string &prefix, const FileNameOptionInfo &option) { - if (option.isDirectoryOption() || impl_->bInputCheckingDisabled_) + if (option.isDirectoryOption()) { return std::string(); } const bool bInput = option.isInputFile() || option.isInputOutputFile(); const std::string realPrefix = !impl_->defaultFileName_.empty() ? impl_->defaultFileName_ : prefix; - const bool bAllowMissing = option.allowMissing(); - if (bInput) + if (bInput && !impl_->bInputCheckingDisabled_) { const std::string completedName = findExistingExtension(realPrefix, option, impl_->redirector_); @@@ -284,7 -283,7 +283,7 @@@ { return completedName; } - if (bAllowMissing) + if (option.allowMissing()) { return realPrefix + option.defaultExtension(); } diff --combined src/gromacs/trajectoryanalysis/modules/sasa.cpp index 9649102069,cf243b4419..edff30830f --- a/src/gromacs/trajectoryanalysis/modules/sasa.cpp +++ b/src/gromacs/trajectoryanalysis/modules/sasa.cpp @@@ -445,7 -445,7 +445,7 @@@ Sasa::initOptions(Options *options, Tra "that are both too high." }; - options->setDescription(desc); + settings->setHelpText(desc); options->addOption(FileNameOption("o").filetype(eftPlot).outputFile().required() .store(&fnArea_).defaultBasename("area") @@@ -655,7 -655,7 +655,7 @@@ Sasa::initAnalysis(const TrajectoryAnal AnalysisDataPlotModulePointer plotm( new AnalysisDataPlotModule(settings.plotSettings())); plotm->setFileName(fnAtomArea_); - plotm->setTitle("Area per residue over the trajectory"); + plotm->setTitle("Area per atom over the trajectory"); plotm->setXLabel("Atom"); plotm->setXFormat(8, 0); plotm->setYLabel("Area (nm\\S2\\N)"); @@@ -667,11 -667,18 +667,18 @@@ } { AnalysisDataAverageModulePointer avem(new AnalysisDataAverageModule); + int prevResind = -1; + int row = 0; for (int i = 0; i < surfaceSel_.posCount(); ++i) { const int atomIndex = surfaceSel_.position(i).atomIndices()[0]; const int residueIndex = atoms.atom[atomIndex].resind; - avem->setXAxisValue(i, atoms.resinfo[residueIndex].nr); + if (residueIndex != prevResind) + { + avem->setXAxisValue(row, atoms.resinfo[residueIndex].nr); + prevResind = residueIndex; + ++row; + } } residueArea_.addModule(avem); if (!fnResidueArea_.empty()) @@@ -679,7 -686,7 +686,7 @@@ AnalysisDataPlotModulePointer plotm( new AnalysisDataPlotModule(settings.plotSettings())); plotm->setFileName(fnResidueArea_); - plotm->setTitle("Area per atom over the trajectory"); + plotm->setTitle("Area per residue over the trajectory"); plotm->setXLabel("Residue"); plotm->setXFormat(8, 0); plotm->setYLabel("Area (nm\\S2\\N)");