2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Registers command-line modules for pre-5.0 binaries.
38 * \author Teemu Murtola <teemu.murtola@gmail.com>
42 #include "legacymodules.h"
46 #include "gromacs/commandline/cmdlinemodule.h"
47 #include "gromacs/commandline/cmdlinemodulemanager.h"
48 #include "gromacs/commandline/cmdlineoptionsmodule.h"
49 #include "gromacs/gmxana/gmx_ana.h"
50 #include "gromacs/gmxpreprocess/editconf.h"
51 #include "gromacs/gmxpreprocess/genconf.h"
52 #include "gromacs/gmxpreprocess/genion.h"
53 #include "gromacs/gmxpreprocess/genrestr.h"
54 #include "gromacs/gmxpreprocess/grompp.h"
55 #include "gromacs/gmxpreprocess/insert_molecules.h"
56 #include "gromacs/gmxpreprocess/pdb2gmx.h"
57 #include "gromacs/gmxpreprocess/solvate.h"
58 #include "gromacs/gmxpreprocess/x2top.h"
59 #include "gromacs/tools/check.h"
60 #include "gromacs/tools/convert_tpr.h"
61 #include "gromacs/tools/dump.h"
62 #include "gromacs/tools/eneconv.h"
63 #include "gromacs/tools/make_ndx.h"
64 #include "gromacs/tools/mk_angndx.h"
65 #include "gromacs/tools/pme_error.h"
66 #include "gromacs/tools/report_methods.h"
67 #include "gromacs/tools/trjcat.h"
68 #include "gromacs/tools/trjconv.h"
69 #include "gromacs/tools/tune_pme.h"
71 #include "mdrun/mdrun_main.h"
72 #include "mdrun/nonbonded_bench.h"
73 #include "view/view.h"
79 * Command line module that provides information about obsolescence.
81 * Prints a message directing the user to a wiki page describing replacement
84 class ObsoleteToolModule
: public gmx::ICommandLineModule
87 //! Creates an obsolete tool module for a tool with the given name.
88 explicit ObsoleteToolModule(const char *name
)
93 const char *name() const override
97 const char *shortDescription() const override
102 void init(gmx::CommandLineModuleSettings
* /*settings*/) override
105 int run(int /*argc*/, char * /*argv*/[]) override
110 void writeHelp(const gmx::CommandLineHelpContext
& /*context*/) const override
116 void printMessage() const
119 "This tool is no longer present in GROMACS. Please see\n"
120 " http://jenkins.gromacs.org/job/Documentation_Nightly_master/javadoc/user-guide/cmdline.html#command-changes\n"
121 "for ideas how to perform the same tasks with the "
128 //! Initializer for a module that defaults to nice level zero.
129 void initSettingsNoNice(gmx::CommandLineModuleSettings
*settings
)
131 settings
->setDefaultNiceLevel(0);
135 * Convenience function for creating and registering a module.
137 * \param[in] manager Module manager to which to register the module.
138 * \param[in] mainFunction Main function to wrap.
139 * \param[in] name Name for the new module.
140 * \param[in] shortDescription One-line description for the new module.
142 void registerModule(gmx::CommandLineModuleManager
*manager
,
143 gmx::CommandLineModuleManager::CMainFunction mainFunction
,
144 const char *name
, const char *shortDescription
)
146 manager
->addModuleCMain(name
, shortDescription
, mainFunction
);
150 * Convenience function for creating and registering a module that defaults to
153 * \param[in] manager Module manager to which to register the module.
154 * \param[in] mainFunction Main function to wrap.
155 * \param[in] name Name for the new module.
156 * \param[in] shortDescription One-line description for the new module.
158 void registerModuleNoNice(gmx::CommandLineModuleManager
*manager
,
159 gmx::CommandLineModuleManager::CMainFunction mainFunction
,
160 const char *name
, const char *shortDescription
)
162 manager
->addModuleCMainWithSettings(name
, shortDescription
, mainFunction
,
163 &initSettingsNoNice
);
167 * Convenience function for registering a module for an obsolete tool.
169 * \param[in] manager Module manager to which to register the module.
170 * \param[in] name Name for the obsolete tool.
172 void registerObsoleteTool(gmx::CommandLineModuleManager
*manager
,
175 gmx::CommandLineModulePointer
module(new ObsoleteToolModule(name
));
176 manager
->addModule(std::move(module
));
181 void registerLegacyModules(gmx::CommandLineModuleManager
*manager
)
183 registerModule(manager
, &gmx_check
, "check",
184 "Check and compare files");
185 gmx::ICommandLineOptionsModule::registerModuleFactory(
186 manager
, gmx::DumpInfo::name
,
187 gmx::DumpInfo::shortDescription
,
188 &gmx::DumpInfo::create
);
189 registerModule(manager
, &gmx_grompp
, "grompp",
190 "Make a run input file");
191 registerModule(manager
, &gmx_convert_tpr
, "convert-tpr",
192 "Make a modifed run-input file");
193 registerObsoleteTool(manager
, "tpbconv");
194 registerModule(manager
, &gmx_x2top
, "x2top",
195 "Generate a primitive topology from coordinates");
197 registerModuleNoNice(manager
, &gmx::gmx_mdrun
, "mdrun",
198 "Perform a simulation, do a normal mode analysis or an energy minimization");
200 gmx::ICommandLineOptionsModule::registerModuleFactory(
201 manager
, gmx::NonbondedBenchmarkInfo::name
,
202 gmx::NonbondedBenchmarkInfo::shortDescription
,
203 &gmx::NonbondedBenchmarkInfo::create
);
205 gmx::ICommandLineOptionsModule::registerModuleFactory(
206 manager
, gmx::InsertMoleculesInfo::name(),
207 gmx::InsertMoleculesInfo::shortDescription(),
208 &gmx::InsertMoleculesInfo::create
);
210 gmx::ICommandLineOptionsModule::registerModuleFactory(
211 manager
, gmx::ReportMethodsInfo::name
,
212 gmx::ReportMethodsInfo::shortDescription
,
213 &gmx::ReportMethodsInfo::create
);
215 gmx::ICommandLineOptionsModule::registerModuleFactory(
216 manager
, gmx::pdb2gmxInfo::name
,
217 gmx::pdb2gmxInfo::shortDescription
,
218 &gmx::pdb2gmxInfo::create
);
220 // Modules from gmx_ana.h.
221 registerModule(manager
, &gmx_do_dssp
, "do_dssp",
222 "Assign secondary structure and calculate solvent accessible surface area");
223 registerModule(manager
, &gmx_editconf
, "editconf",
224 "Convert and manipulates structure files");
225 registerModule(manager
, &gmx_eneconv
, "eneconv",
226 "Convert energy files");
227 registerModule(manager
, &gmx_solvate
, "solvate",
229 registerObsoleteTool(manager
, "genbox");
230 registerModule(manager
, &gmx_genconf
, "genconf",
231 "Multiply a conformation in 'random' orientations");
232 registerModule(manager
, &gmx_genion
, "genion",
233 "Generate monoatomic ions on energetically favorable positions");
234 registerModule(manager
, &gmx_genrestr
, "genrestr",
235 "Generate position restraints or distance restraints for index groups");
236 registerModule(manager
, &gmx_make_edi
, "make_edi",
237 "Generate input files for essential dynamics sampling");
238 registerModule(manager
, &gmx_make_ndx
, "make_ndx",
240 registerModule(manager
, &gmx_mk_angndx
, "mk_angndx",
241 "Generate index files for 'gmx angle'");
242 registerModule(manager
, &gmx_trjcat
, "trjcat",
243 "Concatenate trajectory files");
244 registerModule(manager
, &gmx_trjconv
, "trjconv",
245 "Convert and manipulates trajectory files");
246 registerModule(manager
, &gmx_trjorder
, "trjorder",
247 "Order molecules according to their distance to a group");
248 registerModule(manager
, &gmx_xpm2ps
, "xpm2ps",
249 "Convert XPM (XPixelMap) matrices to postscript or XPM");
251 registerModule(manager
, &gmx_anaeig
, "anaeig",
252 "Analyze eigenvectors/normal modes");
253 registerModule(manager
, &gmx_analyze
, "analyze",
254 "Analyze data sets");
255 registerModule(manager
, &gmx_g_angle
, "angle",
256 "Calculate distributions and correlations for angles and dihedrals");
257 registerModule(manager
, &gmx_awh
, "awh",
258 "Extract data from an accelerated weight histogram (AWH) run");
259 registerModule(manager
, &gmx_bar
, "bar",
260 "Calculate free energy difference estimates through Bennett's acceptance ratio");
261 registerObsoleteTool(manager
, "bond");
262 registerObsoleteTool(manager
, "dist");
263 registerObsoleteTool(manager
, "sas");
264 registerObsoleteTool(manager
, "sgangle");
266 registerModule(manager
, &gmx_bundle
, "bundle",
267 "Analyze bundles of axes, e.g., helices");
268 registerModule(manager
, &gmx_chi
, "chi",
269 "Calculate everything you want to know about chi and other dihedrals");
270 registerModule(manager
, &gmx_cluster
, "cluster",
271 "Cluster structures");
272 registerModule(manager
, &gmx_clustsize
, "clustsize",
273 "Calculate size distributions of atomic clusters");
274 registerModule(manager
, &gmx_confrms
, "confrms",
275 "Fit two structures and calculates the RMSD");
276 registerModule(manager
, &gmx_covar
, "covar",
277 "Calculate and diagonalize the covariance matrix");
278 registerModule(manager
, &gmx_current
, "current",
279 "Calculate dielectric constants and current autocorrelation function");
280 registerModule(manager
, &gmx_density
, "density",
281 "Calculate the density of the system");
282 registerModule(manager
, &gmx_densmap
, "densmap",
283 "Calculate 2D planar or axial-radial density maps");
284 registerModule(manager
, &gmx_densorder
, "densorder",
285 "Calculate surface fluctuations");
286 registerModule(manager
, &gmx_dielectric
, "dielectric",
287 "Calculate frequency dependent dielectric constants");
288 registerModule(manager
, &gmx_dipoles
, "dipoles",
289 "Compute the total dipole plus fluctuations");
290 registerModule(manager
, &gmx_disre
, "disre",
291 "Analyze distance restraints");
292 registerModule(manager
, &gmx_dos
, "dos",
293 "Analyze density of states and properties based on that");
294 registerModule(manager
, &gmx_dyecoupl
, "dyecoupl",
295 "Extract dye dynamics from trajectories");
296 registerModule(manager
, &gmx_enemat
, "enemat",
297 "Extract an energy matrix from an energy file");
298 registerModule(manager
, &gmx_energy
, "energy",
299 "Writes energies to xvg files and display averages");
300 registerModule(manager
, &gmx_filter
, "filter",
301 "Frequency filter trajectories, useful for making smooth movies");
302 registerModule(manager
, &gmx_gyrate
, "gyrate",
303 "Calculate the radius of gyration");
304 registerModule(manager
, &gmx_h2order
, "h2order",
305 "Compute the orientation of water molecules");
306 registerModule(manager
, &gmx_hbond
, "hbond",
307 "Compute and analyze hydrogen bonds");
308 registerModule(manager
, &gmx_helix
, "helix",
309 "Calculate basic properties of alpha helices");
310 registerModule(manager
, &gmx_helixorient
, "helixorient",
311 "Calculate local pitch/bending/rotation/orientation inside helices");
312 registerModule(manager
, &gmx_hydorder
, "hydorder",
313 "Compute tetrahedrality parameters around a given atom");
314 registerModule(manager
, &gmx_lie
, "lie",
315 "Estimate free energy from linear combinations");
316 registerModule(manager
, &gmx_mdmat
, "mdmat",
317 "Calculate residue contact maps");
318 registerModule(manager
, &gmx_mindist
, "mindist",
319 "Calculate the minimum distance between two groups");
320 registerModule(manager
, &gmx_msd
, "msd",
321 "Calculates mean square displacements");
322 registerModule(manager
, &gmx_nmeig
, "nmeig",
323 "Diagonalize the Hessian for normal mode analysis");
324 registerModule(manager
, &gmx_nmens
, "nmens",
325 "Generate an ensemble of structures from the normal modes");
326 registerModule(manager
, &gmx_nmr
, "nmr",
327 "Analyze nuclear magnetic resonance properties from an energy file");
328 registerModule(manager
, &gmx_nmtraj
, "nmtraj",
329 "Generate a virtual oscillating trajectory from an eigenvector");
330 registerModule(manager
, &gmx_order
, "order",
331 "Compute the order parameter per atom for carbon tails");
332 registerModule(manager
, &gmx_pme_error
, "pme_error",
333 "Estimate the error of using PME with a given input file");
334 registerModule(manager
, &gmx_polystat
, "polystat",
335 "Calculate static properties of polymers");
336 registerModule(manager
, &gmx_potential
, "potential",
337 "Calculate the electrostatic potential across the box");
338 registerModule(manager
, &gmx_principal
, "principal",
339 "Calculate principal axes of inertia for a group of atoms");
340 registerModule(manager
, &gmx_rama
, "rama",
341 "Compute Ramachandran plots");
342 registerModule(manager
, &gmx_rms
, "rms",
343 "Calculate RMSDs with a reference structure and RMSD matrices");
344 registerModule(manager
, &gmx_rmsdist
, "rmsdist",
345 "Calculate atom pair distances averaged with power -2, -3 or -6");
346 registerModule(manager
, &gmx_rmsf
, "rmsf",
347 "Calculate atomic fluctuations");
348 registerModule(manager
, &gmx_rotacf
, "rotacf",
349 "Calculate the rotational correlation function for molecules");
350 registerModule(manager
, &gmx_rotmat
, "rotmat",
351 "Plot the rotation matrix for fitting to a reference structure");
352 registerModule(manager
, &gmx_saltbr
, "saltbr",
353 "Compute salt bridges");
354 registerModule(manager
, &gmx_sans
, "sans",
355 "Compute small angle neutron scattering spectra");
356 registerModule(manager
, &gmx_saxs
, "saxs",
357 "Compute small angle X-ray scattering spectra");
358 registerModule(manager
, &gmx_sham
, "sham",
359 "Compute free energies or other histograms from histograms");
360 registerModule(manager
, &gmx_sigeps
, "sigeps",
361 "Convert c6/12 or c6/cn combinations to and from sigma/epsilon");
362 registerModule(manager
, &gmx_sorient
, "sorient",
363 "Analyze solvent orientation around solutes");
364 registerModule(manager
, &gmx_spatial
, "spatial",
365 "Calculate the spatial distribution function");
366 registerModule(manager
, &gmx_spol
, "spol",
367 "Analyze solvent dipole orientation and polarization around solutes");
368 registerModule(manager
, &gmx_tcaf
, "tcaf",
369 "Calculate viscosities of liquids");
370 registerModule(manager
, &gmx_traj
, "traj",
371 "Plot x, v, f, box, temperature and rotational energy from trajectories");
372 registerModule(manager
, &gmx_tune_pme
, "tune_pme",
373 "Time mdrun as a function of PME ranks to optimize settings");
374 registerModule(manager
, &gmx_vanhove
, "vanhove",
375 "Compute Van Hove displacement and correlation functions");
376 registerModule(manager
, &gmx_velacc
, "velacc",
377 "Calculate velocity autocorrelation functions");
378 registerModule(manager
, &gmx_wham
, "wham",
379 "Perform weighted histogram analysis after umbrella sampling");
380 registerModule(manager
, &gmx_wheel
, "wheel",
381 "Plot helical wheels");
382 registerModuleNoNice(manager
, &gmx_view
, "view",
383 "View a trajectory on an X-Windows terminal");
386 gmx::CommandLineModuleGroup group
=
387 manager
->addModuleGroup("Generating topologies and coordinates");
388 group
.addModuleWithDescription("editconf", "Edit the box and write subgroups");
389 group
.addModule("x2top");
390 group
.addModule("solvate");
391 group
.addModule("insert-molecules");
392 group
.addModule("genconf");
393 group
.addModule("genion");
394 group
.addModule("genrestr");
395 group
.addModule("pdb2gmx");
398 gmx::CommandLineModuleGroup group
=
399 manager
->addModuleGroup("Running a simulation");
400 group
.addModule("grompp");
401 group
.addModule("mdrun");
402 group
.addModule("convert-tpr");
405 gmx::CommandLineModuleGroup group
=
406 manager
->addModuleGroup("Viewing trajectories");
407 group
.addModule("nmtraj");
408 group
.addModule("view");
411 gmx::CommandLineModuleGroup group
=
412 manager
->addModuleGroup("Processing energies");
413 group
.addModule("enemat");
414 group
.addModule("energy");
415 group
.addModuleWithDescription("mdrun", "(Re)calculate energies for trajectory frames with -rerun");
418 gmx::CommandLineModuleGroup group
=
419 manager
->addModuleGroup("Converting files");
420 group
.addModule("editconf");
421 group
.addModule("eneconv");
422 group
.addModule("sigeps");
423 group
.addModule("trjcat");
424 group
.addModule("trjconv");
425 group
.addModule("xpm2ps");
428 gmx::CommandLineModuleGroup group
=
429 manager
->addModuleGroup("Tools");
430 group
.addModule("analyze");
431 group
.addModule("awh");
432 group
.addModule("filter");
433 group
.addModule("lie");
434 group
.addModule("pme_error");
435 group
.addModule("sham");
436 group
.addModule("spatial");
437 group
.addModule("traj");
438 group
.addModule("tune_pme");
439 group
.addModule("wham");
440 group
.addModule("check");
441 group
.addModule("dump");
442 group
.addModule("make_ndx");
443 group
.addModule("mk_angndx");
444 group
.addModule("trjorder");
445 group
.addModule("xpm2ps");
446 group
.addModule("report-methods");
449 gmx::CommandLineModuleGroup group
=
450 manager
->addModuleGroup("Distances between structures");
451 group
.addModule("cluster");
452 group
.addModule("confrms");
453 group
.addModule("rms");
454 group
.addModule("rmsf");
457 gmx::CommandLineModuleGroup group
=
458 manager
->addModuleGroup("Distances in structures over time");
459 group
.addModule("mindist");
460 group
.addModule("mdmat");
461 group
.addModule("polystat");
462 group
.addModule("rmsdist");
465 gmx::CommandLineModuleGroup group
=
466 manager
->addModuleGroup("Mass distribution properties over time");
467 group
.addModule("gyrate");
468 group
.addModule("msd");
469 group
.addModule("polystat");
470 group
.addModule("rdf");
471 group
.addModule("rotacf");
472 group
.addModule("rotmat");
473 group
.addModule("sans");
474 group
.addModule("saxs");
475 group
.addModule("traj");
476 group
.addModule("vanhove");
479 gmx::CommandLineModuleGroup group
=
480 manager
->addModuleGroup("Analyzing bonded interactions");
481 group
.addModule("angle");
482 group
.addModule("mk_angndx");
485 gmx::CommandLineModuleGroup group
=
486 manager
->addModuleGroup("Structural properties");
487 group
.addModule("bundle");
488 group
.addModule("clustsize");
489 group
.addModule("disre");
490 group
.addModule("hbond");
491 group
.addModule("order");
492 group
.addModule("principal");
493 group
.addModule("rdf");
494 group
.addModule("saltbr");
495 group
.addModule("sorient");
496 group
.addModule("spol");
499 gmx::CommandLineModuleGroup group
=
500 manager
->addModuleGroup("Kinetic properties");
501 group
.addModule("bar");
502 group
.addModule("current");
503 group
.addModule("dos");
504 group
.addModule("dyecoupl");
505 group
.addModule("principal");
506 group
.addModule("tcaf");
507 group
.addModule("traj");
508 group
.addModule("vanhove");
509 group
.addModule("velacc");
512 gmx::CommandLineModuleGroup group
=
513 manager
->addModuleGroup("Electrostatic properties");
514 group
.addModule("current");
515 group
.addModule("dielectric");
516 group
.addModule("dipoles");
517 group
.addModule("potential");
518 group
.addModule("spol");
519 group
.addModule("genion");
522 gmx::CommandLineModuleGroup group
=
523 manager
->addModuleGroup("Protein-specific analysis");
524 group
.addModule("do_dssp");
525 group
.addModule("chi");
526 group
.addModule("helix");
527 group
.addModule("helixorient");
528 group
.addModule("rama");
529 group
.addModule("wheel");
532 gmx::CommandLineModuleGroup group
=
533 manager
->addModuleGroup("Interfaces");
534 group
.addModule("bundle");
535 group
.addModule("density");
536 group
.addModule("densmap");
537 group
.addModule("densorder");
538 group
.addModule("h2order");
539 group
.addModule("hydorder");
540 group
.addModule("order");
541 group
.addModule("potential");
544 gmx::CommandLineModuleGroup group
=
545 manager
->addModuleGroup("Covariance analysis");
546 group
.addModuleWithDescription("anaeig", "Analyze the eigenvectors");
547 group
.addModule("covar");
548 group
.addModule("make_edi");
551 gmx::CommandLineModuleGroup group
=
552 manager
->addModuleGroup("Normal modes");
553 group
.addModuleWithDescription("anaeig", "Analyze the normal modes");
554 group
.addModule("nmeig");
555 group
.addModule("nmtraj");
556 group
.addModule("nmens");
557 group
.addModule("grompp");
558 group
.addModuleWithDescription("mdrun", "Find a potential energy minimum and calculate the Hessian");