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 "view/view.h"
78 * Command line module that provides information about obsolescence.
80 * Prints a message directing the user to a wiki page describing replacement
83 class ObsoleteToolModule
: public gmx::ICommandLineModule
86 //! Creates an obsolete tool module for a tool with the given name.
87 explicit ObsoleteToolModule(const char *name
)
92 const char *name() const override
96 const char *shortDescription() const override
101 void init(gmx::CommandLineModuleSettings
* /*settings*/) override
104 int run(int /*argc*/, char * /*argv*/[]) override
109 void writeHelp(const gmx::CommandLineHelpContext
& /*context*/) const override
115 void printMessage() const
118 "This tool is no longer present in GROMACS. Please see\n"
119 " http://jenkins.gromacs.org/job/Documentation_Nightly_master/javadoc/user-guide/cmdline.html#command-changes\n"
120 "for ideas how to perform the same tasks with the "
127 //! Initializer for a module that defaults to nice level zero.
128 void initSettingsNoNice(gmx::CommandLineModuleSettings
*settings
)
130 settings
->setDefaultNiceLevel(0);
134 * Convenience function for creating and registering a module.
136 * \param[in] manager Module manager to which to register the module.
137 * \param[in] mainFunction Main function to wrap.
138 * \param[in] name Name for the new module.
139 * \param[in] shortDescription One-line description for the new module.
141 void registerModule(gmx::CommandLineModuleManager
*manager
,
142 gmx::CommandLineModuleManager::CMainFunction mainFunction
,
143 const char *name
, const char *shortDescription
)
145 manager
->addModuleCMain(name
, shortDescription
, mainFunction
);
149 * Convenience function for creating and registering a module that defaults to
152 * \param[in] manager Module manager to which to register the module.
153 * \param[in] mainFunction Main function to wrap.
154 * \param[in] name Name for the new module.
155 * \param[in] shortDescription One-line description for the new module.
157 void registerModuleNoNice(gmx::CommandLineModuleManager
*manager
,
158 gmx::CommandLineModuleManager::CMainFunction mainFunction
,
159 const char *name
, const char *shortDescription
)
161 manager
->addModuleCMainWithSettings(name
, shortDescription
, mainFunction
,
162 &initSettingsNoNice
);
166 * Convenience function for registering a module for an obsolete tool.
168 * \param[in] manager Module manager to which to register the module.
169 * \param[in] name Name for the obsolete tool.
171 void registerObsoleteTool(gmx::CommandLineModuleManager
*manager
,
174 gmx::CommandLineModulePointer
module(new ObsoleteToolModule(name
));
175 manager
->addModule(std::move(module
));
180 void registerLegacyModules(gmx::CommandLineModuleManager
*manager
)
182 registerModule(manager
, &gmx_check
, "check",
183 "Check and compare files");
184 gmx::ICommandLineOptionsModule::registerModuleFactory(
185 manager
, gmx::DumpInfo::name
,
186 gmx::DumpInfo::shortDescription
,
187 &gmx::DumpInfo::create
);
188 registerModule(manager
, &gmx_grompp
, "grompp",
189 "Make a run input file");
190 registerModule(manager
, &gmx_convert_tpr
, "convert-tpr",
191 "Make a modifed run-input file");
192 registerObsoleteTool(manager
, "tpbconv");
193 registerModule(manager
, &gmx_x2top
, "x2top",
194 "Generate a primitive topology from coordinates");
196 registerModuleNoNice(manager
, &gmx::gmx_mdrun
, "mdrun",
197 "Perform a simulation, do a normal mode analysis or an energy minimization");
199 gmx::ICommandLineOptionsModule::registerModuleFactory(
200 manager
, gmx::InsertMoleculesInfo::name(),
201 gmx::InsertMoleculesInfo::shortDescription(),
202 &gmx::InsertMoleculesInfo::create
);
204 gmx::ICommandLineOptionsModule::registerModuleFactory(
205 manager
, gmx::ReportMethodsInfo::name
,
206 gmx::ReportMethodsInfo::shortDescription
,
207 &gmx::ReportMethodsInfo::create
);
209 gmx::ICommandLineOptionsModule::registerModuleFactory(
210 manager
, gmx::pdb2gmxInfo::name
,
211 gmx::pdb2gmxInfo::shortDescription
,
212 &gmx::pdb2gmxInfo::create
);
214 // Modules from gmx_ana.h.
215 registerModule(manager
, &gmx_do_dssp
, "do_dssp",
216 "Assign secondary structure and calculate solvent accessible surface area");
217 registerModule(manager
, &gmx_editconf
, "editconf",
218 "Convert and manipulates structure files");
219 registerModule(manager
, &gmx_eneconv
, "eneconv",
220 "Convert energy files");
221 registerModule(manager
, &gmx_solvate
, "solvate",
223 registerObsoleteTool(manager
, "genbox");
224 registerModule(manager
, &gmx_genconf
, "genconf",
225 "Multiply a conformation in 'random' orientations");
226 registerModule(manager
, &gmx_genion
, "genion",
227 "Generate monoatomic ions on energetically favorable positions");
228 registerModule(manager
, &gmx_genrestr
, "genrestr",
229 "Generate position restraints or distance restraints for index groups");
230 registerModule(manager
, &gmx_make_edi
, "make_edi",
231 "Generate input files for essential dynamics sampling");
232 registerModule(manager
, &gmx_make_ndx
, "make_ndx",
234 registerModule(manager
, &gmx_mk_angndx
, "mk_angndx",
235 "Generate index files for 'gmx angle'");
236 registerModule(manager
, &gmx_trjcat
, "trjcat",
237 "Concatenate trajectory files");
238 registerModule(manager
, &gmx_trjconv
, "trjconv",
239 "Convert and manipulates trajectory files");
240 registerModule(manager
, &gmx_trjorder
, "trjorder",
241 "Order molecules according to their distance to a group");
242 registerModule(manager
, &gmx_xpm2ps
, "xpm2ps",
243 "Convert XPM (XPixelMap) matrices to postscript or XPM");
245 registerModule(manager
, &gmx_anaeig
, "anaeig",
246 "Analyze eigenvectors/normal modes");
247 registerModule(manager
, &gmx_analyze
, "analyze",
248 "Analyze data sets");
249 registerModule(manager
, &gmx_g_angle
, "angle",
250 "Calculate distributions and correlations for angles and dihedrals");
251 registerModule(manager
, &gmx_awh
, "awh",
252 "Extract data from an accelerated weight histogram (AWH) run");
253 registerModule(manager
, &gmx_bar
, "bar",
254 "Calculate free energy difference estimates through Bennett's acceptance ratio");
255 registerObsoleteTool(manager
, "bond");
256 registerObsoleteTool(manager
, "dist");
257 registerObsoleteTool(manager
, "sas");
258 registerObsoleteTool(manager
, "sgangle");
260 registerModule(manager
, &gmx_bundle
, "bundle",
261 "Analyze bundles of axes, e.g., helices");
262 registerModule(manager
, &gmx_chi
, "chi",
263 "Calculate everything you want to know about chi and other dihedrals");
264 registerModule(manager
, &gmx_cluster
, "cluster",
265 "Cluster structures");
266 registerModule(manager
, &gmx_clustsize
, "clustsize",
267 "Calculate size distributions of atomic clusters");
268 registerModule(manager
, &gmx_confrms
, "confrms",
269 "Fit two structures and calculates the RMSD");
270 registerModule(manager
, &gmx_covar
, "covar",
271 "Calculate and diagonalize the covariance matrix");
272 registerModule(manager
, &gmx_current
, "current",
273 "Calculate dielectric constants and current autocorrelation function");
274 registerModule(manager
, &gmx_density
, "density",
275 "Calculate the density of the system");
276 registerModule(manager
, &gmx_densmap
, "densmap",
277 "Calculate 2D planar or axial-radial density maps");
278 registerModule(manager
, &gmx_densorder
, "densorder",
279 "Calculate surface fluctuations");
280 registerModule(manager
, &gmx_dielectric
, "dielectric",
281 "Calculate frequency dependent dielectric constants");
282 registerModule(manager
, &gmx_dipoles
, "dipoles",
283 "Compute the total dipole plus fluctuations");
284 registerModule(manager
, &gmx_disre
, "disre",
285 "Analyze distance restraints");
286 registerModule(manager
, &gmx_dos
, "dos",
287 "Analyze density of states and properties based on that");
288 registerModule(manager
, &gmx_dyecoupl
, "dyecoupl",
289 "Extract dye dynamics from trajectories");
290 registerModule(manager
, &gmx_enemat
, "enemat",
291 "Extract an energy matrix from an energy file");
292 registerModule(manager
, &gmx_energy
, "energy",
293 "Writes energies to xvg files and display averages");
294 registerModule(manager
, &gmx_filter
, "filter",
295 "Frequency filter trajectories, useful for making smooth movies");
296 registerModule(manager
, &gmx_gyrate
, "gyrate",
297 "Calculate the radius of gyration");
298 registerModule(manager
, &gmx_h2order
, "h2order",
299 "Compute the orientation of water molecules");
300 registerModule(manager
, &gmx_hbond
, "hbond",
301 "Compute and analyze hydrogen bonds");
302 registerModule(manager
, &gmx_helix
, "helix",
303 "Calculate basic properties of alpha helices");
304 registerModule(manager
, &gmx_helixorient
, "helixorient",
305 "Calculate local pitch/bending/rotation/orientation inside helices");
306 registerModule(manager
, &gmx_hydorder
, "hydorder",
307 "Compute tetrahedrality parameters around a given atom");
308 registerModule(manager
, &gmx_lie
, "lie",
309 "Estimate free energy from linear combinations");
310 registerModule(manager
, &gmx_mdmat
, "mdmat",
311 "Calculate residue contact maps");
312 registerModule(manager
, &gmx_mindist
, "mindist",
313 "Calculate the minimum distance between two groups");
314 registerModule(manager
, &gmx_msd
, "msd",
315 "Calculates mean square displacements");
316 registerModule(manager
, &gmx_nmeig
, "nmeig",
317 "Diagonalize the Hessian for normal mode analysis");
318 registerModule(manager
, &gmx_nmens
, "nmens",
319 "Generate an ensemble of structures from the normal modes");
320 registerModule(manager
, &gmx_nmr
, "nmr",
321 "Analyze nuclear magnetic resonance properties from an energy file");
322 registerModule(manager
, &gmx_nmtraj
, "nmtraj",
323 "Generate a virtual oscillating trajectory from an eigenvector");
324 registerModule(manager
, &gmx_order
, "order",
325 "Compute the order parameter per atom for carbon tails");
326 registerModule(manager
, &gmx_pme_error
, "pme_error",
327 "Estimate the error of using PME with a given input file");
328 registerModule(manager
, &gmx_polystat
, "polystat",
329 "Calculate static properties of polymers");
330 registerModule(manager
, &gmx_potential
, "potential",
331 "Calculate the electrostatic potential across the box");
332 registerModule(manager
, &gmx_principal
, "principal",
333 "Calculate principal axes of inertia for a group of atoms");
334 registerModule(manager
, &gmx_rama
, "rama",
335 "Compute Ramachandran plots");
336 registerModule(manager
, &gmx_rms
, "rms",
337 "Calculate RMSDs with a reference structure and RMSD matrices");
338 registerModule(manager
, &gmx_rmsdist
, "rmsdist",
339 "Calculate atom pair distances averaged with power -2, -3 or -6");
340 registerModule(manager
, &gmx_rmsf
, "rmsf",
341 "Calculate atomic fluctuations");
342 registerModule(manager
, &gmx_rotacf
, "rotacf",
343 "Calculate the rotational correlation function for molecules");
344 registerModule(manager
, &gmx_rotmat
, "rotmat",
345 "Plot the rotation matrix for fitting to a reference structure");
346 registerModule(manager
, &gmx_saltbr
, "saltbr",
347 "Compute salt bridges");
348 registerModule(manager
, &gmx_sans
, "sans",
349 "Compute small angle neutron scattering spectra");
350 registerModule(manager
, &gmx_saxs
, "saxs",
351 "Compute small angle X-ray scattering spectra");
352 registerModule(manager
, &gmx_sham
, "sham",
353 "Compute free energies or other histograms from histograms");
354 registerModule(manager
, &gmx_sigeps
, "sigeps",
355 "Convert c6/12 or c6/cn combinations to and from sigma/epsilon");
356 registerModule(manager
, &gmx_sorient
, "sorient",
357 "Analyze solvent orientation around solutes");
358 registerModule(manager
, &gmx_spatial
, "spatial",
359 "Calculate the spatial distribution function");
360 registerModule(manager
, &gmx_spol
, "spol",
361 "Analyze solvent dipole orientation and polarization around solutes");
362 registerModule(manager
, &gmx_tcaf
, "tcaf",
363 "Calculate viscosities of liquids");
364 registerModule(manager
, &gmx_traj
, "traj",
365 "Plot x, v, f, box, temperature and rotational energy from trajectories");
366 registerModule(manager
, &gmx_tune_pme
, "tune_pme",
367 "Time mdrun as a function of PME ranks to optimize settings");
368 registerModule(manager
, &gmx_vanhove
, "vanhove",
369 "Compute Van Hove displacement and correlation functions");
370 registerModule(manager
, &gmx_velacc
, "velacc",
371 "Calculate velocity autocorrelation functions");
372 registerModule(manager
, &gmx_wham
, "wham",
373 "Perform weighted histogram analysis after umbrella sampling");
374 registerModule(manager
, &gmx_wheel
, "wheel",
375 "Plot helical wheels");
376 registerModuleNoNice(manager
, &gmx_view
, "view",
377 "View a trajectory on an X-Windows terminal");
380 gmx::CommandLineModuleGroup group
=
381 manager
->addModuleGroup("Generating topologies and coordinates");
382 group
.addModuleWithDescription("editconf", "Edit the box and write subgroups");
383 group
.addModule("x2top");
384 group
.addModule("solvate");
385 group
.addModule("insert-molecules");
386 group
.addModule("genconf");
387 group
.addModule("genion");
388 group
.addModule("genrestr");
389 group
.addModule("pdb2gmx");
392 gmx::CommandLineModuleGroup group
=
393 manager
->addModuleGroup("Running a simulation");
394 group
.addModule("grompp");
395 group
.addModule("mdrun");
396 group
.addModule("convert-tpr");
399 gmx::CommandLineModuleGroup group
=
400 manager
->addModuleGroup("Viewing trajectories");
401 group
.addModule("nmtraj");
402 group
.addModule("view");
405 gmx::CommandLineModuleGroup group
=
406 manager
->addModuleGroup("Processing energies");
407 group
.addModule("enemat");
408 group
.addModule("energy");
409 group
.addModuleWithDescription("mdrun", "(Re)calculate energies for trajectory frames with -rerun");
412 gmx::CommandLineModuleGroup group
=
413 manager
->addModuleGroup("Converting files");
414 group
.addModule("editconf");
415 group
.addModule("eneconv");
416 group
.addModule("sigeps");
417 group
.addModule("trjcat");
418 group
.addModule("trjconv");
419 group
.addModule("xpm2ps");
422 gmx::CommandLineModuleGroup group
=
423 manager
->addModuleGroup("Tools");
424 group
.addModule("analyze");
425 group
.addModule("awh");
426 group
.addModule("filter");
427 group
.addModule("lie");
428 group
.addModule("pme_error");
429 group
.addModule("sham");
430 group
.addModule("spatial");
431 group
.addModule("traj");
432 group
.addModule("tune_pme");
433 group
.addModule("wham");
434 group
.addModule("check");
435 group
.addModule("dump");
436 group
.addModule("make_ndx");
437 group
.addModule("mk_angndx");
438 group
.addModule("trjorder");
439 group
.addModule("xpm2ps");
440 group
.addModule("report-methods");
443 gmx::CommandLineModuleGroup group
=
444 manager
->addModuleGroup("Distances between structures");
445 group
.addModule("cluster");
446 group
.addModule("confrms");
447 group
.addModule("rms");
448 group
.addModule("rmsf");
451 gmx::CommandLineModuleGroup group
=
452 manager
->addModuleGroup("Distances in structures over time");
453 group
.addModule("mindist");
454 group
.addModule("mdmat");
455 group
.addModule("polystat");
456 group
.addModule("rmsdist");
459 gmx::CommandLineModuleGroup group
=
460 manager
->addModuleGroup("Mass distribution properties over time");
461 group
.addModule("gyrate");
462 group
.addModule("msd");
463 group
.addModule("polystat");
464 group
.addModule("rdf");
465 group
.addModule("rotacf");
466 group
.addModule("rotmat");
467 group
.addModule("sans");
468 group
.addModule("saxs");
469 group
.addModule("traj");
470 group
.addModule("vanhove");
473 gmx::CommandLineModuleGroup group
=
474 manager
->addModuleGroup("Analyzing bonded interactions");
475 group
.addModule("angle");
476 group
.addModule("mk_angndx");
479 gmx::CommandLineModuleGroup group
=
480 manager
->addModuleGroup("Structural properties");
481 group
.addModule("bundle");
482 group
.addModule("clustsize");
483 group
.addModule("disre");
484 group
.addModule("hbond");
485 group
.addModule("order");
486 group
.addModule("principal");
487 group
.addModule("rdf");
488 group
.addModule("saltbr");
489 group
.addModule("sorient");
490 group
.addModule("spol");
493 gmx::CommandLineModuleGroup group
=
494 manager
->addModuleGroup("Kinetic properties");
495 group
.addModule("bar");
496 group
.addModule("current");
497 group
.addModule("dos");
498 group
.addModule("dyecoupl");
499 group
.addModule("principal");
500 group
.addModule("tcaf");
501 group
.addModule("traj");
502 group
.addModule("vanhove");
503 group
.addModule("velacc");
506 gmx::CommandLineModuleGroup group
=
507 manager
->addModuleGroup("Electrostatic properties");
508 group
.addModule("current");
509 group
.addModule("dielectric");
510 group
.addModule("dipoles");
511 group
.addModule("potential");
512 group
.addModule("spol");
513 group
.addModule("genion");
516 gmx::CommandLineModuleGroup group
=
517 manager
->addModuleGroup("Protein-specific analysis");
518 group
.addModule("do_dssp");
519 group
.addModule("chi");
520 group
.addModule("helix");
521 group
.addModule("helixorient");
522 group
.addModule("rama");
523 group
.addModule("wheel");
526 gmx::CommandLineModuleGroup group
=
527 manager
->addModuleGroup("Interfaces");
528 group
.addModule("bundle");
529 group
.addModule("density");
530 group
.addModule("densmap");
531 group
.addModule("densorder");
532 group
.addModule("h2order");
533 group
.addModule("hydorder");
534 group
.addModule("order");
535 group
.addModule("potential");
538 gmx::CommandLineModuleGroup group
=
539 manager
->addModuleGroup("Covariance analysis");
540 group
.addModuleWithDescription("anaeig", "Analyze the eigenvectors");
541 group
.addModule("covar");
542 group
.addModule("make_edi");
545 gmx::CommandLineModuleGroup group
=
546 manager
->addModuleGroup("Normal modes");
547 group
.addModuleWithDescription("anaeig", "Analyze the normal modes");
548 group
.addModule("nmeig");
549 group
.addModule("nmtraj");
550 group
.addModule("nmens");
551 group
.addModule("grompp");
552 group
.addModuleWithDescription("mdrun", "Find a potential energy minimum and calculate the Hessian");