128-bit AVX2 SIMD for AMD Ryzen
[gromacs.git] / src / programs / legacymodules.cpp
blobc39c2c4ae99548ad3e7373078e103d69d754d1d3
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2016,2017, 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.
35 /*! \internal \brief
36 * Registers command-line modules for pre-5.0 binaries.
38 * \author Teemu Murtola <teemu.murtola@gmail.com>
40 #include "gmxpre.h"
42 #include "legacymodules.h"
44 #include <cstdio>
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/genconf.h"
51 #include "gromacs/gmxpreprocess/grompp.h"
52 #include "gromacs/gmxpreprocess/insert-molecules.h"
53 #include "gromacs/gmxpreprocess/pdb2gmx.h"
54 #include "gromacs/gmxpreprocess/solvate.h"
55 #include "gromacs/gmxpreprocess/x2top.h"
56 #include "gromacs/tools/check.h"
57 #include "gromacs/tools/convert_tpr.h"
58 #include "gromacs/tools/dump.h"
60 #include "mdrun/mdrun_main.h"
61 #include "view/view.h"
63 namespace
66 /*! \brief
67 * Command line module that provides information about obsolescence.
69 * Prints a message directing the user to a wiki page describing replacement
70 * options.
72 class ObsoleteToolModule : public gmx::ICommandLineModule
74 public:
75 //! Creates an obsolete tool module for a tool with the given name.
76 explicit ObsoleteToolModule(const char *name)
77 : name_(name)
81 virtual const char *name() const
83 return name_;
85 virtual const char *shortDescription() const
87 return nullptr;
90 virtual void init(gmx::CommandLineModuleSettings * /*settings*/)
93 virtual int run(int /*argc*/, char * /*argv*/[])
95 printMessage();
96 return 0;
98 virtual void writeHelp(const gmx::CommandLineHelpContext & /*context*/) const
100 printMessage();
103 private:
104 void printMessage() const
106 std::fprintf(stderr,
107 "This tool is no longer present in GROMACS. Please see\n"
108 " http://jenkins.gromacs.org/job/Documentation_Nightly_master/javadoc/user-guide/cmdline.html#command-changes\n"
109 "for ideas how to perform the same tasks with the "
110 "new tools.\n");
113 const char *name_;
116 //! Initializer for a module that defaults to nice level zero.
117 void initSettingsNoNice(gmx::CommandLineModuleSettings *settings)
119 settings->setDefaultNiceLevel(0);
122 /*! \brief
123 * Convenience function for creating and registering a module.
125 * \param[in] manager Module manager to which to register the module.
126 * \param[in] mainFunction Main function to wrap.
127 * \param[in] name Name for the new module.
128 * \param[in] shortDescription One-line description for the new module.
130 void registerModule(gmx::CommandLineModuleManager *manager,
131 gmx::CommandLineModuleManager::CMainFunction mainFunction,
132 const char *name, const char *shortDescription)
134 manager->addModuleCMain(name, shortDescription, mainFunction);
137 /*! \brief
138 * Convenience function for creating and registering a module that defaults to
139 * -nice 0.
141 * \param[in] manager Module manager to which to register the module.
142 * \param[in] mainFunction Main function to wrap.
143 * \param[in] name Name for the new module.
144 * \param[in] shortDescription One-line description for the new module.
146 void registerModuleNoNice(gmx::CommandLineModuleManager *manager,
147 gmx::CommandLineModuleManager::CMainFunction mainFunction,
148 const char *name, const char *shortDescription)
150 manager->addModuleCMainWithSettings(name, shortDescription, mainFunction,
151 &initSettingsNoNice);
154 /*! \brief
155 * Convenience function for registering a module for an obsolete tool.
157 * \param[in] manager Module manager to which to register the module.
158 * \param[in] name Name for the obsolete tool.
160 void registerObsoleteTool(gmx::CommandLineModuleManager *manager,
161 const char *name)
163 gmx::CommandLineModulePointer module(new ObsoleteToolModule(name));
164 manager->addModule(std::move(module));
167 } // namespace
169 void registerLegacyModules(gmx::CommandLineModuleManager *manager)
171 // Modules from this directory (were in src/kernel/).
172 registerModule(manager, &gmx_check, "check",
173 "Check and compare files");
174 registerModule(manager, &gmx_dump, "dump",
175 "Make binary files human readable");
176 registerModule(manager, &gmx_grompp, "grompp",
177 "Make a run input file");
178 registerModule(manager, &gmx_pdb2gmx, "pdb2gmx",
179 "Convert coordinate files to topology and FF-compliant coordinate files");
180 registerModule(manager, &gmx_convert_tpr, "convert-tpr",
181 "Make a modifed run-input file");
182 registerObsoleteTool(manager, "tpbconv");
183 registerModule(manager, &gmx_x2top, "x2top",
184 "Generate a primitive topology from coordinates");
186 registerModuleNoNice(manager, &gmx_mdrun, "mdrun",
187 "Perform a simulation, do a normal mode analysis or an energy minimization");
189 gmx::ICommandLineOptionsModule::registerModuleFactory(
190 manager, gmx::InsertMoleculesInfo::name,
191 gmx::InsertMoleculesInfo::shortDescription,
192 &gmx::InsertMoleculesInfo::create);
194 // Modules from gmx_ana.h.
195 registerModule(manager, &gmx_do_dssp, "do_dssp",
196 "Assign secondary structure and calculate solvent accessible surface area");
197 registerModule(manager, &gmx_editconf, "editconf",
198 "Convert and manipulates structure files");
199 registerModule(manager, &gmx_eneconv, "eneconv",
200 "Convert energy files");
201 registerModule(manager, &gmx_solvate, "solvate",
202 "Solvate a system");
203 registerObsoleteTool(manager, "genbox");
204 registerModule(manager, &gmx_genconf, "genconf",
205 "Multiply a conformation in 'random' orientations");
206 registerModule(manager, &gmx_genion, "genion",
207 "Generate monoatomic ions on energetically favorable positions");
208 registerModule(manager, &gmx_genpr, "genrestr",
209 "Generate position restraints or distance restraints for index groups");
210 registerModule(manager, &gmx_make_edi, "make_edi",
211 "Generate input files for essential dynamics sampling");
212 registerModule(manager, &gmx_make_ndx, "make_ndx",
213 "Make index files");
214 registerModule(manager, &gmx_mk_angndx, "mk_angndx",
215 "Generate index files for 'gmx angle'");
216 registerModule(manager, &gmx_trjcat, "trjcat",
217 "Concatenate trajectory files");
218 registerModule(manager, &gmx_trjconv, "trjconv",
219 "Convert and manipulates trajectory files");
220 registerModule(manager, &gmx_trjorder, "trjorder",
221 "Order molecules according to their distance to a group");
222 registerModule(manager, &gmx_xpm2ps, "xpm2ps",
223 "Convert XPM (XPixelMap) matrices to postscript or XPM");
225 registerModule(manager, &gmx_anadock, "anadock",
226 "Cluster structures from Autodock runs");
227 registerModule(manager, &gmx_anaeig, "anaeig",
228 "Analyze eigenvectors/normal modes");
229 registerModule(manager, &gmx_analyze, "analyze",
230 "Analyze data sets");
231 registerModule(manager, &gmx_g_angle, "angle",
232 "Calculate distributions and correlations for angles and dihedrals");
233 registerModule(manager, &gmx_bar, "bar",
234 "Calculate free energy difference estimates through Bennett's acceptance ratio");
235 registerObsoleteTool(manager, "bond");
236 registerObsoleteTool(manager, "dist");
237 registerObsoleteTool(manager, "sas");
238 registerObsoleteTool(manager, "sgangle");
240 registerModule(manager, &gmx_bundle, "bundle",
241 "Analyze bundles of axes, e.g., helices");
242 registerModule(manager, &gmx_chi, "chi",
243 "Calculate everything you want to know about chi and other dihedrals");
244 registerModule(manager, &gmx_cluster, "cluster",
245 "Cluster structures");
246 registerModule(manager, &gmx_clustsize, "clustsize",
247 "Calculate size distributions of atomic clusters");
248 registerModule(manager, &gmx_confrms, "confrms",
249 "Fit two structures and calculates the RMSD");
250 registerModule(manager, &gmx_covar, "covar",
251 "Calculate and diagonalize the covariance matrix");
252 registerModule(manager, &gmx_current, "current",
253 "Calculate dielectric constants and current autocorrelation function");
254 registerModule(manager, &gmx_density, "density",
255 "Calculate the density of the system");
256 registerModule(manager, &gmx_densmap, "densmap",
257 "Calculate 2D planar or axial-radial density maps");
258 registerModule(manager, &gmx_densorder, "densorder",
259 "Calculate surface fluctuations");
260 registerModule(manager, &gmx_dielectric, "dielectric",
261 "Calculate frequency dependent dielectric constants");
262 registerModule(manager, &gmx_dipoles, "dipoles",
263 "Compute the total dipole plus fluctuations");
264 registerModule(manager, &gmx_disre, "disre",
265 "Analyze distance restraints");
266 registerModule(manager, &gmx_dos, "dos",
267 "Analyze density of states and properties based on that");
268 registerModule(manager, &gmx_dyecoupl, "dyecoupl",
269 "Extract dye dynamics from trajectories");
270 registerModule(manager, &gmx_dyndom, "dyndom",
271 "Interpolate and extrapolate structure rotations");
272 registerModule(manager, &gmx_enemat, "enemat",
273 "Extract an energy matrix from an energy file");
274 registerModule(manager, &gmx_energy, "energy",
275 "Writes energies to xvg files and display averages");
276 registerModule(manager, &gmx_filter, "filter",
277 "Frequency filter trajectories, useful for making smooth movies");
278 registerModule(manager, &gmx_gyrate, "gyrate",
279 "Calculate the radius of gyration");
280 registerModule(manager, &gmx_h2order, "h2order",
281 "Compute the orientation of water molecules");
282 registerModule(manager, &gmx_hbond, "hbond",
283 "Compute and analyze hydrogen bonds");
284 registerModule(manager, &gmx_helix, "helix",
285 "Calculate basic properties of alpha helices");
286 registerModule(manager, &gmx_helixorient, "helixorient",
287 "Calculate local pitch/bending/rotation/orientation inside helices");
288 registerModule(manager, &gmx_hydorder, "hydorder",
289 "Compute tetrahedrality parameters around a given atom");
290 registerModule(manager, &gmx_lie, "lie",
291 "Estimate free energy from linear combinations");
292 registerModule(manager, &gmx_mdmat, "mdmat",
293 "Calculate residue contact maps");
294 registerModule(manager, &gmx_mindist, "mindist",
295 "Calculate the minimum distance between two groups");
296 registerModule(manager, &gmx_morph, "morph",
297 "Interpolate linearly between conformations");
298 registerModule(manager, &gmx_msd, "msd",
299 "Calculates mean square displacements");
300 registerModule(manager, &gmx_nmeig, "nmeig",
301 "Diagonalize the Hessian for normal mode analysis");
302 registerModule(manager, &gmx_nmens, "nmens",
303 "Generate an ensemble of structures from the normal modes");
304 registerModule(manager, &gmx_nmtraj, "nmtraj",
305 "Generate a virtual oscillating trajectory from an eigenvector");
306 registerModule(manager, &gmx_order, "order",
307 "Compute the order parameter per atom for carbon tails");
308 registerModule(manager, &gmx_pme_error, "pme_error",
309 "Estimate the error of using PME with a given input file");
310 registerModule(manager, &gmx_polystat, "polystat",
311 "Calculate static properties of polymers");
312 registerModule(manager, &gmx_potential, "potential",
313 "Calculate the electrostatic potential across the box");
314 registerModule(manager, &gmx_principal, "principal",
315 "Calculate principal axes of inertia for a group of atoms");
316 registerModule(manager, &gmx_rama, "rama",
317 "Compute Ramachandran plots");
318 registerModule(manager, &gmx_rms, "rms",
319 "Calculate RMSDs with a reference structure and RMSD matrices");
320 registerModule(manager, &gmx_rmsdist, "rmsdist",
321 "Calculate atom pair distances averaged with power -2, -3 or -6");
322 registerModule(manager, &gmx_rmsf, "rmsf",
323 "Calculate atomic fluctuations");
324 registerModule(manager, &gmx_rotacf, "rotacf",
325 "Calculate the rotational correlation function for molecules");
326 registerModule(manager, &gmx_rotmat, "rotmat",
327 "Plot the rotation matrix for fitting to a reference structure");
328 registerModule(manager, &gmx_saltbr, "saltbr",
329 "Compute salt bridges");
330 registerModule(manager, &gmx_sans, "sans",
331 "Compute small angle neutron scattering spectra");
332 registerModule(manager, &gmx_saxs, "saxs",
333 "Compute small angle X-ray scattering spectra");
334 registerModule(manager, &gmx_sham, "sham",
335 "Compute free energies or other histograms from histograms");
336 registerModule(manager, &gmx_sigeps, "sigeps",
337 "Convert c6/12 or c6/cn combinations to and from sigma/epsilon");
338 registerModule(manager, &gmx_sorient, "sorient",
339 "Analyze solvent orientation around solutes");
340 registerModule(manager, &gmx_spatial, "spatial",
341 "Calculate the spatial distribution function");
342 registerModule(manager, &gmx_spol, "spol",
343 "Analyze solvent dipole orientation and polarization around solutes");
344 registerModule(manager, &gmx_tcaf, "tcaf",
345 "Calculate viscosities of liquids");
346 registerModule(manager, &gmx_traj, "traj",
347 "Plot x, v, f, box, temperature and rotational energy from trajectories");
348 registerModule(manager, &gmx_tune_pme, "tune_pme",
349 "Time mdrun as a function of PME ranks to optimize settings");
350 registerModule(manager, &gmx_vanhove, "vanhove",
351 "Compute Van Hove displacement and correlation functions");
352 registerModule(manager, &gmx_velacc, "velacc",
353 "Calculate velocity autocorrelation functions");
354 registerModule(manager, &gmx_wham, "wham",
355 "Perform weighted histogram analysis after umbrella sampling");
356 registerModule(manager, &gmx_wheel, "wheel",
357 "Plot helical wheels");
358 registerModuleNoNice(manager, &gmx_view, "view",
359 "View a trajectory on an X-Windows terminal");
362 gmx::CommandLineModuleGroup group =
363 manager->addModuleGroup("Generating topologies and coordinates");
364 group.addModuleWithDescription("editconf", "Edit the box and write subgroups");
365 group.addModule("x2top");
366 group.addModule("solvate");
367 group.addModule("insert-molecules");
368 group.addModule("genconf");
369 group.addModule("genion");
370 group.addModule("genrestr");
371 group.addModule("pdb2gmx");
374 gmx::CommandLineModuleGroup group =
375 manager->addModuleGroup("Running a simulation");
376 group.addModule("grompp");
377 group.addModule("mdrun");
378 group.addModule("convert-tpr");
381 gmx::CommandLineModuleGroup group =
382 manager->addModuleGroup("Viewing trajectories");
383 group.addModule("nmtraj");
384 group.addModule("view");
387 gmx::CommandLineModuleGroup group =
388 manager->addModuleGroup("Processing energies");
389 group.addModule("enemat");
390 group.addModule("energy");
391 group.addModuleWithDescription("mdrun", "(Re)calculate energies for trajectory frames with -rerun");
394 gmx::CommandLineModuleGroup group =
395 manager->addModuleGroup("Converting files");
396 group.addModule("editconf");
397 group.addModule("eneconv");
398 group.addModule("sigeps");
399 group.addModule("trjcat");
400 group.addModule("trjconv");
401 group.addModule("xpm2ps");
404 gmx::CommandLineModuleGroup group =
405 manager->addModuleGroup("Tools");
406 group.addModule("analyze");
407 group.addModule("dyndom");
408 group.addModule("filter");
409 group.addModule("lie");
410 group.addModule("morph");
411 group.addModule("pme_error");
412 group.addModule("sham");
413 group.addModule("spatial");
414 group.addModule("traj");
415 group.addModule("tune_pme");
416 group.addModule("wham");
417 group.addModule("check");
418 group.addModule("dump");
419 group.addModule("make_ndx");
420 group.addModule("mk_angndx");
421 group.addModule("trjorder");
422 group.addModule("xpm2ps");
425 gmx::CommandLineModuleGroup group =
426 manager->addModuleGroup("Distances between structures");
427 group.addModule("cluster");
428 group.addModule("confrms");
429 group.addModule("rms");
430 group.addModule("rmsf");
433 gmx::CommandLineModuleGroup group =
434 manager->addModuleGroup("Distances in structures over time");
435 group.addModule("mindist");
436 group.addModule("mdmat");
437 group.addModule("polystat");
438 group.addModule("rmsdist");
441 gmx::CommandLineModuleGroup group =
442 manager->addModuleGroup("Mass distribution properties over time");
443 group.addModule("gyrate");
444 group.addModule("msd");
445 group.addModule("polystat");
446 group.addModule("rdf");
447 group.addModule("rotacf");
448 group.addModule("rotmat");
449 group.addModule("sans");
450 group.addModule("saxs");
451 group.addModule("traj");
452 group.addModule("vanhove");
455 gmx::CommandLineModuleGroup group =
456 manager->addModuleGroup("Analyzing bonded interactions");
457 group.addModule("angle");
458 group.addModule("mk_angndx");
461 gmx::CommandLineModuleGroup group =
462 manager->addModuleGroup("Structural properties");
463 group.addModule("anadock");
464 group.addModule("bundle");
465 group.addModule("clustsize");
466 group.addModule("disre");
467 group.addModule("hbond");
468 group.addModule("order");
469 group.addModule("principal");
470 group.addModule("rdf");
471 group.addModule("saltbr");
472 group.addModule("sorient");
473 group.addModule("spol");
476 gmx::CommandLineModuleGroup group =
477 manager->addModuleGroup("Kinetic properties");
478 group.addModule("bar");
479 group.addModule("current");
480 group.addModule("dos");
481 group.addModule("dyecoupl");
482 group.addModule("principal");
483 group.addModule("tcaf");
484 group.addModule("traj");
485 group.addModule("vanhove");
486 group.addModule("velacc");
489 gmx::CommandLineModuleGroup group =
490 manager->addModuleGroup("Electrostatic properties");
491 group.addModule("current");
492 group.addModule("dielectric");
493 group.addModule("dipoles");
494 group.addModule("potential");
495 group.addModule("spol");
496 group.addModule("genion");
499 gmx::CommandLineModuleGroup group =
500 manager->addModuleGroup("Protein-specific analysis");
501 group.addModule("do_dssp");
502 group.addModule("chi");
503 group.addModule("helix");
504 group.addModule("helixorient");
505 group.addModule("rama");
506 group.addModule("wheel");
509 gmx::CommandLineModuleGroup group =
510 manager->addModuleGroup("Interfaces");
511 group.addModule("bundle");
512 group.addModule("density");
513 group.addModule("densmap");
514 group.addModule("densorder");
515 group.addModule("h2order");
516 group.addModule("hydorder");
517 group.addModule("order");
518 group.addModule("potential");
521 gmx::CommandLineModuleGroup group =
522 manager->addModuleGroup("Covariance analysis");
523 group.addModuleWithDescription("anaeig", "Analyze the eigenvectors");
524 group.addModule("covar");
525 group.addModule("make_edi");
528 gmx::CommandLineModuleGroup group =
529 manager->addModuleGroup("Normal modes");
530 group.addModuleWithDescription("anaeig", "Analyze the normal modes");
531 group.addModule("nmeig");
532 group.addModule("nmtraj");
533 group.addModule("nmens");
534 group.addModule("grompp");
535 group.addModuleWithDescription("mdrun", "Find a potential energy minimum and calculate the Hessian");