hillclimber 0.1.6__cp313-cp313-macosx_15_0_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hillclimber/__init__.py +41 -0
- hillclimber/actions.py +53 -0
- hillclimber/analysis.py +590 -0
- hillclimber/biases.py +293 -0
- hillclimber/calc.py +22 -0
- hillclimber/cvs.py +1070 -0
- hillclimber/interfaces.py +133 -0
- hillclimber/metadynamics.py +416 -0
- hillclimber/nodes.py +6 -0
- hillclimber/opes.py +359 -0
- hillclimber/pycv.py +362 -0
- hillclimber/selectors.py +230 -0
- hillclimber/virtual_atoms.py +341 -0
- hillclimber-0.1.6.dist-info/METADATA +325 -0
- hillclimber-0.1.6.dist-info/RECORD +468 -0
- hillclimber-0.1.6.dist-info/WHEEL +6 -0
- hillclimber-0.1.6.dist-info/entry_points.txt +8 -0
- hillclimber-0.1.6.dist-info/licenses/LICENSE +165 -0
- plumed/__init__.py +104 -0
- plumed/_lib/bin/plumed +0 -0
- plumed/_lib/bin/plumed-config +9 -0
- plumed/_lib/bin/plumed-patch +9 -0
- plumed/_lib/include/plumed/adjmat/AdjacencyMatrixBase.h +659 -0
- plumed/_lib/include/plumed/adjmat/ContactMatrix.h +59 -0
- plumed/_lib/include/plumed/asmjit/arch.h +228 -0
- plumed/_lib/include/plumed/asmjit/arm.h +43 -0
- plumed/_lib/include/plumed/asmjit/asmjit.h +69 -0
- plumed/_lib/include/plumed/asmjit/asmjit_apibegin.h +143 -0
- plumed/_lib/include/plumed/asmjit/asmjit_apiend.h +93 -0
- plumed/_lib/include/plumed/asmjit/asmjit_build.h +971 -0
- plumed/_lib/include/plumed/asmjit/assembler.h +183 -0
- plumed/_lib/include/plumed/asmjit/base.h +56 -0
- plumed/_lib/include/plumed/asmjit/codebuilder.h +944 -0
- plumed/_lib/include/plumed/asmjit/codecompiler.h +767 -0
- plumed/_lib/include/plumed/asmjit/codeemitter.h +528 -0
- plumed/_lib/include/plumed/asmjit/codeholder.h +777 -0
- plumed/_lib/include/plumed/asmjit/constpool.h +286 -0
- plumed/_lib/include/plumed/asmjit/cpuinfo.h +402 -0
- plumed/_lib/include/plumed/asmjit/func.h +1327 -0
- plumed/_lib/include/plumed/asmjit/globals.h +370 -0
- plumed/_lib/include/plumed/asmjit/inst.h +137 -0
- plumed/_lib/include/plumed/asmjit/logging.h +317 -0
- plumed/_lib/include/plumed/asmjit/misc_p.h +103 -0
- plumed/_lib/include/plumed/asmjit/moved_string.h +318 -0
- plumed/_lib/include/plumed/asmjit/operand.h +1599 -0
- plumed/_lib/include/plumed/asmjit/osutils.h +207 -0
- plumed/_lib/include/plumed/asmjit/regalloc_p.h +597 -0
- plumed/_lib/include/plumed/asmjit/runtime.h +227 -0
- plumed/_lib/include/plumed/asmjit/simdtypes.h +1104 -0
- plumed/_lib/include/plumed/asmjit/utils.h +1387 -0
- plumed/_lib/include/plumed/asmjit/vmem.h +183 -0
- plumed/_lib/include/plumed/asmjit/x86.h +45 -0
- plumed/_lib/include/plumed/asmjit/x86assembler.h +125 -0
- plumed/_lib/include/plumed/asmjit/x86builder.h +117 -0
- plumed/_lib/include/plumed/asmjit/x86compiler.h +322 -0
- plumed/_lib/include/plumed/asmjit/x86emitter.h +5149 -0
- plumed/_lib/include/plumed/asmjit/x86globals.h +535 -0
- plumed/_lib/include/plumed/asmjit/x86inst.h +2547 -0
- plumed/_lib/include/plumed/asmjit/x86instimpl_p.h +74 -0
- plumed/_lib/include/plumed/asmjit/x86internal_p.h +108 -0
- plumed/_lib/include/plumed/asmjit/x86logging_p.h +92 -0
- plumed/_lib/include/plumed/asmjit/x86misc.h +417 -0
- plumed/_lib/include/plumed/asmjit/x86operand.h +1133 -0
- plumed/_lib/include/plumed/asmjit/x86regalloc_p.h +734 -0
- plumed/_lib/include/plumed/asmjit/zone.h +1157 -0
- plumed/_lib/include/plumed/bias/Bias.h +82 -0
- plumed/_lib/include/plumed/bias/ReweightBase.h +58 -0
- plumed/_lib/include/plumed/blas/blas.h +253 -0
- plumed/_lib/include/plumed/blas/def_external.h +61 -0
- plumed/_lib/include/plumed/blas/def_internal.h +97 -0
- plumed/_lib/include/plumed/blas/real.h +49 -0
- plumed/_lib/include/plumed/cltools/CLTool.h +32 -0
- plumed/_lib/include/plumed/clusters/ClusteringBase.h +70 -0
- plumed/_lib/include/plumed/colvar/Colvar.h +32 -0
- plumed/_lib/include/plumed/colvar/ColvarInput.h +68 -0
- plumed/_lib/include/plumed/colvar/ColvarShortcut.h +81 -0
- plumed/_lib/include/plumed/colvar/CoordinationBase.h +52 -0
- plumed/_lib/include/plumed/colvar/MultiColvarTemplate.h +333 -0
- plumed/_lib/include/plumed/colvar/PathMSDBase.h +101 -0
- plumed/_lib/include/plumed/colvar/RMSDVector.h +78 -0
- plumed/_lib/include/plumed/config/Config.h +118 -0
- plumed/_lib/include/plumed/config/version.h +9 -0
- plumed/_lib/include/plumed/contour/ContourFindingObject.h +87 -0
- plumed/_lib/include/plumed/contour/DistanceFromContourBase.h +82 -0
- plumed/_lib/include/plumed/contour/FindContour.h +67 -0
- plumed/_lib/include/plumed/core/Action.h +540 -0
- plumed/_lib/include/plumed/core/ActionAnyorder.h +48 -0
- plumed/_lib/include/plumed/core/ActionAtomistic.h +343 -0
- plumed/_lib/include/plumed/core/ActionForInterface.h +99 -0
- plumed/_lib/include/plumed/core/ActionPilot.h +57 -0
- plumed/_lib/include/plumed/core/ActionRegister.h +124 -0
- plumed/_lib/include/plumed/core/ActionSet.h +163 -0
- plumed/_lib/include/plumed/core/ActionSetup.h +48 -0
- plumed/_lib/include/plumed/core/ActionShortcut.h +73 -0
- plumed/_lib/include/plumed/core/ActionToGetData.h +59 -0
- plumed/_lib/include/plumed/core/ActionToPutData.h +101 -0
- plumed/_lib/include/plumed/core/ActionWithArguments.h +140 -0
- plumed/_lib/include/plumed/core/ActionWithMatrix.h +87 -0
- plumed/_lib/include/plumed/core/ActionWithValue.h +258 -0
- plumed/_lib/include/plumed/core/ActionWithVector.h +94 -0
- plumed/_lib/include/plumed/core/ActionWithVirtualAtom.h +123 -0
- plumed/_lib/include/plumed/core/CLTool.h +177 -0
- plumed/_lib/include/plumed/core/CLToolMain.h +102 -0
- plumed/_lib/include/plumed/core/CLToolRegister.h +108 -0
- plumed/_lib/include/plumed/core/Colvar.h +115 -0
- plumed/_lib/include/plumed/core/DataPassingObject.h +94 -0
- plumed/_lib/include/plumed/core/DataPassingTools.h +54 -0
- plumed/_lib/include/plumed/core/DomainDecomposition.h +120 -0
- plumed/_lib/include/plumed/core/ExchangePatterns.h +47 -0
- plumed/_lib/include/plumed/core/FlexibleBin.h +63 -0
- plumed/_lib/include/plumed/core/GREX.h +61 -0
- plumed/_lib/include/plumed/core/GenericMolInfo.h +89 -0
- plumed/_lib/include/plumed/core/Group.h +41 -0
- plumed/_lib/include/plumed/core/ModuleMap.h +30 -0
- plumed/_lib/include/plumed/core/ParallelTaskManager.h +1023 -0
- plumed/_lib/include/plumed/core/PbcAction.h +61 -0
- plumed/_lib/include/plumed/core/PlumedMain.h +632 -0
- plumed/_lib/include/plumed/core/PlumedMainInitializer.h +118 -0
- plumed/_lib/include/plumed/core/RegisterBase.h +340 -0
- plumed/_lib/include/plumed/core/TargetDist.h +48 -0
- plumed/_lib/include/plumed/core/Value.h +547 -0
- plumed/_lib/include/plumed/core/WithCmd.h +93 -0
- plumed/_lib/include/plumed/dimred/SMACOF.h +55 -0
- plumed/_lib/include/plumed/drr/DRR.h +383 -0
- plumed/_lib/include/plumed/drr/colvar_UIestimator.h +777 -0
- plumed/_lib/include/plumed/fisst/legendre_rule_fast.h +44 -0
- plumed/_lib/include/plumed/function/Custom.h +54 -0
- plumed/_lib/include/plumed/function/Function.h +85 -0
- plumed/_lib/include/plumed/function/FunctionOfMatrix.h +368 -0
- plumed/_lib/include/plumed/function/FunctionOfScalar.h +135 -0
- plumed/_lib/include/plumed/function/FunctionOfVector.h +296 -0
- plumed/_lib/include/plumed/function/FunctionSetup.h +180 -0
- plumed/_lib/include/plumed/function/FunctionShortcut.h +130 -0
- plumed/_lib/include/plumed/function/FunctionWithSingleArgument.h +165 -0
- plumed/_lib/include/plumed/gridtools/ActionWithGrid.h +43 -0
- plumed/_lib/include/plumed/gridtools/EvaluateGridFunction.h +99 -0
- plumed/_lib/include/plumed/gridtools/FunctionOfGrid.h +295 -0
- plumed/_lib/include/plumed/gridtools/GridCoordinatesObject.h +179 -0
- plumed/_lib/include/plumed/gridtools/GridSearch.h +135 -0
- plumed/_lib/include/plumed/gridtools/Interpolator.h +45 -0
- plumed/_lib/include/plumed/gridtools/KDE.h +455 -0
- plumed/_lib/include/plumed/gridtools/RDF.h +40 -0
- plumed/_lib/include/plumed/gridtools/SumOfKernels.h +219 -0
- plumed/_lib/include/plumed/isdb/MetainferenceBase.h +398 -0
- plumed/_lib/include/plumed/lapack/def_external.h +207 -0
- plumed/_lib/include/plumed/lapack/def_internal.h +388 -0
- plumed/_lib/include/plumed/lapack/lapack.h +899 -0
- plumed/_lib/include/plumed/lapack/lapack_limits.h +79 -0
- plumed/_lib/include/plumed/lapack/real.h +50 -0
- plumed/_lib/include/plumed/lepton/CompiledExpression.h +164 -0
- plumed/_lib/include/plumed/lepton/CustomFunction.h +143 -0
- plumed/_lib/include/plumed/lepton/Exception.h +93 -0
- plumed/_lib/include/plumed/lepton/ExpressionProgram.h +137 -0
- plumed/_lib/include/plumed/lepton/ExpressionTreeNode.h +145 -0
- plumed/_lib/include/plumed/lepton/Lepton.h +85 -0
- plumed/_lib/include/plumed/lepton/MSVC_erfc.h +123 -0
- plumed/_lib/include/plumed/lepton/Operation.h +1302 -0
- plumed/_lib/include/plumed/lepton/ParsedExpression.h +165 -0
- plumed/_lib/include/plumed/lepton/Parser.h +111 -0
- plumed/_lib/include/plumed/lepton/windowsIncludes.h +73 -0
- plumed/_lib/include/plumed/mapping/Path.h +44 -0
- plumed/_lib/include/plumed/mapping/PathProjectionCalculator.h +57 -0
- plumed/_lib/include/plumed/matrixtools/MatrixOperationBase.h +54 -0
- plumed/_lib/include/plumed/matrixtools/MatrixTimesMatrix.h +309 -0
- plumed/_lib/include/plumed/matrixtools/MatrixTimesVectorBase.h +365 -0
- plumed/_lib/include/plumed/matrixtools/OuterProduct.h +238 -0
- plumed/_lib/include/plumed/maze/Core.h +65 -0
- plumed/_lib/include/plumed/maze/Loss.h +86 -0
- plumed/_lib/include/plumed/maze/Member.h +66 -0
- plumed/_lib/include/plumed/maze/Memetic.h +799 -0
- plumed/_lib/include/plumed/maze/Optimizer.h +357 -0
- plumed/_lib/include/plumed/maze/Random_MT.h +156 -0
- plumed/_lib/include/plumed/maze/Tools.h +183 -0
- plumed/_lib/include/plumed/metatomic/vesin.h +188 -0
- plumed/_lib/include/plumed/molfile/Gromacs.h +2013 -0
- plumed/_lib/include/plumed/molfile/endianswap.h +217 -0
- plumed/_lib/include/plumed/molfile/fastio.h +683 -0
- plumed/_lib/include/plumed/molfile/largefiles.h +78 -0
- plumed/_lib/include/plumed/molfile/libmolfile_plugin.h +77 -0
- plumed/_lib/include/plumed/molfile/molfile_plugin.h +1034 -0
- plumed/_lib/include/plumed/molfile/periodic_table.h +248 -0
- plumed/_lib/include/plumed/molfile/readpdb.h +447 -0
- plumed/_lib/include/plumed/molfile/vmdplugin.h +236 -0
- plumed/_lib/include/plumed/multicolvar/MultiColvarShortcuts.h +45 -0
- plumed/_lib/include/plumed/opes/ExpansionCVs.h +79 -0
- plumed/_lib/include/plumed/sasa/Sasa.h +32 -0
- plumed/_lib/include/plumed/secondarystructure/SecondaryStructureBase.h +372 -0
- plumed/_lib/include/plumed/setup/ActionSetup.h +25 -0
- plumed/_lib/include/plumed/small_vector/small_vector.h +6114 -0
- plumed/_lib/include/plumed/symfunc/CoordinationNumbers.h +41 -0
- plumed/_lib/include/plumed/tools/Angle.h +52 -0
- plumed/_lib/include/plumed/tools/AtomDistribution.h +138 -0
- plumed/_lib/include/plumed/tools/AtomNumber.h +152 -0
- plumed/_lib/include/plumed/tools/BiasRepresentation.h +106 -0
- plumed/_lib/include/plumed/tools/BitmaskEnum.h +167 -0
- plumed/_lib/include/plumed/tools/Brent1DRootSearch.h +159 -0
- plumed/_lib/include/plumed/tools/CheckInRange.h +44 -0
- plumed/_lib/include/plumed/tools/Citations.h +74 -0
- plumed/_lib/include/plumed/tools/ColvarOutput.h +118 -0
- plumed/_lib/include/plumed/tools/Communicator.h +316 -0
- plumed/_lib/include/plumed/tools/ConjugateGradient.h +80 -0
- plumed/_lib/include/plumed/tools/DLLoader.h +79 -0
- plumed/_lib/include/plumed/tools/ERMSD.h +73 -0
- plumed/_lib/include/plumed/tools/Exception.h +406 -0
- plumed/_lib/include/plumed/tools/File.h +28 -0
- plumed/_lib/include/plumed/tools/FileBase.h +153 -0
- plumed/_lib/include/plumed/tools/FileTools.h +37 -0
- plumed/_lib/include/plumed/tools/ForwardDecl.h +54 -0
- plumed/_lib/include/plumed/tools/Grid.h +638 -0
- plumed/_lib/include/plumed/tools/HistogramBead.h +136 -0
- plumed/_lib/include/plumed/tools/IFile.h +117 -0
- plumed/_lib/include/plumed/tools/KernelFunctions.h +113 -0
- plumed/_lib/include/plumed/tools/Keywords.h +380 -0
- plumed/_lib/include/plumed/tools/LatticeReduction.h +66 -0
- plumed/_lib/include/plumed/tools/LeptonCall.h +64 -0
- plumed/_lib/include/plumed/tools/LinkCells.h +126 -0
- plumed/_lib/include/plumed/tools/Log.h +41 -0
- plumed/_lib/include/plumed/tools/LoopUnroller.h +163 -0
- plumed/_lib/include/plumed/tools/Matrix.h +721 -0
- plumed/_lib/include/plumed/tools/MatrixSquareBracketsAccess.h +138 -0
- plumed/_lib/include/plumed/tools/MergeVectorTools.h +153 -0
- plumed/_lib/include/plumed/tools/Minimise1DBrent.h +244 -0
- plumed/_lib/include/plumed/tools/MinimiseBase.h +120 -0
- plumed/_lib/include/plumed/tools/MolDataClass.h +51 -0
- plumed/_lib/include/plumed/tools/NeighborList.h +112 -0
- plumed/_lib/include/plumed/tools/OFile.h +286 -0
- plumed/_lib/include/plumed/tools/OpenACC.h +180 -0
- plumed/_lib/include/plumed/tools/OpenMP.h +75 -0
- plumed/_lib/include/plumed/tools/PDB.h +154 -0
- plumed/_lib/include/plumed/tools/Pbc.h +139 -0
- plumed/_lib/include/plumed/tools/PlumedHandle.h +105 -0
- plumed/_lib/include/plumed/tools/RMSD.h +493 -0
- plumed/_lib/include/plumed/tools/Random.h +80 -0
- plumed/_lib/include/plumed/tools/RootFindingBase.h +79 -0
- plumed/_lib/include/plumed/tools/Stopwatch.h +475 -0
- plumed/_lib/include/plumed/tools/Subprocess.h +142 -0
- plumed/_lib/include/plumed/tools/SwitchingFunction.h +208 -0
- plumed/_lib/include/plumed/tools/Tensor.h +724 -0
- plumed/_lib/include/plumed/tools/TokenizedLine.h +123 -0
- plumed/_lib/include/plumed/tools/Tools.h +638 -0
- plumed/_lib/include/plumed/tools/Torsion.h +55 -0
- plumed/_lib/include/plumed/tools/TrajectoryParser.h +118 -0
- plumed/_lib/include/plumed/tools/Tree.h +61 -0
- plumed/_lib/include/plumed/tools/TypesafePtr.h +463 -0
- plumed/_lib/include/plumed/tools/Units.h +167 -0
- plumed/_lib/include/plumed/tools/Vector.h +433 -0
- plumed/_lib/include/plumed/tools/View.h +296 -0
- plumed/_lib/include/plumed/tools/View2D.h +100 -0
- plumed/_lib/include/plumed/tools/h36.h +39 -0
- plumed/_lib/include/plumed/vatom/ActionWithVirtualAtom.h +32 -0
- plumed/_lib/include/plumed/ves/BasisFunctions.h +380 -0
- plumed/_lib/include/plumed/ves/CoeffsBase.h +310 -0
- plumed/_lib/include/plumed/ves/CoeffsMatrix.h +220 -0
- plumed/_lib/include/plumed/ves/CoeffsVector.h +251 -0
- plumed/_lib/include/plumed/ves/FermiSwitchingFunction.h +74 -0
- plumed/_lib/include/plumed/ves/GridIntegrationWeights.h +50 -0
- plumed/_lib/include/plumed/ves/GridLinearInterpolation.h +81 -0
- plumed/_lib/include/plumed/ves/GridProjWeights.h +61 -0
- plumed/_lib/include/plumed/ves/LinearBasisSetExpansion.h +303 -0
- plumed/_lib/include/plumed/ves/Optimizer.h +444 -0
- plumed/_lib/include/plumed/ves/TargetDistModifer.h +53 -0
- plumed/_lib/include/plumed/ves/TargetDistribution.h +266 -0
- plumed/_lib/include/plumed/ves/VesBias.h +545 -0
- plumed/_lib/include/plumed/ves/VesTools.h +142 -0
- plumed/_lib/include/plumed/ves/WaveletGrid.h +75 -0
- plumed/_lib/include/plumed/volumes/ActionVolume.h +268 -0
- plumed/_lib/include/plumed/volumes/VolumeShortcut.h +147 -0
- plumed/_lib/include/plumed/wrapper/Plumed.h +5025 -0
- plumed/_lib/include/plumed/xdrfile/xdrfile.h +663 -0
- plumed/_lib/include/plumed/xdrfile/xdrfile_trr.h +89 -0
- plumed/_lib/include/plumed/xdrfile/xdrfile_xtc.h +90 -0
- plumed/_lib/lib/PythonCVInterface.dylib +0 -0
- plumed/_lib/lib/libplumed.dylib +0 -0
- plumed/_lib/lib/libplumedKernel.dylib +0 -0
- plumed/_lib/lib/libplumedWrapper.a +0 -0
- plumed/_lib/lib/pkgconfig/plumed.pc +13 -0
- plumed/_lib/lib/pkgconfig/plumedInternals.pc +13 -0
- plumed/_lib/lib/pkgconfig/plumedWrapper.pc +13 -0
- plumed/_lib/lib/plumed/fortran/plumed.f90 +879 -0
- plumed/_lib/lib/plumed/fortran/plumed_f08.f90 +2625 -0
- plumed/_lib/lib/plumed/modulefile +69 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.config +43 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/CMakeLists.txt +543 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/CMakeLists.txt.preplumed +540 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.cpp +1628 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1590 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.h +103 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.h.preplumed +99 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/sim_util.cpp +2527 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2513 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.h +408 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +394 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/md.cpp +2348 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/md.cpp.preplumed +2091 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/minimize.cpp +3573 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3495 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.cpp +1506 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1402 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/rerun.cpp +997 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/rerun.cpp.preplumed +906 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/runner.cpp +2780 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/runner.cpp.preplumed +2738 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
- plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.config +43 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/CMakeLists.txt +549 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/CMakeLists.txt.preplumed +546 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.cpp +1632 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1594 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.h +104 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.h.preplumed +100 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/sim_util.cpp +2624 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2610 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.h +409 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +395 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/md.cpp +2419 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/md.cpp.preplumed +2164 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/minimize.cpp +3546 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3468 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.cpp +1513 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1409 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/rerun.cpp +991 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/rerun.cpp.preplumed +900 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/runner.cpp +2895 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/runner.cpp.preplumed +2849 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/decidegpuusage.cpp +886 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/decidegpuusage.cpp.preplumed +880 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h +347 -0
- plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h.preplumed +345 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.config +43 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/CMakeLists.txt +575 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/CMakeLists.txt.preplumed +572 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.cpp +1632 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1594 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.h +104 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.h.preplumed +100 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/sim_util.cpp +2564 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2550 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.h +410 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +396 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/md.cpp +2435 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/md.cpp.preplumed +2187 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/minimize.cpp +3592 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3514 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.cpp +1513 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1409 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/rerun.cpp +958 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/rerun.cpp.preplumed +929 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/runner.cpp +2987 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/runner.cpp.preplumed +2941 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/decidegpuusage.cpp +904 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/decidegpuusage.cpp.preplumed +898 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h +353 -0
- plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h.preplumed +351 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.config +39 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/cmake/gmxManagePlumed.cmake +82 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/cmake/gmxManagePlumed.cmake.preplumed +82 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedMDModule.cpp +162 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedMDModule.cpp.preplumed +154 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.cpp +107 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.cpp.preplumed +99 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.h +120 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.h.preplumed +111 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.cpp +215 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.cpp.preplumed +197 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.h +87 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.h.preplumed +86 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrun/runner.cpp +2971 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrun/runner.cpp.preplumed +2970 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrunutility/mdmodulesnotifiers.h +430 -0
- plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrunutility/mdmodulesnotifiers.h.preplumed +429 -0
- plumed/_lib/lib/plumed/patches/namd-2.12.config +30 -0
- plumed/_lib/lib/plumed/patches/namd-2.12.diff +267 -0
- plumed/_lib/lib/plumed/patches/namd-2.13.config +30 -0
- plumed/_lib/lib/plumed/patches/namd-2.13.diff +267 -0
- plumed/_lib/lib/plumed/patches/namd-2.14.config +30 -0
- plumed/_lib/lib/plumed/patches/namd-2.14.diff +268 -0
- plumed/_lib/lib/plumed/patches/patch.sh +500 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.config +25 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/forces.f90 +368 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/forces.f90.preplumed +366 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_forces.f90 +71 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_forces.f90.preplumed +24 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_initialization.f90 +62 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/pwscf.f90 +189 -0
- plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/pwscf.f90.preplumed +185 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.config +26 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/forces.f90 +422 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/forces.f90.preplumed +420 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_ext_forces.f90 +70 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_initialization.f90 +62 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/run_pwscf.f90 +233 -0
- plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/run_pwscf.f90.preplumed +230 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.config +28 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/Modules/Makefile +175 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/Modules/Makefile.preplumed +171 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/forces.f90 +486 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/forces.f90.preplumed +484 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_ext_forces.f90 +74 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_initialization.f90 +64 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/run_pwscf.f90 +532 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/run_pwscf.f90.preplumed +518 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.config +28 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/Modules/Makefile +249 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/Modules/Makefile.preplumed +244 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/forces.f90 +532 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/forces.f90.preplumed +535 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_ext_forces.f90 +74 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_initialization.f90 +64 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/run_pwscf.f90 +569 -0
- plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/run_pwscf.f90.preplumed +560 -0
- plumed/_lib/lib/plumed/plumed-config +9 -0
- plumed/_lib/lib/plumed/plumed-mklib +9 -0
- plumed/_lib/lib/plumed/plumed-newcv +9 -0
- plumed/_lib/lib/plumed/plumed-partial_tempering +9 -0
- plumed/_lib/lib/plumed/plumed-patch +9 -0
- plumed/_lib/lib/plumed/plumed-runtime +0 -0
- plumed/_lib/lib/plumed/plumed-selector +9 -0
- plumed/_lib/lib/plumed/plumed-vim2html +9 -0
- plumed/_lib/lib/plumed/scripts/config.sh +126 -0
- plumed/_lib/lib/plumed/scripts/mklib.sh +175 -0
- plumed/_lib/lib/plumed/scripts/newcv.sh +26 -0
- plumed/_lib/lib/plumed/scripts/partial_tempering.sh +319 -0
- plumed/_lib/lib/plumed/scripts/patch.sh +4 -0
- plumed/_lib/lib/plumed/scripts/selector.sh +234 -0
- plumed/_lib/lib/plumed/scripts/vim2html.sh +190 -0
- plumed/_lib/lib/plumed/src/colvar/Template.cpp +116 -0
- plumed/_lib/lib/plumed/src/config/compile_options.sh +3 -0
- plumed/_lib/lib/plumed/src/config/config.txt +181 -0
- plumed/_lib/lib/plumed/src/lib/Plumed.cmake +6 -0
- plumed/_lib/lib/plumed/src/lib/Plumed.cmake.runtime +5 -0
- plumed/_lib/lib/plumed/src/lib/Plumed.cmake.shared +5 -0
- plumed/_lib/lib/plumed/src/lib/Plumed.cmake.static +3 -0
- plumed/_lib/lib/plumed/src/lib/Plumed.inc +6 -0
- plumed/_lib/lib/plumed/src/lib/Plumed.inc.runtime +5 -0
- plumed/_lib/lib/plumed/src/lib/Plumed.inc.shared +5 -0
- plumed/_lib/lib/plumed/src/lib/Plumed.inc.static +3 -0
- plumed/_lib/lib/plumed/vim/scripts.vim +6 -0
- plumed/_plumed_core.cpython-311-darwin.so +0 -0
- plumed/_plumed_core.cpython-312-darwin.so +0 -0
- plumed/_plumed_core.cpython-313-darwin.so +0 -0
- plumedCommunications.cpython-311-darwin.so +0 -0
- plumedCommunications.cpython-312-darwin.so +0 -0
- plumedCommunications.cpython-313-darwin.so +0 -0
- plumedCommunications.pyi +431 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
2
|
+
Copyright (c) 2012-2023 The plumed team
|
|
3
|
+
(see the PEOPLE file at the root of the distribution for a list of names)
|
|
4
|
+
|
|
5
|
+
See http://www.plumed.org for more information.
|
|
6
|
+
|
|
7
|
+
This file is part of plumed, version 2.
|
|
8
|
+
|
|
9
|
+
plumed is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
11
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
(at your option) any later version.
|
|
13
|
+
|
|
14
|
+
plumed 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
|
|
17
|
+
GNU Lesser General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
20
|
+
along with plumed. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
|
22
|
+
#ifndef __PLUMED_tools_Exception_h
|
|
23
|
+
#define __PLUMED_tools_Exception_h
|
|
24
|
+
|
|
25
|
+
#include <exception>
|
|
26
|
+
#include <string>
|
|
27
|
+
#include <stdexcept>
|
|
28
|
+
#include <sstream>
|
|
29
|
+
#include <array>
|
|
30
|
+
|
|
31
|
+
namespace PLMD {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
\ingroup TOOLBOX
|
|
35
|
+
Class to deal with Plumed runtime errors.
|
|
36
|
+
|
|
37
|
+
This class and the related macros can be used to detect programming
|
|
38
|
+
errors. Typical cases are internal inconsistencies or errors in the plumed<->MD
|
|
39
|
+
interface. Mistakes made by final users (i.e. in the `plumed.dat` file)
|
|
40
|
+
should probably be documented in some better way (e.g. printing parts of the manual in the output).
|
|
41
|
+
However, also this class allows for significant information to be attached.
|
|
42
|
+
Let's try to make error messages as informative as possible!
|
|
43
|
+
|
|
44
|
+
\note This class has been rewritten in PLUMED 2.5. It works in a backward compatible manner,
|
|
45
|
+
but is much more flexible. The main novelty is that we can use insertion operators to
|
|
46
|
+
add arbitrary messages, as in `plumed_error()<<"check this vector "<<v;`
|
|
47
|
+
See below for more details.
|
|
48
|
+
|
|
49
|
+
To throw an error, just throw a c++ exception
|
|
50
|
+
\verbatim
|
|
51
|
+
if(something_bad) throw Exception();
|
|
52
|
+
\endverbatim
|
|
53
|
+
or better add an error message to that
|
|
54
|
+
\verbatim
|
|
55
|
+
if(something_bad) throw Exception("describe the error here");
|
|
56
|
+
\endverbatim
|
|
57
|
+
|
|
58
|
+
As of PLUMED 2.5 you can add multiple messages, they will just be concatenated,
|
|
59
|
+
but to do se you should use the insertion operator. Notice that anything that
|
|
60
|
+
can be formatted with an insertion operator can go to the exception, even a \ref Vector
|
|
61
|
+
\verbatim
|
|
62
|
+
Vector v;
|
|
63
|
+
if(something_bad) throw Exception()<<"problem with this "<<v;
|
|
64
|
+
\endverbatim
|
|
65
|
+
In principle you can mix the two syntax (add a message as an argument and insert others with `<<`),
|
|
66
|
+
however it is not very clear and should be avoided.
|
|
67
|
+
We only allow using arguments in parenthesis in order to keep backward compatibility.
|
|
68
|
+
|
|
69
|
+
\par Using macros
|
|
70
|
+
|
|
71
|
+
In order to provide more context, especially for debugging, it might be useful to know where the exception
|
|
72
|
+
originated from. The macros below add information about the exact location of the error in the file (filename, line
|
|
73
|
+
and, when available, function name). Macros ending in "error" unconditionally throw
|
|
74
|
+
the exception, whereas macros ending in "assert" first perform a conditional check
|
|
75
|
+
(similarly to standard assert()).
|
|
76
|
+
An extra `m` in the name (e.g. `plumed_merror`) indicates a macro that provides a message as its argument.
|
|
77
|
+
However, as of PLUMED 2.5 we should prefer adding messages using insertion operators.
|
|
78
|
+
\verbatim
|
|
79
|
+
// this is correct but not recommended. add a message please!
|
|
80
|
+
plumed_assert(a>0);
|
|
81
|
+
|
|
82
|
+
// this is the old syntax (with argument).
|
|
83
|
+
// this syntax is basically available for backward compatibility.
|
|
84
|
+
plumed_massert(a>0,"a should be larger than zero);
|
|
85
|
+
|
|
86
|
+
// this is the recommended syntax, with insertion operators.
|
|
87
|
+
// it allows to easily insert multiple objects
|
|
88
|
+
plumed_assert(a>0)<<"a should be larger than zero. a="<<a;
|
|
89
|
+
|
|
90
|
+
// same as above, but the test is made explicitly:
|
|
91
|
+
if(a<=0) plumed_error();
|
|
92
|
+
if(a<=0) plumed_error("a should be larger than zero);
|
|
93
|
+
if(a<=0) plumed_error()<<"a should be larger than zero. a="<<a;
|
|
94
|
+
\endverbatim
|
|
95
|
+
|
|
96
|
+
The additional macros
|
|
97
|
+
plumed_dbg_assert() and plumed_dbg_massert() are similar
|
|
98
|
+
to plumed_assert() and plumed_massert() respectively, but the corresponding
|
|
99
|
+
check is only performed when NDEBUG macro is not defined. They should
|
|
100
|
+
be used when the check is expensive and should be skipped in production
|
|
101
|
+
code. So, for instance, in the following case:
|
|
102
|
+
\verbatim
|
|
103
|
+
plumed_dbg_assert(expensive_function(i)>0)<<"message";
|
|
104
|
+
\endverbatim
|
|
105
|
+
`expensive_function()` is not called in the production code.
|
|
106
|
+
Notice that the compiler should be able to completely optimize away the
|
|
107
|
+
whole statement including functions used to produce the message as in this example:
|
|
108
|
+
\verbatim
|
|
109
|
+
plumed_dbg_assert(expensive_function(i)>0)<<"I did this check "<<other_expensive_function(i);
|
|
110
|
+
\endverbatim
|
|
111
|
+
|
|
112
|
+
Finally, notice that there is another macro available, \ref plumed_here.
|
|
113
|
+
In can be used in order to create an exception with information about the
|
|
114
|
+
line/file coordinates without trowing it. That is, the two following syntaxes
|
|
115
|
+
are equivalent
|
|
116
|
+
\verbatim
|
|
117
|
+
// First way, all at once
|
|
118
|
+
plumed_error()<<"some message";
|
|
119
|
+
/////////////////////////////////
|
|
120
|
+
// Second way, one step at a time
|
|
121
|
+
// Create exception
|
|
122
|
+
Exception e;
|
|
123
|
+
// Append information about line and file
|
|
124
|
+
e<<plumed_here;
|
|
125
|
+
// Append some other message
|
|
126
|
+
e<<"some message";
|
|
127
|
+
// Throw the resulting exception
|
|
128
|
+
throw e;
|
|
129
|
+
\endverbatim
|
|
130
|
+
|
|
131
|
+
Exceptions can be caught within plumed or outside of it.
|
|
132
|
+
E.g., in an external c++ code using PLUMED as a library, one can type
|
|
133
|
+
\verbatim
|
|
134
|
+
try{
|
|
135
|
+
plumed.cmd("setPrecision",n);
|
|
136
|
+
} catch (const std::exception & e) {
|
|
137
|
+
std::printf("ee %s",e.what());
|
|
138
|
+
exit(1);
|
|
139
|
+
}
|
|
140
|
+
\endverbatim
|
|
141
|
+
This can be useful if an external code wants to exit in a controlled manner
|
|
142
|
+
(e.g. flushing files, printing the error message in a specific file, etc.)
|
|
143
|
+
but is anyway limited to c++ codes. Moreover,
|
|
144
|
+
since these errors are expected to be unrecoverable, the MD code will
|
|
145
|
+
usually not be able to do something more clever than exiting.
|
|
146
|
+
|
|
147
|
+
\note
|
|
148
|
+
We store message and stack trace in growing strings. This is in
|
|
149
|
+
principle not recommended, since copying the exception might fail if
|
|
150
|
+
copying the string throw another exception. However, this has been like
|
|
151
|
+
this in all previous PLUMED versions. In case it is necessary, we can replace
|
|
152
|
+
it later with a fixed size array placed on the stack.
|
|
153
|
+
|
|
154
|
+
*/
|
|
155
|
+
class Exception : public std::exception {
|
|
156
|
+
/// Reported message. Can be updated.
|
|
157
|
+
std::string msg;
|
|
158
|
+
/// Flag to remember if we have to write the `+++ message follows +++` string.
|
|
159
|
+
/// Needed so that the string appears only at the beginning of the message.
|
|
160
|
+
bool note=true;
|
|
161
|
+
/// Stream used to insert objects.
|
|
162
|
+
/// It is not copied when the Exception is copied.
|
|
163
|
+
std::stringstream stream;
|
|
164
|
+
/// Stack trace, computed at construction
|
|
165
|
+
std::array<void*,128> callstack;
|
|
166
|
+
/// Number of frames in stack, computed at construction
|
|
167
|
+
int callstack_n=0;
|
|
168
|
+
/// Parsed stack trace. Built at first use, thus mutable.
|
|
169
|
+
mutable std::string stackTrace;
|
|
170
|
+
|
|
171
|
+
public:
|
|
172
|
+
|
|
173
|
+
/// Auxiliary containing the location of the exception in the file.
|
|
174
|
+
/// Typically used from the macros below.
|
|
175
|
+
class Location {
|
|
176
|
+
public:
|
|
177
|
+
const char*file;
|
|
178
|
+
const unsigned line;
|
|
179
|
+
const char* pretty;
|
|
180
|
+
explicit Location(const char*fileName,unsigned lineN,const char* prettyName=nullptr):
|
|
181
|
+
file(fileName),
|
|
182
|
+
line(lineN),
|
|
183
|
+
pretty(prettyName)
|
|
184
|
+
{}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/// Auxiliary containing the failed assertion.
|
|
188
|
+
/// Typically used from the macros below.
|
|
189
|
+
class Assertion {
|
|
190
|
+
public:
|
|
191
|
+
const char*assertion;
|
|
192
|
+
explicit Assertion(const char*assertionText=nullptr):
|
|
193
|
+
assertion(assertionText)
|
|
194
|
+
{}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/// Auxiliary class used to throw exceptions.
|
|
198
|
+
/// It just defines <<= operator so that:
|
|
199
|
+
/// - exceptions can be thrown calling std::throw_with_nested
|
|
200
|
+
/// with a "throw like" syntax
|
|
201
|
+
/// - precedence is the same as the throw operator
|
|
202
|
+
/// (see https://en.cppreference.com/w/cpp/language/operator_precedence)
|
|
203
|
+
class Throw {
|
|
204
|
+
public:
|
|
205
|
+
template <typename E>
|
|
206
|
+
[[noreturn]] void operator <<=(E&&e) {
|
|
207
|
+
if(std::current_exception()) {
|
|
208
|
+
std::throw_with_nested(e);
|
|
209
|
+
} else {
|
|
210
|
+
// if not nested, avoid modifying the exception type
|
|
211
|
+
throw e;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/// Default constructor with no message.
|
|
217
|
+
/// Only records the stack trace.
|
|
218
|
+
Exception();
|
|
219
|
+
|
|
220
|
+
/// Constructor compatible with PLUMED <=2.4.
|
|
221
|
+
explicit Exception(const std::string & message):
|
|
222
|
+
Exception() {
|
|
223
|
+
*this << message;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/// Copy constructor.
|
|
227
|
+
/// Needed to make sure stream is not copied
|
|
228
|
+
Exception(const Exception & e):
|
|
229
|
+
msg(e.msg),
|
|
230
|
+
note(e.note),
|
|
231
|
+
callstack(e.callstack),
|
|
232
|
+
callstack_n(e.callstack_n),
|
|
233
|
+
stackTrace(e.stackTrace) {
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/// Assignment.
|
|
237
|
+
/// Needed to make sure stream is not copied
|
|
238
|
+
Exception & operator=(const Exception & e) {
|
|
239
|
+
msg=e.msg;
|
|
240
|
+
note=e.note;
|
|
241
|
+
callstack=e.callstack;
|
|
242
|
+
callstack_n=e.callstack_n;
|
|
243
|
+
stackTrace=e.stackTrace;
|
|
244
|
+
stream.str("");
|
|
245
|
+
return *this;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/// Returns the error message.
|
|
249
|
+
/// In case the environment variable PLUMED_STACK_TRACE was defined
|
|
250
|
+
/// and equal to `yes` when the exception was raised,
|
|
251
|
+
/// the error message will contain the stack trace as well.
|
|
252
|
+
const char* what() const noexcept override {
|
|
253
|
+
return msg.c_str();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/// Returns the stack trace as a string.
|
|
257
|
+
/// This function is slow as it requires building a parsed string.
|
|
258
|
+
/// If storing the stack for later usage, you might prefer to use trace().
|
|
259
|
+
const char* stack() const;
|
|
260
|
+
|
|
261
|
+
/// Returns the callstack.
|
|
262
|
+
const std::array<void*,128> & trace() const noexcept {
|
|
263
|
+
return callstack;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/// Returns the number of elements in the trace array
|
|
267
|
+
int trace_n() const noexcept {
|
|
268
|
+
return callstack_n;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/// Destructor should be defined and should not throw other exceptions
|
|
272
|
+
~Exception() noexcept override {}
|
|
273
|
+
|
|
274
|
+
/// Insert location.
|
|
275
|
+
/// Format the location properly.
|
|
276
|
+
Exception& operator<<(const Location&);
|
|
277
|
+
|
|
278
|
+
/// Insert assertion.
|
|
279
|
+
/// Format the assertion properly
|
|
280
|
+
Exception& operator<<(const Assertion&);
|
|
281
|
+
|
|
282
|
+
/// Insert string.
|
|
283
|
+
/// Append this string to the message.
|
|
284
|
+
Exception& operator<<(const std::string&);
|
|
285
|
+
|
|
286
|
+
/// Insert anything else.
|
|
287
|
+
/// This allows to dump also other types (e.g. double, or even Vector).
|
|
288
|
+
/// Anything that can be written on a stream can go here.
|
|
289
|
+
template<typename T>
|
|
290
|
+
Exception& operator<<(const T & x) {
|
|
291
|
+
stream<<x;
|
|
292
|
+
(*this)<<stream.str();
|
|
293
|
+
stream.str("");
|
|
294
|
+
return *this;
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
/// Class representing a generic error
|
|
299
|
+
class ExceptionError :
|
|
300
|
+
public Exception {
|
|
301
|
+
public:
|
|
302
|
+
using Exception::Exception;
|
|
303
|
+
template<typename T>
|
|
304
|
+
ExceptionError& operator<<(const T & x) {
|
|
305
|
+
*static_cast<Exception*>(this) <<x;
|
|
306
|
+
return *this;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
/// Class representing a debug error (can only be thrown when using debug options)
|
|
311
|
+
class ExceptionDebug :
|
|
312
|
+
public Exception {
|
|
313
|
+
public:
|
|
314
|
+
using Exception::Exception;
|
|
315
|
+
template<typename T>
|
|
316
|
+
ExceptionDebug& operator<<(const T & x) {
|
|
317
|
+
*static_cast<Exception*>(this) <<x;
|
|
318
|
+
return *this;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
/// Class representing a type error in the PLMD::Plumed interface
|
|
323
|
+
class ExceptionTypeError :
|
|
324
|
+
public Exception {
|
|
325
|
+
public:
|
|
326
|
+
using Exception::Exception;
|
|
327
|
+
template<typename T>
|
|
328
|
+
ExceptionTypeError& operator<<(const T & x) {
|
|
329
|
+
*static_cast<Exception*>(this) <<x;
|
|
330
|
+
return *this;
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
#ifdef __GNUG__
|
|
335
|
+
// With GNU compiler, we can use __PRETTY_FUNCTION__ to get the function name
|
|
336
|
+
#define __PLUMED_FUNCNAME __PRETTY_FUNCTION__
|
|
337
|
+
#else
|
|
338
|
+
// Otherwise, we use the standard C++11 variable
|
|
339
|
+
#define __PLUMED_FUNCNAME __func__
|
|
340
|
+
#endif
|
|
341
|
+
|
|
342
|
+
#ifndef PLUMED_MODULE_DIR
|
|
343
|
+
#define PLUMED_MODULE_DIR ""
|
|
344
|
+
#endif
|
|
345
|
+
|
|
346
|
+
/// \relates PLMD::Exception
|
|
347
|
+
/// Auxiliary macro that generates a PLMD::Exception::Location object.
|
|
348
|
+
/// Might be useful if we want to use derived exceptions that could
|
|
349
|
+
/// be thrown using `throw DerivedException()<<plumed_here<<" "<<other stuff"`.
|
|
350
|
+
/// It is used in the macros below to throw PLMD::Exception.
|
|
351
|
+
#define plumed_here PLMD::Exception::Location(PLUMED_MODULE_DIR __FILE__,__LINE__,__PLUMED_FUNCNAME)
|
|
352
|
+
|
|
353
|
+
/// \relates PLMD::Exception
|
|
354
|
+
/// Throw an exception with information about the position in the file.
|
|
355
|
+
/// Messages can be inserted with `plumed_error()<<"message"`.
|
|
356
|
+
#define plumed_error() throw PLMD::ExceptionError() << plumed_here
|
|
357
|
+
|
|
358
|
+
/// \relates PLMD::Exception
|
|
359
|
+
/// Throw a nested exception with information about the position in the file.
|
|
360
|
+
/// It preliminary checks if we are in a catch block. If so, the caught exception
|
|
361
|
+
/// is rethrown as nested. If not, it throws a normal ExceptionError.
|
|
362
|
+
/// NB in theory we could have just redefined plumed_error to this, but
|
|
363
|
+
/// for some reason cppcheck does not understand that the <<= operator used here is
|
|
364
|
+
/// [[noreturn]] and thus gives many false warnings
|
|
365
|
+
#define plumed_error_nested() PLMD::Exception::Throw() <<= PLMD::ExceptionError() << plumed_here
|
|
366
|
+
|
|
367
|
+
/// \relates PLMD::Exception
|
|
368
|
+
/// Throw an exception with information about the position in the file
|
|
369
|
+
/// and a message. Mostly available for backward compatibility
|
|
370
|
+
#define plumed_merror(msg) plumed_error() << msg
|
|
371
|
+
|
|
372
|
+
/// \relates PLMD::Exception
|
|
373
|
+
/// Launches plumed_merror only if test evaluates to false.
|
|
374
|
+
/// The string describing the test is also reported.
|
|
375
|
+
/// Further messages can be inserted with `<<`.
|
|
376
|
+
#define plumed_assert(test) if(!(test)) plumed_error() << PLMD::Exception::Assertion(#test)
|
|
377
|
+
|
|
378
|
+
/// \relates PLMD::Exception
|
|
379
|
+
/// Launches plumed_merror only if test evaluates to false.
|
|
380
|
+
/// The string describing the test is also reported, in addition to
|
|
381
|
+
/// messages reported in the extra argument. Mostly available for backward compatibility.
|
|
382
|
+
#define plumed_massert(test,msg) plumed_assert(test) << msg
|
|
383
|
+
|
|
384
|
+
#ifdef NDEBUG
|
|
385
|
+
|
|
386
|
+
// These are the versions used when compiling with NDEBUG flag.
|
|
387
|
+
// The if constexpr(false) gurarantees that the compiler will optimize away the assertion
|
|
388
|
+
// We are not using an empty macro becasue the user may want to use the << operator
|
|
389
|
+
|
|
390
|
+
#define plumed_dbg_assert(test) if constexpr(false) plumed_assert(true)
|
|
391
|
+
#define plumed_dbg_massert(test,msg) if constexpr(false) plumed_massert(true,msg)
|
|
392
|
+
|
|
393
|
+
#else
|
|
394
|
+
|
|
395
|
+
/// \relates PLMD::Exception
|
|
396
|
+
/// Same as \ref plumed_assert, but only evaluates the condition if NDEBUG is not defined.
|
|
397
|
+
#define plumed_dbg_assert(test) if(!(test)) PLMD::Exception::Throw() <<= PLMD::ExceptionDebug() << plumed_here << PLMD::Exception::Assertion(#test) << "(this check is enabled only in debug builds)\n"
|
|
398
|
+
|
|
399
|
+
/// \relates PLMD::Exception
|
|
400
|
+
/// Same as \ref plumed_massert, but only evaluates the condition if NDEBUG is not defined.
|
|
401
|
+
#define plumed_dbg_massert(test,msg) plumed_dbg_assert(test) << msg
|
|
402
|
+
|
|
403
|
+
#endif
|
|
404
|
+
|
|
405
|
+
}
|
|
406
|
+
#endif
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
2
|
+
Copyright (c) 2012-2023 The plumed team
|
|
3
|
+
(see the PEOPLE file at the root of the distribution for a list of names)
|
|
4
|
+
|
|
5
|
+
See http://www.plumed.org for more information.
|
|
6
|
+
|
|
7
|
+
This file is part of plumed, version 2.
|
|
8
|
+
|
|
9
|
+
plumed is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
11
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
(at your option) any later version.
|
|
13
|
+
|
|
14
|
+
plumed 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
|
|
17
|
+
GNU Lesser General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
20
|
+
along with plumed. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
|
22
|
+
#ifndef __PLUMED_tools_File_h
|
|
23
|
+
#define __PLUMED_tools_File_h
|
|
24
|
+
|
|
25
|
+
#include "IFile.h"
|
|
26
|
+
#include "OFile.h"
|
|
27
|
+
|
|
28
|
+
#endif
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
2
|
+
Copyright (c) 2012-2023 The plumed team
|
|
3
|
+
(see the PEOPLE file at the root of the distribution for a list of names)
|
|
4
|
+
|
|
5
|
+
See http://www.plumed.org for more information.
|
|
6
|
+
|
|
7
|
+
This file is part of plumed, version 2.
|
|
8
|
+
|
|
9
|
+
plumed is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
11
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
(at your option) any later version.
|
|
13
|
+
|
|
14
|
+
plumed 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
|
|
17
|
+
GNU Lesser General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
20
|
+
along with plumed. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
|
22
|
+
#ifndef __PLUMED_tools_FileBase_h
|
|
23
|
+
#define __PLUMED_tools_FileBase_h
|
|
24
|
+
|
|
25
|
+
#include <string>
|
|
26
|
+
|
|
27
|
+
namespace PLMD {
|
|
28
|
+
|
|
29
|
+
class Communicator;
|
|
30
|
+
class PlumedMain;
|
|
31
|
+
class Action;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
Base class for dealing with files.
|
|
35
|
+
|
|
36
|
+
This class just provides things which are common among OFile and IFile
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
class FileBase {
|
|
40
|
+
/// Copy constructor is disabled
|
|
41
|
+
FileBase(const FileBase&) = delete;
|
|
42
|
+
/// Assignment operator is disabled
|
|
43
|
+
FileBase& operator=(const FileBase&) = delete;
|
|
44
|
+
protected:
|
|
45
|
+
/// Internal tool.
|
|
46
|
+
/// Base for IFile::Field and OFile::Field
|
|
47
|
+
struct FieldBase {
|
|
48
|
+
// everything is public to simplify usage
|
|
49
|
+
std::string name;
|
|
50
|
+
std::string value;
|
|
51
|
+
bool constant=false;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/// file pointer
|
|
55
|
+
FILE* fp;
|
|
56
|
+
/// zip file pointer.
|
|
57
|
+
void* gzfp;
|
|
58
|
+
/// communicator. NULL if not set
|
|
59
|
+
Communicator* comm;
|
|
60
|
+
/// pointer to main plumed object. NULL if not linked
|
|
61
|
+
PlumedMain* plumed;
|
|
62
|
+
/// pointer to corresponding action. NULL if not linked
|
|
63
|
+
Action* action;
|
|
64
|
+
/// Control closing on destructor.
|
|
65
|
+
/// If true, file will not be closed in destructor
|
|
66
|
+
bool cloned;
|
|
67
|
+
/// Private constructor.
|
|
68
|
+
/// In this manner one cannot instantiate a FileBase object
|
|
69
|
+
FileBase();
|
|
70
|
+
/// Set to true when end of file is encountered
|
|
71
|
+
bool eof;
|
|
72
|
+
/// Set to true when error is encountered
|
|
73
|
+
bool err;
|
|
74
|
+
/// path of the opened file
|
|
75
|
+
std::string path;
|
|
76
|
+
/// mode of the opened file
|
|
77
|
+
std::string mode;
|
|
78
|
+
/// Set to true if you want flush to be heavy (close/reopen)
|
|
79
|
+
bool heavyFlush;
|
|
80
|
+
public:
|
|
81
|
+
/// Append suffix.
|
|
82
|
+
/// It appends the desired suffix to the string. Notice that
|
|
83
|
+
/// it conserves some suffix (e.g. gz/xtc/trr).
|
|
84
|
+
static std::string appendSuffix(const std::string&path,
|
|
85
|
+
const std::string&suffix);
|
|
86
|
+
private:
|
|
87
|
+
/// Enforced suffix:
|
|
88
|
+
std::string enforcedSuffix;
|
|
89
|
+
/// If true, use enforcedSuffix, else get it from PlumedMain
|
|
90
|
+
bool enforcedSuffix_;
|
|
91
|
+
public:
|
|
92
|
+
/// Link to an already open filed
|
|
93
|
+
FileBase& link(FILE*);
|
|
94
|
+
/// Link to a PlumedMain object
|
|
95
|
+
/// Automatically links also the corresponding Communicator.
|
|
96
|
+
FileBase& link(PlumedMain&);
|
|
97
|
+
/// Link to a Communicator object
|
|
98
|
+
FileBase& link(Communicator&);
|
|
99
|
+
/// Link to an Action object.
|
|
100
|
+
/// Automatically links also the corresponding PlumedMain and Communicator.
|
|
101
|
+
FileBase& link(Action&);
|
|
102
|
+
/// Enforce suffix.
|
|
103
|
+
/// Overrides the one set in PlumedMain&
|
|
104
|
+
FileBase& enforceSuffix(const std::string&suffix);
|
|
105
|
+
/// Flushes the file to disk
|
|
106
|
+
virtual FileBase& flush();
|
|
107
|
+
/// Closes the file
|
|
108
|
+
/// Should be used only for explicitely opened files.
|
|
109
|
+
void close();
|
|
110
|
+
/// Virtual destructor (allows inheritance)
|
|
111
|
+
virtual ~FileBase();
|
|
112
|
+
/// Check for error/eof.
|
|
113
|
+
operator bool () const;
|
|
114
|
+
/// Set heavyFlush flag
|
|
115
|
+
void setHeavyFlush() {
|
|
116
|
+
heavyFlush=true;
|
|
117
|
+
}
|
|
118
|
+
/// Opens the file
|
|
119
|
+
virtual FileBase& open(const std::string&name)=0;
|
|
120
|
+
/// Check if the file exists
|
|
121
|
+
bool FileExist(const std::string& path);
|
|
122
|
+
/// Check if a file is open
|
|
123
|
+
bool isOpen();
|
|
124
|
+
/// Retrieve the path
|
|
125
|
+
std::string getPath()const;
|
|
126
|
+
/// Retrieve the mode
|
|
127
|
+
std::string getMode()const;
|
|
128
|
+
/// Get the file suffix
|
|
129
|
+
std::string getSuffix()const;
|
|
130
|
+
/// Get the underlying file pointer.
|
|
131
|
+
/// It might be null even if the file is open, e.g. when the file
|
|
132
|
+
/// was open as a gzipped file.
|
|
133
|
+
FILE* getFILE()const;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
inline
|
|
137
|
+
std::string FileBase::getPath()const {
|
|
138
|
+
return path;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
inline
|
|
142
|
+
std::string FileBase::getMode()const {
|
|
143
|
+
return mode;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
inline
|
|
147
|
+
FILE* FileBase::getFILE()const {
|
|
148
|
+
return fp;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
#endif
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
2
|
+
Copyright (c) 2025 The plumed team
|
|
3
|
+
(see the PEOPLE file at the root of the distribution for a list of names)
|
|
4
|
+
|
|
5
|
+
See http://www.plumed.org for more information.
|
|
6
|
+
|
|
7
|
+
This file is part of plumed, version 2.
|
|
8
|
+
|
|
9
|
+
plumed is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
11
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
(at your option) any later version.
|
|
13
|
+
|
|
14
|
+
plumed 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
|
|
17
|
+
GNU Lesser General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
20
|
+
along with plumed. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
|
22
|
+
#ifndef __PLUMED_tools_FileTools_h
|
|
23
|
+
#define __PLUMED_tools_FileTools_h
|
|
24
|
+
#include <memory>
|
|
25
|
+
#include <cstdio>
|
|
26
|
+
namespace PLMD {
|
|
27
|
+
|
|
28
|
+
struct fileDeleter {
|
|
29
|
+
void operator()(FILE* fp) {
|
|
30
|
+
std::fclose(fp);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
// call fclose when this goes out of scope
|
|
34
|
+
using unique_FILE = std::unique_ptr<FILE,fileDeleter>;
|
|
35
|
+
}
|
|
36
|
+
#endif //
|
|
37
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
2
|
+
Copyright (c) 2017-2023 The plumed team
|
|
3
|
+
(see the PEOPLE file at the root of the distribution for a list of names)
|
|
4
|
+
|
|
5
|
+
See http://www.plumed.org for more information.
|
|
6
|
+
|
|
7
|
+
This file is part of plumed, version 2.
|
|
8
|
+
|
|
9
|
+
plumed is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
11
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
(at your option) any later version.
|
|
13
|
+
|
|
14
|
+
plumed 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
|
|
17
|
+
GNU Lesser General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
20
|
+
along with plumed. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
|
22
|
+
#ifndef __PLUMED_tools_ForwardDecl_h
|
|
23
|
+
#define __PLUMED_tools_ForwardDecl_h
|
|
24
|
+
|
|
25
|
+
#include <memory>
|
|
26
|
+
#include <utility>
|
|
27
|
+
|
|
28
|
+
namespace PLMD {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
Utility class for forward declaration of references.
|
|
32
|
+
|
|
33
|
+
*/
|
|
34
|
+
template <class T>
|
|
35
|
+
class ForwardDecl:
|
|
36
|
+
std::unique_ptr<T> {
|
|
37
|
+
public:
|
|
38
|
+
// Construction with arbitrary argument.
|
|
39
|
+
template<typename ...Args>
|
|
40
|
+
explicit ForwardDecl(Args &&...args);
|
|
41
|
+
// Dereference operator is inherited from std::unique_ptr<T>
|
|
42
|
+
using std::unique_ptr<T>::operator *;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
template <class T>
|
|
46
|
+
template<typename ...Args>
|
|
47
|
+
ForwardDecl<T>::ForwardDecl(Args &&...args):
|
|
48
|
+
std::unique_ptr<T>(std::make_unique<T>(std::forward<Args>(args)...))
|
|
49
|
+
{}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#endif
|