Rename and expose "generic" GPU memory transfer functions
[gromacs.git] / src / programs / legacymodules.cpp
blob0a159de02b4cb90e2b0afc60b1748c9c69956000
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_nmr, "nmr",
305 "Analyze nuclear magnetic resonance properties from an energy file");
306 registerModule(manager, &gmx_nmtraj, "nmtraj",
307 "Generate a virtual oscillating trajectory from an eigenvector");
308 registerModule(manager, &gmx_order, "order",
309 "Compute the order parameter per atom for carbon tails");
310 registerModule(manager, &gmx_pme_error, "pme_error",
311 "Estimate the error of using PME with a given input file");
312 registerModule(manager, &gmx_polystat, "polystat",
313 "Calculate static properties of polymers");
314 registerModule(manager, &gmx_potential, "potential",
315 "Calculate the electrostatic potential across the box");
316 registerModule(manager, &gmx_principal, "principal",
317 "Calculate principal axes of inertia for a group of atoms");
318 registerModule(manager, &gmx_rama, "rama",
319 "Compute Ramachandran plots");
320 registerModule(manager, &gmx_rms, "rms",
321 "Calculate RMSDs with a reference structure and RMSD matrices");
322 registerModule(manager, &gmx_rmsdist, "rmsdist",
323 "Calculate atom pair distances averaged with power -2, -3 or -6");
324 registerModule(manager, &gmx_rmsf, "rmsf",
325 "Calculate atomic fluctuations");
326 registerModule(manager, &gmx_rotacf, "rotacf",
327 "Calculate the rotational correlation function for molecules");
328 registerModule(manager, &gmx_rotmat, "rotmat",
329 "Plot the rotation matrix for fitting to a reference structure");
330 registerModule(manager, &gmx_saltbr, "saltbr",
331 "Compute salt bridges");
332 registerModule(manager, &gmx_sans, "sans",
333 "Compute small angle neutron scattering spectra");
334 registerModule(manager, &gmx_saxs, "saxs",
335 "Compute small angle X-ray scattering spectra");
336 registerModule(manager, &gmx_sham, "sham",
337 "Compute free energies or other histograms from histograms");
338 registerModule(manager, &gmx_sigeps, "sigeps",
339 "Convert c6/12 or c6/cn combinations to and from sigma/epsilon");
340 registerModule(manager, &gmx_sorient, "sorient",
341 "Analyze solvent orientation around solutes");
342 registerModule(manager, &gmx_spatial, "spatial",
343 "Calculate the spatial distribution function");
344 registerModule(manager, &gmx_spol, "spol",
345 "Analyze solvent dipole orientation and polarization around solutes");
346 registerModule(manager, &gmx_tcaf, "tcaf",
347 "Calculate viscosities of liquids");
348 registerModule(manager, &gmx_traj, "traj",
349 "Plot x, v, f, box, temperature and rotational energy from trajectories");
350 registerModule(manager, &gmx_tune_pme, "tune_pme",
351 "Time mdrun as a function of PME ranks to optimize settings");
352 registerModule(manager, &gmx_vanhove, "vanhove",
353 "Compute Van Hove displacement and correlation functions");
354 registerModule(manager, &gmx_velacc, "velacc",
355 "Calculate velocity autocorrelation functions");
356 registerModule(manager, &gmx_wham, "wham",
357 "Perform weighted histogram analysis after umbrella sampling");
358 registerModule(manager, &gmx_wheel, "wheel",
359 "Plot helical wheels");
360 registerModuleNoNice(manager, &gmx_view, "view",
361 "View a trajectory on an X-Windows terminal");
364 gmx::CommandLineModuleGroup group =
365 manager->addModuleGroup("Generating topologies and coordinates");
366 group.addModuleWithDescription("editconf", "Edit the box and write subgroups");
367 group.addModule("x2top");
368 group.addModule("solvate");
369 group.addModule("insert-molecules");
370 group.addModule("genconf");
371 group.addModule("genion");
372 group.addModule("genrestr");
373 group.addModule("pdb2gmx");
376 gmx::CommandLineModuleGroup group =
377 manager->addModuleGroup("Running a simulation");
378 group.addModule("grompp");
379 group.addModule("mdrun");
380 group.addModule("convert-tpr");
383 gmx::CommandLineModuleGroup group =
384 manager->addModuleGroup("Viewing trajectories");
385 group.addModule("nmtraj");
386 group.addModule("view");
389 gmx::CommandLineModuleGroup group =
390 manager->addModuleGroup("Processing energies");
391 group.addModule("enemat");
392 group.addModule("energy");
393 group.addModuleWithDescription("mdrun", "(Re)calculate energies for trajectory frames with -rerun");
396 gmx::CommandLineModuleGroup group =
397 manager->addModuleGroup("Converting files");
398 group.addModule("editconf");
399 group.addModule("eneconv");
400 group.addModule("sigeps");
401 group.addModule("trjcat");
402 group.addModule("trjconv");
403 group.addModule("xpm2ps");
406 gmx::CommandLineModuleGroup group =
407 manager->addModuleGroup("Tools");
408 group.addModule("analyze");
409 group.addModule("dyndom");
410 group.addModule("filter");
411 group.addModule("lie");
412 group.addModule("morph");
413 group.addModule("pme_error");
414 group.addModule("sham");
415 group.addModule("spatial");
416 group.addModule("traj");
417 group.addModule("tune_pme");
418 group.addModule("wham");
419 group.addModule("check");
420 group.addModule("dump");
421 group.addModule("make_ndx");
422 group.addModule("mk_angndx");
423 group.addModule("trjorder");
424 group.addModule("xpm2ps");
427 gmx::CommandLineModuleGroup group =
428 manager->addModuleGroup("Distances between structures");
429 group.addModule("cluster");
430 group.addModule("confrms");
431 group.addModule("rms");
432 group.addModule("rmsf");
435 gmx::CommandLineModuleGroup group =
436 manager->addModuleGroup("Distances in structures over time");
437 group.addModule("mindist");
438 group.addModule("mdmat");
439 group.addModule("polystat");
440 group.addModule("rmsdist");
443 gmx::CommandLineModuleGroup group =
444 manager->addModuleGroup("Mass distribution properties over time");
445 group.addModule("gyrate");
446 group.addModule("msd");
447 group.addModule("polystat");
448 group.addModule("rdf");
449 group.addModule("rotacf");
450 group.addModule("rotmat");
451 group.addModule("sans");
452 group.addModule("saxs");
453 group.addModule("traj");
454 group.addModule("vanhove");
457 gmx::CommandLineModuleGroup group =
458 manager->addModuleGroup("Analyzing bonded interactions");
459 group.addModule("angle");
460 group.addModule("mk_angndx");
463 gmx::CommandLineModuleGroup group =
464 manager->addModuleGroup("Structural properties");
465 group.addModule("anadock");
466 group.addModule("bundle");
467 group.addModule("clustsize");
468 group.addModule("disre");
469 group.addModule("hbond");
470 group.addModule("order");
471 group.addModule("principal");
472 group.addModule("rdf");
473 group.addModule("saltbr");
474 group.addModule("sorient");
475 group.addModule("spol");
478 gmx::CommandLineModuleGroup group =
479 manager->addModuleGroup("Kinetic properties");
480 group.addModule("bar");
481 group.addModule("current");
482 group.addModule("dos");
483 group.addModule("dyecoupl");
484 group.addModule("principal");
485 group.addModule("tcaf");
486 group.addModule("traj");
487 group.addModule("vanhove");
488 group.addModule("velacc");
491 gmx::CommandLineModuleGroup group =
492 manager->addModuleGroup("Electrostatic properties");
493 group.addModule("current");
494 group.addModule("dielectric");
495 group.addModule("dipoles");
496 group.addModule("potential");
497 group.addModule("spol");
498 group.addModule("genion");
501 gmx::CommandLineModuleGroup group =
502 manager->addModuleGroup("Protein-specific analysis");
503 group.addModule("do_dssp");
504 group.addModule("chi");
505 group.addModule("helix");
506 group.addModule("helixorient");
507 group.addModule("rama");
508 group.addModule("wheel");
511 gmx::CommandLineModuleGroup group =
512 manager->addModuleGroup("Interfaces");
513 group.addModule("bundle");
514 group.addModule("density");
515 group.addModule("densmap");
516 group.addModule("densorder");
517 group.addModule("h2order");
518 group.addModule("hydorder");
519 group.addModule("order");
520 group.addModule("potential");
523 gmx::CommandLineModuleGroup group =
524 manager->addModuleGroup("Covariance analysis");
525 group.addModuleWithDescription("anaeig", "Analyze the eigenvectors");
526 group.addModule("covar");
527 group.addModule("make_edi");
530 gmx::CommandLineModuleGroup group =
531 manager->addModuleGroup("Normal modes");
532 group.addModuleWithDescription("anaeig", "Analyze the normal modes");
533 group.addModule("nmeig");
534 group.addModule("nmtraj");
535 group.addModule("nmens");
536 group.addModule("grompp");
537 group.addModuleWithDescription("mdrun", "Find a potential energy minimum and calculate the Hessian");