From 3b3f0e2cdb1992909cdc285ea54986e833f4f749 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi Date: Tue, 3 Sep 2024 17:37:06 +0200 Subject: [PATCH 01/46] switch master to 2.11 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 7d6c799dbb..962d221c9f 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -5,4 +5,4 @@ # (this is same as gromacs) # Notice that "plumed info --version" will return only 2.X # and "plumed info --long-version" will return the full string -2.10.0-dev +2.11.0-dev From 669793fc2818012bbd60c39882031e92ae5c5f4d Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Wed, 4 Sep 2024 10:32:16 +0100 Subject: [PATCH 02/46] Added missing keywords to MultiColvarDensity --- src/gridtools/MultiColvarDensity.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gridtools/MultiColvarDensity.cpp b/src/gridtools/MultiColvarDensity.cpp index a51b83f557..c3104903fd 100644 --- a/src/gridtools/MultiColvarDensity.cpp +++ b/src/gridtools/MultiColvarDensity.cpp @@ -94,6 +94,8 @@ void MultiColvarDensity::registerKeywords( Keywords& keys ) { keys.add("compulsory","KERNEL","GAUSSIAN","the kernel function you are using. More details on the kernels available " "in plumed plumed can be found in \\ref kernelfunctions."); keys.add("optional","NBINS","the number of bins to use in each direction (alternative to GRID_NBIN)"); + keys.add("optional","GRID_MIN","the lower bounds for the grid (default boxlengths)"); + keys.add("optional","GRID_MAX","the upper bounds for the grid (default boxlengths)"); keys.add("optional","DATA","the multicolvar which you would like to calculate the density profile for"); keys.add("optional","ATOMS","if you are calculating a atomic density you use this keyword to specify the atoms that are involved"); keys.addFlag("UNORMALIZED",false,"do not divide by the density"); From bda149187c70f0e769c00bc9d22a60600634cf1f Mon Sep 17 00:00:00 2001 From: Gareth Tribello Date: Fri, 13 Sep 2024 08:00:27 +0100 Subject: [PATCH 03/46] Update SwitchingFunction.cpp Fixed a typo in the documentation for the cosinus switching function. --- src/tools/SwitchingFunction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/SwitchingFunction.cpp b/src/tools/SwitchingFunction.cpp index 99cf034a1f..3339c2ec3b 100644 --- a/src/tools/SwitchingFunction.cpp +++ b/src/tools/SwitchingFunction.cpp @@ -113,7 +113,7 @@ s(r) = 1 - \tanh\left( \frac{ r - d_0 }{ r_0 } \right) \f$s(r) =\left\{\begin{array}{ll} 1 & \mathrm{if } r \leq d_0 \\ 0.5 \left( \cos ( \frac{ r - d_0 }{ r_0 } \pi ) + 1 \right) & \mathrm{if } d_0 < r\leq d_0 + r_0 \\ - 0 & \mathrm{if } r < d_0 + r_0 + 0 & \mathrm{if } r > d_0 + r_0 \end{array}\right. \f$ From 5eabea99100abc4871ffbd3c13c9534e2f4e9edf Mon Sep 17 00:00:00 2001 From: Gareth Tribello Date: Tue, 1 Oct 2024 08:25:22 +0100 Subject: [PATCH 04/46] Improvmements to documentation by adding types of value (#1106) * Added value types to documentation for components * Documentation now contains the types of the input arguments that are being passed to actions * Fix to type for ARG keyword in EMMI * Updated ARG keyword documentation in PythonFunction for pycv * Made ARG keyword optional in PythonFunction as is required to pass tests * Added types for MassCharge input action --------- Co-authored-by: Gareth Aneurin Tribello Co-authored-by: Gareth Aneurin Tribello --- plugins/pycv/PythonFunction.cpp | 3 +- regtest/basic/rt-make-load/Distance10.cpp | 1 + regtest/basic/rt-make-load/Distance20.cpp | 1 + regtest/basic/rt15-mklib/Distance2.cpp | 1 + regtest/basic/rt15/Distance2.cpp | 1 + regtest/basic/rt15/Distance3.cpp | 1 + .../rt-parse-only/shortcuts.json.reference | 2 +- .../rt-parse-only/values.json.reference | 6 -- .../rt-parse-only/shortcuts.json.reference | 2 +- .../rt-parse-only/shortcuts.json.reference | 2 +- .../rt-parse-only/shortcuts.json.reference | 2 +- src/adjmat/AdjacencyMatrixBase.cpp | 12 ++-- src/adjmat/Bridge.cpp | 2 +- src/adjmat/Neighbors.cpp | 5 +- src/adjmat/TorsionsMatrix.cpp | 5 +- src/annfunc/ANN.cpp | 4 +- src/bias/ABMD.cpp | 5 +- src/bias/Bias.cpp | 3 +- src/bias/BiasValue.cpp | 4 +- src/bias/ExtendedLagrangian.cpp | 5 +- src/bias/External.cpp | 1 - src/bias/LWalls.cpp | 4 +- src/bias/MaxEnt.cpp | 11 ++-- src/bias/MetaD.cpp | 19 +++--- src/bias/MovingRestraint.cpp | 11 ++-- src/bias/PBMetaD.cpp | 3 +- src/bias/Restraint.cpp | 5 +- src/bias/RestraintShortcut.cpp | 6 +- src/bias/ReweightBias.cpp | 6 +- src/bias/ReweightMetad.cpp | 6 +- src/bias/ReweightTemperaturePressure.cpp | 7 +- src/bias/UWalls.cpp | 4 +- src/bias/Walls.cpp | 6 +- src/cltools/GenJson.cpp | 5 +- src/clusters/ClusterDiameter.cpp | 2 +- src/clusters/ClusterDistribution.cpp | 6 +- src/clusters/ClusterNatoms.cpp | 2 +- src/clusters/ClusterProperties.cpp | 1 + src/clusters/ClusterWeights.cpp | 6 +- src/clusters/ClusterWithSurface.cpp | 2 +- src/clusters/ClusteringBase.cpp | 4 +- src/colvar/Angle.cpp | 2 +- src/colvar/Cell.cpp | 18 ++--- src/colvar/ContactMap.cpp | 3 +- src/colvar/Coordination.cpp | 2 +- src/colvar/DHEnergy.cpp | 2 +- src/colvar/DRMSD.cpp | 2 +- src/colvar/DihedralCorrelation.cpp | 2 +- src/colvar/Dimer.cpp | 2 +- src/colvar/Dipole.cpp | 8 +-- src/colvar/Distance.cpp | 14 ++-- src/colvar/EEFSolv.cpp | 2 +- src/colvar/ERMSD.cpp | 2 +- src/colvar/Energy.cpp | 1 + src/colvar/ExtraCV.cpp | 2 +- src/colvar/GHBFIX.cpp | 2 +- src/colvar/Gyration.cpp | 2 +- src/colvar/GyrationShortcut.cpp | 3 +- src/colvar/MultiColvarTemplate.h | 2 +- src/colvar/MultiRMSD.cpp | 2 +- src/colvar/PCARMSD.cpp | 4 +- src/colvar/PathMSD.cpp | 4 +- src/colvar/Plane.cpp | 6 +- src/colvar/Position.cpp | 12 ++-- src/colvar/ProjectionOnAxis.cpp | 6 +- src/colvar/PropertyMap.cpp | 2 +- src/colvar/Puckering.cpp | 20 +++--- src/colvar/RMSD.cpp | 2 +- src/colvar/RMSDShortcut.cpp | 4 +- src/colvar/RMSDVector.cpp | 9 +-- src/colvar/SelectMassCharge.cpp | 2 +- src/colvar/Template.cpp | 2 +- src/colvar/Torsion.cpp | 2 +- src/colvar/Volume.cpp | 2 +- src/contour/ContourFindingBase.cpp | 3 +- src/contour/DistanceFromContour.cpp | 8 +-- src/contour/DistanceFromContourBase.cpp | 3 +- src/contour/DistanceFromSphericalContour.cpp | 4 +- src/contour/DumpContour.cpp | 3 +- src/contour/FindContourSurface.cpp | 2 +- src/contour/FindSphericalContour.cpp | 2 +- src/core/ActionShortcut.cpp | 17 +++-- src/core/ActionToGetData.cpp | 4 +- src/core/ActionToPutData.cpp | 2 +- src/core/ActionWithArguments.cpp | 25 ++++--- src/core/ActionWithMatrix.cpp | 2 +- src/core/ActionWithValue.cpp | 6 +- src/core/ActionWithVirtualAtom.cpp | 10 +-- src/core/DomainDecomposition.cpp | 2 +- src/core/PbcAction.cpp | 2 +- src/crystdistrib/BopsShortcut.cpp | 2 +- src/crystdistrib/DopsShortcut.cpp | 2 +- src/crystdistrib/Quaternion.cpp | 8 +-- .../QuaternionBondProductMatrix.cpp | 11 ++-- src/crystdistrib/QuaternionProductMatrix.cpp | 11 ++-- src/crystdistrib/RopsShortcut.cpp | 2 +- src/dimred/ArrangePoints.cpp | 9 +-- .../ClassicalMultiDimensionalScaling.cpp | 2 +- src/dimred/PCA.cpp | 2 +- src/dimred/ProjectPoints.cpp | 9 +-- src/dimred/SketchMap.cpp | 4 +- src/dimred/SketchMapProjection.cpp | 2 +- src/drr/DynamicReferenceRestraining.cpp | 1 - src/eds/EDS.cpp | 13 ++-- src/envsim/EnvironmentSimilarity.cpp | 1 + src/fisst/FISST.cpp | 5 +- src/fourier/FourierTransform.cpp | 9 +-- src/function/Bessel.cpp | 2 +- src/function/Between.cpp | 2 +- src/function/Combine.cpp | 2 +- src/function/Custom.cpp | 2 +- src/function/Ensemble.cpp | 1 - src/function/FuncPathGeneral.cpp | 5 +- src/function/FuncPathMSD.cpp | 5 +- src/function/FuncSumHills.cpp | 3 +- src/function/Function.cpp | 1 + src/function/FunctionOfMatrix.h | 11 ++-- src/function/FunctionOfScalar.h | 7 +- src/function/FunctionOfVector.h | 15 +++-- src/function/FunctionShortcut.h | 4 +- src/function/Highest.cpp | 4 +- src/function/LessThan.cpp | 2 +- src/function/LocalEnsemble.cpp | 2 +- src/function/Moments.cpp | 2 +- src/function/MoreThan.cpp | 2 +- src/function/Piecewise.cpp | 2 +- src/function/Product.cpp | 2 +- src/function/Sort.cpp | 2 +- src/function/Stats.cpp | 13 ++-- src/function/Sum.cpp | 2 +- src/funnel/FPS.cpp | 4 +- src/funnel/Funnel.cpp | 1 - src/generic/Accumulate.cpp | 5 +- src/generic/Average.cpp | 4 +- src/generic/Collect.cpp | 5 +- src/generic/Committor.cpp | 2 +- src/generic/Constant.cpp | 4 +- src/generic/CreateMask.cpp | 5 +- src/generic/DumpAtoms.cpp | 3 +- src/generic/DumpDerivatives.cpp | 2 +- src/generic/DumpForces.cpp | 2 +- src/generic/DumpPDB.cpp | 3 +- src/generic/DumpProjections.cpp | 2 +- src/generic/DumpVector.cpp | 3 +- src/generic/FitToTemplate.cpp | 1 + src/generic/GatherReplicas.cpp | 4 +- src/generic/MassChargeInput.cpp | 4 +- src/generic/Ones.cpp | 2 +- src/generic/PDB2Constant.cpp | 4 +- src/generic/Plumed.cpp | 2 +- src/generic/Print.cpp | 2 +- src/generic/PrintNDX.cpp | 2 +- src/generic/Time.cpp | 2 +- src/generic/UpdateIf.cpp | 2 +- src/gridtools/ConvertToFES.cpp | 2 +- src/gridtools/DumpGrid.cpp | 3 +- src/gridtools/EvaluateFunctionOnGrid.cpp | 4 +- src/gridtools/EvaluateGridFunction.cpp | 2 +- src/gridtools/FindGridOptimum.cpp | 7 +- src/gridtools/FunctionOfGrid.h | 11 +++- src/gridtools/Gradient.cpp | 2 +- src/gridtools/Histogram.cpp | 4 +- src/gridtools/InterpolateGrid.cpp | 4 +- src/gridtools/KDE.cpp | 5 +- src/gridtools/KLEntropy.cpp | 2 +- src/gridtools/MultiColvarDensity.cpp | 2 +- src/gridtools/PairEntropies.cpp | 2 +- src/gridtools/PairEntropy.cpp | 2 +- src/gridtools/RDF.cpp | 2 +- src/gridtools/ReadGridInSetup.cpp | 2 +- src/isdb/CS2Backbone.cpp | 26 ++++---- src/isdb/Caliber.cpp | 9 ++- src/isdb/EMMI.cpp | 22 +++---- src/isdb/EMMIVox.cpp | 12 ++-- src/isdb/FretEfficiency.cpp | 2 +- src/isdb/Jcoupling.cpp | 4 +- src/isdb/Metainference.cpp | 25 ++++--- src/isdb/MetainferenceBase.cpp | 26 ++++---- src/isdb/NOE.cpp | 4 +- src/isdb/PRE.cpp | 4 +- src/isdb/RDC.cpp | 16 ++--- src/isdb/Rescale.cpp | 7 +- src/isdb/SAXS.cpp | 4 +- src/isdb/Select.cpp | 3 +- src/isdb/Shadow.cpp | 2 +- src/landmarks/CollectFrames.cpp | 6 +- src/landmarks/FarthestPointSampling.cpp | 2 +- src/landmarks/LandmarkSelection.cpp | 8 +-- src/landmarks/LogSumExp.cpp | 2 +- src/logmfd/LogMFD.cpp | 5 +- src/mapping/AdaptivePath.cpp | 2 +- src/mapping/GeometricPath.cpp | 8 +-- src/mapping/GeometricPathShortcut.cpp | 4 +- src/mapping/PCAVars.cpp | 6 +- src/mapping/Path.cpp | 10 +-- src/mapping/PathDisplacements.cpp | 4 +- src/mapping/PathProjectionCalculator.cpp | 3 +- src/matrixtools/CovarianceMatrix.cpp | 2 +- src/matrixtools/Determinent.cpp | 4 +- src/matrixtools/DiagonalizeMatrix.cpp | 4 +- src/matrixtools/InvertMatrix.cpp | 2 +- src/matrixtools/MatrixOperationBase.cpp | 3 +- src/matrixtools/MatrixTimesMatrix.cpp | 5 +- src/matrixtools/MatrixTimesVector.cpp | 5 +- src/matrixtools/OuterProduct.cpp | 5 +- src/matrixtools/TransposeMatrix.cpp | 3 +- src/matrixtools/Voronoi.cpp | 5 +- src/maze/Loss.cpp | 2 +- src/maze/Optimizer.cpp | 5 ++ src/maze/Optimizer_Bias.cpp | 7 +- src/maze/Random_Acceleration_MD.cpp | 2 + src/maze/Steered_MD.cpp | 1 + src/membranefusion/FusionPoreExpansionP.cpp | 2 +- src/membranefusion/FusionPoreNucleationP.cpp | 2 +- src/membranefusion/MemFusionP.cpp | 2 +- src/metatensor/metatensor.cpp | 5 +- src/multicolvar/AlphaBeta.cpp | 2 +- src/multicolvar/Angles.cpp | 1 + src/multicolvar/Dihcor.cpp | 2 +- src/multicolvar/Distances.cpp | 7 +- src/multicolvar/InPlaneDistances.cpp | 1 + src/multicolvar/MFilterLess.cpp | 2 +- src/multicolvar/MFilterMore.cpp | 2 +- src/multicolvar/MultiColvarShortcuts.cpp | 20 +++--- src/multicolvar/Planes.cpp | 4 +- src/multicolvar/Torsions.cpp | 1 + src/multicolvar/UWalls.cpp | 4 +- src/multicolvar/XYTorsions.cpp | 1 + src/opes/ECVcustom.cpp | 3 +- src/opes/ECVlinear.cpp | 3 +- src/opes/ECVmultiThermal.cpp | 3 +- src/opes/ECVmultiThermalBaric.cpp | 3 +- src/opes/ECVumbrellasFile.cpp | 1 - src/opes/ECVumbrellasLine.cpp | 1 - src/opes/ExpansionCVs.cpp | 1 + src/opes/OPESexpanded.cpp | 5 +- src/opes/OPESmetad.cpp | 19 +++--- src/pamm/HBPammMatrix.cpp | 1 + src/piv/PIV.cpp | 2 +- src/pytorch/PytorchModel.cpp | 1 - src/refdist/Difference.cpp | 2 +- src/refdist/Displacement.cpp | 2 +- src/refdist/EuclideanDistance.cpp | 2 +- src/refdist/Kernel.cpp | 2 +- src/refdist/MahalanobisDistance.cpp | 2 +- src/refdist/MatrixProductDiagonal.cpp | 5 +- src/refdist/NormalizedEuclideanDistance.cpp | 2 +- src/s2cm/S2ContactModel.cpp | 2 +- src/sasa/sasa_HASEL.cpp | 2 +- src/sasa/sasa_LCPO.cpp | 2 +- src/secondarystructure/AlphaRMSD.cpp | 1 + src/secondarystructure/AntibetaRMSD.cpp | 1 + src/secondarystructure/ParabetaRMSD.cpp | 1 + .../SecondaryStructureRMSD.cpp | 5 +- src/sizeshape/mahadist.cpp | 2 +- src/sizeshape/pos_proj.cpp | 2 +- src/sprint/Sprint.cpp | 2 +- src/symfunc/AngularTetra.cpp | 1 + src/symfunc/CoordShellVectorFunction.cpp | 1 + src/symfunc/CoordinationNumbers.cpp | 3 +- src/symfunc/CylindricalHarmonic.cpp | 4 +- src/symfunc/Fccubic.cpp | 2 +- src/symfunc/HexaticParameter.cpp | 5 +- src/symfunc/LocalAverage.cpp | 1 + src/symfunc/LocalCrystalinity.cpp | 1 + src/symfunc/LocalSteinhardt.cpp | 1 + src/symfunc/RadialTetra.cpp | 1 + src/symfunc/SMAC.cpp | 1 + src/symfunc/SphericalHarmonic.cpp | 4 +- src/symfunc/Steinhardt.cpp | 5 +- src/symfunc/ThreeBodyGFunctions.cpp | 5 +- src/tools/Keywords.cpp | 66 ++++++++++++++++++- src/tools/Keywords.h | 20 +++++- src/valtools/Concatenate.cpp | 7 +- src/valtools/Flatten.cpp | 5 +- src/valtools/SelectComponents.cpp | 4 +- src/valtools/SelectWithMask.cpp | 11 ++-- src/valtools/VStack.cpp | 5 +- src/vatom/ArgsToVatom.cpp | 26 ++++---- src/vatom/CenterShortcut.cpp | 2 +- src/ves/Optimizer.cpp | 12 ++-- src/ves/VesBias.cpp | 2 +- src/ves/VesDeltaF.cpp | 5 +- src/ves/VesLinearExpansion.cpp | 3 +- src/volumes/ActionVolume.cpp | 2 +- src/volumes/Density.cpp | 2 +- src/volumes/VolumeShortcut.h | 11 ++-- src/wham/Wham.cpp | 6 +- src/wham/WhamHistogram.cpp | 2 +- src/wham/WhamWeights.cpp | 2 +- 290 files changed, 769 insertions(+), 619 deletions(-) diff --git a/plugins/pycv/PythonFunction.cpp b/plugins/pycv/PythonFunction.cpp index 995cb60fa4..a0aa837f3f 100644 --- a/plugins/pycv/PythonFunction.cpp +++ b/plugins/pycv/PythonFunction.cpp @@ -104,7 +104,8 @@ PLUMED_REGISTER_ACTION(PythonFunction,"PYFUNCTION") void PythonFunction::registerKeywords( Keywords& keys ) { Function::registerKeywords( keys ); - keys.use("ARG"); keys.use("PERIODIC"); + keys.use("PERIODIC"); + keys.addInputKeyword("optional","ARG","scalar","the labels of the values from which the function is calculated"); keys.add("compulsory","IMPORT","the python file to import, containing the function"); keys.add("compulsory","CALCULATE",PYCV_DEFAULTCALCULATE,"the function to call"); keys.add("compulsory","INIT",PYCV_DEFAULTINIT,"the function to call during the construction method of the function"); diff --git a/regtest/basic/rt-make-load/Distance10.cpp b/regtest/basic/rt-make-load/Distance10.cpp index 376b10c5f2..369a085e7e 100644 --- a/regtest/basic/rt-make-load/Distance10.cpp +++ b/regtest/basic/rt-make-load/Distance10.cpp @@ -46,6 +46,7 @@ void Distance::registerKeywords( Keywords& keys ){ Colvar::registerKeywords( keys ); keys.add("atoms","ATOMS","the pair of atom that we are calculating the distance between"); keys.addFlag("COMPONENTS",false,"calculate the x, y and z components of the distance separately and store them as label.x, label.y and label.z"); + keys.setValueDescription("scalar","the DISTANCE between this pair of atoms"); } Distance::Distance(const ActionOptions&ao): diff --git a/regtest/basic/rt-make-load/Distance20.cpp b/regtest/basic/rt-make-load/Distance20.cpp index 3bf654cb29..294c7176ba 100644 --- a/regtest/basic/rt-make-load/Distance20.cpp +++ b/regtest/basic/rt-make-load/Distance20.cpp @@ -46,6 +46,7 @@ void Distance::registerKeywords( Keywords& keys ){ Colvar::registerKeywords( keys ); keys.add("atoms","ATOMS","the pair of atom that we are calculating the distance between"); keys.addFlag("COMPONENTS",false,"calculate the x, y and z components of the distance separately and store them as label.x, label.y and label.z"); + keys.setValueDescription("scalar","the DISTANCE between this pair of atoms"); } Distance::Distance(const ActionOptions&ao): diff --git a/regtest/basic/rt15-mklib/Distance2.cpp b/regtest/basic/rt15-mklib/Distance2.cpp index 9ab8309533..f9bf5c260f 100644 --- a/regtest/basic/rt15-mklib/Distance2.cpp +++ b/regtest/basic/rt15-mklib/Distance2.cpp @@ -36,6 +36,7 @@ void Distance::registerKeywords( Keywords& keys ){ Colvar::registerKeywords( keys ); keys.add("atoms","ATOMS","the pair of atom that we are calculating the distance between"); keys.addFlag("COMPONENTS",false,"calculate the x, y and z components of the distance separately and store them as label.x, label.y and label.z"); + keys.setValueDescription("scalar","the distance between the input atoms"); } Distance::Distance(const ActionOptions&ao): diff --git a/regtest/basic/rt15/Distance2.cpp b/regtest/basic/rt15/Distance2.cpp index 3ff1f3562f..b86a290841 100644 --- a/regtest/basic/rt15/Distance2.cpp +++ b/regtest/basic/rt15/Distance2.cpp @@ -46,6 +46,7 @@ void Distance::registerKeywords( Keywords& keys ){ Colvar::registerKeywords( keys ); keys.add("atoms","ATOMS","the pair of atom that we are calculating the distance between"); keys.addFlag("COMPONENTS",false,"calculate the x, y and z components of the distance separately and store them as label.x, label.y and label.z"); + keys.setValueDescription("scalar","the distance between the input atoms"); } Distance::Distance(const ActionOptions&ao): diff --git a/regtest/basic/rt15/Distance3.cpp b/regtest/basic/rt15/Distance3.cpp index 376b10c5f2..144579fd72 100644 --- a/regtest/basic/rt15/Distance3.cpp +++ b/regtest/basic/rt15/Distance3.cpp @@ -46,6 +46,7 @@ void Distance::registerKeywords( Keywords& keys ){ Colvar::registerKeywords( keys ); keys.add("atoms","ATOMS","the pair of atom that we are calculating the distance between"); keys.addFlag("COMPONENTS",false,"calculate the x, y and z components of the distance separately and store them as label.x, label.y and label.z"); + keys.setValueDescription("scalar","the distance between the input atoms"); } Distance::Distance(const ActionOptions&ao): diff --git a/regtest/contour/rt-parse-only/shortcuts.json.reference b/regtest/contour/rt-parse-only/shortcuts.json.reference index fe7a825394..e58a079ef5 100644 --- a/regtest/contour/rt-parse-only/shortcuts.json.reference +++ b/regtest/contour/rt-parse-only/shortcuts.json.reference @@ -13,7 +13,7 @@ }, "fcc" : { "defaults" : " PHI=0.0 THETA=0.0 PSI=0.0", - "expansion" : "fcc_grp: GROUP ATOMS=1-5184 \nfcc_mat: CONTACT_MATRIX GROUP=1-5184 SWITCH={CUBIC D_0=1.2 D_MAX=1.5} COMPONENTS \nfcc_vfunc: FCCUBIC_FUNC ARG=fcc_mat.x,fcc_mat.y,fcc_mat.z ALPHA=27 \nfcc_wvfunc: CUSTOM ARG=fcc_vfunc,fcc_mat.w FUNC=x*y PERIODIC=NO \nfcc_ones: ONES SIZE=5184\nfcc: MATRIX_VECTOR_PRODUCT ARG=fcc_wvfunc,fcc_ones \nfcc_denom: MATRIX_VECTOR_PRODUCT ARG=fcc_mat.w,fcc_ones \nfcc_n: CUSTOM ARG=fcc,fcc_denom FUNC=x/y PERIODIC=NO " + "expansion" : "fcc_grp: GROUP ATOMS=1-5184 \nfcc_mat: CONTACT_MATRIX GROUP=1-5184 SWITCH={CUBIC D_0=1.2 D_MAX=1.5} COMPONENTS \nfcc_vfunc: FCCUBIC_FUNC ARG=fcc_mat.x,fcc_mat.y,fcc_mat.z ALPHA=27\nfcc_wvfunc: CUSTOM ARG=fcc_vfunc,fcc_mat.w FUNC=x*y PERIODIC=NO\nfcc_ones: ONES SIZE=5184\nfcc: MATRIX_VECTOR_PRODUCT ARG=fcc_wvfunc,fcc_ones\nfcc_denom: MATRIX_VECTOR_PRODUCT ARG=fcc_mat.w,fcc_ones\nfcc_n: CUSTOM ARG=fcc,fcc_denom FUNC=x/y PERIODIC=NO" }, "ones" : { "expansion" : "ones: CONSTANT NOLOG VALUES=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" diff --git a/regtest/contour/rt-parse-only/values.json.reference b/regtest/contour/rt-parse-only/values.json.reference index 4957528c09..28d79fc626 100644 --- a/regtest/contour/rt-parse-only/values.json.reference +++ b/regtest/contour/rt-parse-only/values.json.reference @@ -76,12 +76,6 @@ "dens_dist.y" : { "type": "vector", "desciption": "" } "dens_dist.z" : { "type": "vector", "desciption": "" } }, -"shortcut_dens_dist" : { -"action" : "DISTANCES", -"dens_dist.x" : { "type": "vector", "desciption": "" } -"dens_dist.y" : { "type": "vector", "desciption": "" } -"dens_dist.z" : { "type": "vector", "desciption": "" } -}, "dens_numer_sigma" : { "action" : "CONSTANT", "dens_numer_sigma" : { "type": "vector", "desciption": "" } diff --git a/regtest/multicolvar/rt-parse-only/shortcuts.json.reference b/regtest/multicolvar/rt-parse-only/shortcuts.json.reference index 4bcac5ad12..0b9b15e922 100644 --- a/regtest/multicolvar/rt-parse-only/shortcuts.json.reference +++ b/regtest/multicolvar/rt-parse-only/shortcuts.json.reference @@ -1,5 +1,5 @@ { "dallk" : { - "expansion" : "dallk_vatom1: CENTER ATOMS=1,2 \ndallk_vatom2: CENTER ATOMS=3,4 \ndallk_vatom3: CENTER ATOMS=5,6 \ndallk_grp: GROUP ATOMS=dallk_vatom1,dallk_vatom2,dallk_vatom3 \ndallk: DISTANCE ATOMS1=1,2 ATOMS2=3,4 ATOMS3=5,6 \ndallk_lt1: LESS_THAN ARG=dallk SWITCH={RATIONAL R_0=1.0} \ndallk_lessthan-1: SUM ARG=dallk_lt1 PERIODIC=NO \ndallk_lt2: LESS_THAN ARG=dallk SWITCH={RATIONAL R_0=1.5} \ndallk_lessthan-2: SUM ARG=dallk_lt2 PERIODIC=NO \ndallk_lowest: LOWEST ARG=dallk \ndallk_mean: MEAN ARG=dallk PERIODIC=NO " + "expansion" : "dallk_vatom1: CENTER ATOMS=1,2 \ndallk_vatom2: CENTER ATOMS=3,4 \ndallk_vatom3: CENTER ATOMS=5,6 \ndallk_grp: GROUP ATOMS=dallk_vatom1,dallk_vatom2,dallk_vatom3 \ndallk: DISTANCE ATOMS1=1,2 ATOMS2=3,4 ATOMS3=5,6 \ndallk_lt1: LESS_THAN ARG=dallk SWITCH={RATIONAL R_0=1.0}\ndallk_lessthan-1: SUM ARG=dallk_lt1 PERIODIC=NO\ndallk_lt2: LESS_THAN ARG=dallk SWITCH={RATIONAL R_0=1.5}\ndallk_lessthan-2: SUM ARG=dallk_lt2 PERIODIC=NO\ndallk_lowest: LOWEST ARG=dallk\ndallk_mean: MEAN ARG=dallk PERIODIC=NO" } } diff --git a/regtest/symfunc/rt-parse-only/shortcuts.json.reference b/regtest/symfunc/rt-parse-only/shortcuts.json.reference index 99c54df990..eafdeee381 100644 --- a/regtest/symfunc/rt-parse-only/shortcuts.json.reference +++ b/regtest/symfunc/rt-parse-only/shortcuts.json.reference @@ -1,5 +1,5 @@ { "q1" : { - "expansion" : "q1_grp: GROUP ATOMS=1-10 \nq1_mat: CONTACT_MATRIX GROUP=1-10 SWITCH={RATIONAL R_0=1} COMPONENTS \nq1_sh: SPHERICAL_HARMONIC ARG=q1_mat.x,q1_mat.y,q1_mat.z,q1_mat.w L=1 \nq1_denom_ones: ONES SIZE=10\nq1_denom: MATRIX_VECTOR_PRODUCT ARG=q1_mat.w,q1_denom_ones \nq1_sp: MATRIX_VECTOR_PRODUCT ARG=q1_sh.*,q1_denom_ones \nq1_norm2: COMBINE PERIODIC=NO POWERS=2,2,2,2,2,2 ARG=q1_sp.rm-n1,q1_sp.im-n1,q1_sp.rm-0,q1_sp.im-0,q1_sp.rm-p1,q1_sp.im-p1 \nq1_norm: CUSTOM ARG=q1_norm2 FUNC=sqrt(x) PERIODIC=NO \nq1: CUSTOM ARG=q1_norm,q1_denom FUNC=x/y PERIODIC=NO " + "expansion" : "q1_grp: GROUP ATOMS=1-10 \nq1_mat: CONTACT_MATRIX GROUP=1-10 SWITCH={RATIONAL R_0=1} COMPONENTS \nq1_sh: SPHERICAL_HARMONIC ARG=q1_mat.x,q1_mat.y,q1_mat.z,q1_mat.w L=1\nq1_denom_ones: ONES SIZE=10\nq1_denom: MATRIX_VECTOR_PRODUCT ARG=q1_mat.w,q1_denom_ones\nq1_sp: MATRIX_VECTOR_PRODUCT ARG=q1_sh.*,q1_denom_ones\nq1_norm2: COMBINE PERIODIC=NO POWERS=2,2,2,2,2,2 ARG=q1_sp.rm-n1,q1_sp.im-n1,q1_sp.rm-0,q1_sp.im-0,q1_sp.rm-p1,q1_sp.im-p1\nq1_norm: CUSTOM ARG=q1_norm2 FUNC=sqrt(x) PERIODIC=NO\nq1: CUSTOM ARG=q1_norm,q1_denom FUNC=x/y PERIODIC=NO" } } diff --git a/regtest/wham/rt-parse-only/shortcuts.json.reference b/regtest/wham/rt-parse-only/shortcuts.json.reference index d8dc2e5683..5dfdc0220f 100644 --- a/regtest/wham/rt-parse-only/shortcuts.json.reference +++ b/regtest/wham/rt-parse-only/shortcuts.json.reference @@ -1,7 +1,7 @@ { "hh" : { "defaults" : " STRIDE=1", - "expansion" : "hh_gather: GATHER_REPLICAS ARG=rp.bias\nhh_gatherv: CONCATENATE ARG=hh_gather.*\nhh_collect: COLLECT TYPE=vector ARG=hh_gatherv STRIDE=1 \nhh_wham: WHAM ARG=hh_collect TEMP=300\nhh_data_phi: COLLECT ARG=phi \nhh: KDE ARG=hh_data_phi HEIGHTS=hh_wham KERNEL=DISCRETE GRID_MIN=-pi GRID_MAX=pi GRID_BIN=50 " + "expansion" : "hh_gather: GATHER_REPLICAS ARG=rp.bias\nhh_gatherv: CONCATENATE ARG=hh_gather.*\nhh_collect: COLLECT TYPE=vector ARG=hh_gatherv STRIDE=1\nhh_wham: WHAM ARG=hh_collect TEMP=300\nhh_data_phi: COLLECT ARG=phi\nhh: KDE ARG=hh_data_phi HEIGHTS=hh_wham KERNEL=DISCRETE GRID_MIN=-pi GRID_MAX=pi GRID_BIN=50" }, "rp" : { "defaults" : " SLOPE=0.0" diff --git a/src/adjmat/AdjacencyMatrixBase.cpp b/src/adjmat/AdjacencyMatrixBase.cpp index 98eb5ed620..3e9d6f3e8c 100644 --- a/src/adjmat/AdjacencyMatrixBase.cpp +++ b/src/adjmat/AdjacencyMatrixBase.cpp @@ -28,7 +28,7 @@ namespace PLMD { namespace adjmat { void AdjacencyMatrixBase::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords( keys ); keys.remove("ARG"); + ActionWithMatrix::registerKeywords( keys ); keys.add("atoms","GROUP","the atoms for which you would like to calculate the adjacency matrix"); keys.add("atoms","GROUPA",""); keys.add("atoms","GROUPB",""); @@ -38,11 +38,11 @@ void AdjacencyMatrixBase::registerKeywords( Keywords& keys ) { keys.addFlag("NOPBC",false,"don't use pbc"); keys.add("compulsory","NL_CUTOFF","0.0","The cutoff for the neighbor list. A value of 0 means we are not using a neighbor list"); keys.add("compulsory","NL_STRIDE","1","The frequency with which we are updating the atoms in the neighbor list"); - keys.addOutputComponent("w","COMPONENTS","a matrix containing the weights for the bonds between each pair of atoms"); - keys.addOutputComponent("x","COMPONENTS","the projection of the bond on the x axis"); - keys.addOutputComponent("y","COMPONENTS","the projection of the bond on the y axis"); - keys.addOutputComponent("z","COMPONENTS","the projection of the bond on the z axis"); - keys.setValueDescription("a matrix containing the weights for the bonds between each pair of atoms"); + keys.addOutputComponent("w","COMPONENTS","matrix","a matrix containing the weights for the bonds between each pair of atoms"); + keys.addOutputComponent("x","COMPONENTS","matrix","the projection of the bond on the x axis"); + keys.addOutputComponent("y","COMPONENTS","matrix","the projection of the bond on the y axis"); + keys.addOutputComponent("z","COMPONENTS","matrix","the projection of the bond on the z axis"); + keys.setValueDescription("matrix","a matrix containing the weights for the bonds between each pair of atoms"); } AdjacencyMatrixBase::AdjacencyMatrixBase(const ActionOptions& ao): diff --git a/src/adjmat/Bridge.cpp b/src/adjmat/Bridge.cpp index d018fb07b2..4dd2dd4fbb 100644 --- a/src/adjmat/Bridge.cpp +++ b/src/adjmat/Bridge.cpp @@ -55,7 +55,7 @@ void Bridge::registerKeywords(Keywords& keys) { keys.add("optional","SWITCHB","The switchingfunction on the distance between the bridging atoms and the atoms in " "group B"); keys.needsAction("BRIDGE_MATRIX"); keys.needsAction("SUM"); - keys.setValueDescription("the number of bridging atoms between the two groups"); + keys.setValueDescription("scalar","the number of bridging atoms between the two groups"); } Bridge::Bridge(const ActionOptions& ao): diff --git a/src/adjmat/Neighbors.cpp b/src/adjmat/Neighbors.cpp index 58f4b4b978..b56465d836 100644 --- a/src/adjmat/Neighbors.cpp +++ b/src/adjmat/Neighbors.cpp @@ -52,10 +52,11 @@ class Neighbors : public ActionWithMatrix { PLUMED_REGISTER_ACTION(Neighbors,"NEIGHBORS") void Neighbors::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords( keys ); keys.use("ARG"); + ActionWithMatrix::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","matrix","the label of an adjacency/distance matrix that will be used to find the nearest neighbors"); keys.add("compulsory","NLOWEST","0","in each row of the output matrix set the elements that correspond to the n lowest elements in each row of the input matrix equal to one"); keys.add("compulsory","NHIGHEST","0","in each row of the output matrix set the elements that correspond to the n highest elements in each row of the input matrix equal to one"); - keys.setValueDescription("a matrix in which the ij element is one if the ij-element of the input matrix is one of the NLOWEST/NHIGHEST elements on that row of the input matrix and zero otherwise"); + keys.setValueDescription("matrix","a matrix in which the ij element is one if the ij-element of the input matrix is one of the NLOWEST/NHIGHEST elements on that row of the input matrix and zero otherwise"); } Neighbors::Neighbors(const ActionOptions&ao): diff --git a/src/adjmat/TorsionsMatrix.cpp b/src/adjmat/TorsionsMatrix.cpp index 3a0d112aa4..2815d818e8 100644 --- a/src/adjmat/TorsionsMatrix.cpp +++ b/src/adjmat/TorsionsMatrix.cpp @@ -52,10 +52,11 @@ class TorsionsMatrix : public ActionWithMatrix { PLUMED_REGISTER_ACTION(TorsionsMatrix,"TORSIONS_MATRIX") void TorsionsMatrix::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); + ActionWithMatrix::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","matrix","an Nx3 and a 3xN matrix that contain the bond vectors that you would like to determine the torsion angles between"); keys.add("atoms","POSITIONS1","the positions to use for the molecules specified using the first argument"); keys.add("atoms","POSITIONS2","the positions to use for the molecules specified using the second argument"); - keys.setValueDescription("the matrix of torsions between the two vectors of input directors"); + keys.setValueDescription("matrix","the matrix of torsions between the two vectors of input directors"); } TorsionsMatrix::TorsionsMatrix(const ActionOptions&ao): diff --git a/src/annfunc/ANN.cpp b/src/annfunc/ANN.cpp index 37a488f00c..7b97739b20 100644 --- a/src/annfunc/ANN.cpp +++ b/src/annfunc/ANN.cpp @@ -111,7 +111,7 @@ PLUMED_REGISTER_ACTION(ANN,"ANN") void ANN::registerKeywords( Keywords& keys ) { Function::registerKeywords(keys); - keys.use("ARG"); keys.use("PERIODIC"); + keys.use("PERIODIC"); keys.add("compulsory", "NUM_LAYERS", "number of layers of the neural network"); keys.add("compulsory", "NUM_NODES", "numbers of nodes in each layer of the neural network"); keys.add("compulsory", "ACTIVATIONS", "activation functions for the neural network"); @@ -121,7 +121,7 @@ void ANN::registerKeywords( Keywords& keys ) { keys.add("numbered", "BIASES", "bias array for each layer of the neural network, " "BIASES0 represents bias array for layer 1, BIASES1 represents bias array for layer 2, ..."); // since v2.2 plumed requires all components be registered - keys.addOutputComponent("node", "default", "components of ANN outputs"); + keys.addOutputComponent("node", "default", "scalar", "components of ANN outputs"); } ANN::ANN(const ActionOptions&ao): diff --git a/src/bias/ABMD.cpp b/src/bias/ABMD.cpp index 89ceb6f69a..7923208a11 100644 --- a/src/bias/ABMD.cpp +++ b/src/bias/ABMD.cpp @@ -96,14 +96,13 @@ PLUMED_REGISTER_ACTION(ABMD,"ABMD") void ABMD::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","TO","The array of target values"); keys.add("compulsory","KAPPA","The array of force constants."); keys.add("optional","MIN","Array of starting values for the bias (set rho_m(t), otherwise it is set using the current value of ARG)"); keys.add("optional","NOISE","Array of white noise intensities (add a temperature to the ABMD)"); keys.add("optional","SEED","Array of seeds for the white noise (add a temperature to the ABMD)"); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); - keys.addOutputComponent("_min","default","one or multiple instances of this quantity can be referenced elsewhere in the input file. " + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("_min","default","scalar","one or multiple instances of this quantity can be referenced elsewhere in the input file. " " These quantities will be named with the arguments of the bias followed by " "the character string _min. These quantities tell the user the minimum value assumed by rho_m(t)."); } diff --git a/src/bias/Bias.cpp b/src/bias/Bias.cpp index 1577eba03d..e6f198bff0 100644 --- a/src/bias/Bias.cpp +++ b/src/bias/Bias.cpp @@ -52,8 +52,9 @@ void Bias::registerKeywords( Keywords& keys ) { ActionPilot::registerKeywords(keys); ActionWithValue::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the scalars on which the bias will act"); keys.add("hidden","STRIDE","the frequency with which the forces due to the bias should be calculated. This can be used to correctly set up multistep algorithms"); - keys.addOutputComponent("bias","default","the instantaneous value of the bias potential"); + keys.addOutputComponent("bias","default","scalar","the instantaneous value of the bias potential"); } void Bias::apply() { diff --git a/src/bias/BiasValue.cpp b/src/bias/BiasValue.cpp index 7fa6ca2435..c4272f7d17 100644 --- a/src/bias/BiasValue.cpp +++ b/src/bias/BiasValue.cpp @@ -83,9 +83,9 @@ PLUMED_REGISTER_ACTION(BiasValue,"BIASVALUE") void BiasValue::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("compulsory","ARG","scalar/vector","the labels of the scalar/vector arguments whose values will be used as a bias on the system"); // Should be _bias below - keys.addOutputComponent("_bias","default","one or multiple instances of this quantity can be referenced elsewhere in the input file. " + keys.addOutputComponent("_bias","default","scalar","one or multiple instances of this quantity can be referenced elsewhere in the input file. " "these quantities will named with the arguments of the bias followed by " "the character string _bias. These quantities tell the user how much the bias is " "due to each of the colvars."); diff --git a/src/bias/ExtendedLagrangian.cpp b/src/bias/ExtendedLagrangian.cpp index ecb96ed113..ba66be13ea 100644 --- a/src/bias/ExtendedLagrangian.cpp +++ b/src/bias/ExtendedLagrangian.cpp @@ -129,15 +129,14 @@ PLUMED_REGISTER_ACTION(ExtendedLagrangian,"EXTENDED_LAGRANGIAN") void ExtendedLagrangian::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","KAPPA","specifies that the restraint is harmonic and what the values of the force constants on each of the variables are"); keys.add("compulsory","TAU","specifies that the restraint is harmonic and what the values of the force constants on each of the variables are"); keys.add("compulsory","FRICTION","0.0","add a friction to the variable"); keys.add("optional","TEMP","the system temperature - needed when FRICTION is present. If not provided will be taken from MD code (if available)"); - keys.addOutputComponent("_fict","default","one or multiple instances of this quantity can be referenced elsewhere in the input file. " + keys.addOutputComponent("_fict","default","scalar","one or multiple instances of this quantity can be referenced elsewhere in the input file. " "These quantities will named with the arguments of the bias followed by " "the character string _tilde. It is possible to add forces on these variable."); - keys.addOutputComponent("_vfict","default","one or multiple instances of this quantity can be referenced elsewhere in the input file. " + keys.addOutputComponent("_vfict","default","scalar","one or multiple instances of this quantity can be referenced elsewhere in the input file. " "These quantities will named with the arguments of the bias followed by " "the character string _tilde. It is NOT possible to add forces on these variable."); } diff --git a/src/bias/External.cpp b/src/bias/External.cpp index ce422c1682..5d01ea5184 100644 --- a/src/bias/External.cpp +++ b/src/bias/External.cpp @@ -122,7 +122,6 @@ PLUMED_REGISTER_ACTION(External,"EXTERNAL") void External::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","FILE","the name of the file containing the external potential."); keys.addFlag("NOSPLINE",false,"specifies that no spline interpolation is to be used when calculating the energy and forces due to the external potential"); keys.addFlag("SPARSE",false,"specifies that the external potential uses a sparse grid"); diff --git a/src/bias/LWalls.cpp b/src/bias/LWalls.cpp index d6553a3d86..ac933883ed 100644 --- a/src/bias/LWalls.cpp +++ b/src/bias/LWalls.cpp @@ -87,13 +87,13 @@ PLUMED_REGISTER_ACTION(LWalls,"LOWER_WALLS_SCALAR") void LWalls::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); keys.setDisplayName("LOWER_WALLS"); - keys.use("ARG"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); + keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); keys.add("compulsory","AT","the positions of the wall. The a_i in the expression for a wall."); keys.add("compulsory","KAPPA","the force constant for the wall. The k_i in the expression for a wall."); keys.add("compulsory","OFFSET","0.0","the offset for the start of the wall. The o_i in the expression for a wall."); keys.add("compulsory","EXP","2.0","the powers for the walls. The e_i in the expression for a wall."); keys.add("compulsory","EPS","1.0","the values for s_i in the expression for a wall"); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential"); } LWalls::LWalls(const ActionOptions&ao): diff --git a/src/bias/MaxEnt.cpp b/src/bias/MaxEnt.cpp index 2de92a8762..74dfff9f2f 100644 --- a/src/bias/MaxEnt.cpp +++ b/src/bias/MaxEnt.cpp @@ -163,7 +163,6 @@ PLUMED_REGISTER_ACTION(MaxEnt,"MAXENT") void MaxEnt::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","KAPPA","0.0","specifies the initial value for the learning rate"); keys.add("compulsory","TAU","Specify the dumping time for the learning rate."); keys.add("compulsory","TYPE","specify the restraint type. " @@ -187,13 +186,13 @@ void MaxEnt::registerKeywords(Keywords& keys) { keys.addFlag("REWEIGHT",false,"to be used with plumed driver in order to reweight a trajectory a posteriori"); keys.addFlag("NO_BROADCAST",false,"If active will avoid Lagrangian multipliers to be communicated to other replicas."); keys.add("optional","TEMP","the system temperature. This is required if you are reweighting."); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); - keys.addOutputComponent("work","default","the instantaneous value of the work done by the biasing force"); - keys.addOutputComponent("_work","default","the instantaneous value of the work done by the biasing force for each argument. " + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("work","default","scalar","the instantaneous value of the work done by the biasing force"); + keys.addOutputComponent("_work","default","scalar","the instantaneous value of the work done by the biasing force for each argument. " "These quantities will named with the arguments of the bias followed by " "the character string _work."); - keys.addOutputComponent("_error","default","Instantaneous values of the discrepancy between the observable and the restraint center"); - keys.addOutputComponent("_coupling","default","Instantaneous values of Lagrangian multipliers. They are also written by default in a separate output file."); + keys.addOutputComponent("_error","default","scalar","Instantaneous values of the discrepancy between the observable and the restraint center"); + keys.addOutputComponent("_coupling","default","scalar","Instantaneous values of Lagrangian multipliers. They are also written by default in a separate output file."); keys.use("RESTART"); } MaxEnt::MaxEnt(const ActionOptions&ao): diff --git a/src/bias/MetaD.cpp b/src/bias/MetaD.cpp index f468de9261..fc0325c8c8 100644 --- a/src/bias/MetaD.cpp +++ b/src/bias/MetaD.cpp @@ -520,17 +520,16 @@ PLUMED_REGISTER_ACTION(MetaD,"METAD") void MetaD::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.addOutputComponent("rbias","CALC_RCT","the instantaneous value of the bias normalized using the c(t) reweighting factor [rbias=bias-rct]." + keys.addOutputComponent("rbias","CALC_RCT","scalar","the instantaneous value of the bias normalized using the c(t) reweighting factor [rbias=bias-rct]." "This component can be used to obtain a reweighted histogram."); - keys.addOutputComponent("rct","CALC_RCT","the reweighting factor c(t)."); - keys.addOutputComponent("work","CALC_WORK","accumulator for work"); - keys.addOutputComponent("acc","ACCELERATION","the metadynamics acceleration factor"); - keys.addOutputComponent("maxbias", "CALC_MAX_BIAS", "the maximum of the metadynamics V(s, t)"); - keys.addOutputComponent("transbias", "CALC_TRANSITION_BIAS", "the metadynamics transition bias V*(t)"); - keys.addOutputComponent("pace","FREQUENCY_ADAPTIVE","the hill addition frequency when employing frequency adaptive metadynamics"); - keys.addOutputComponent("nlker","NLIST","number of hills in the neighbor list"); - keys.addOutputComponent("nlsteps","NLIST","number of steps from last neighbor list update"); - keys.use("ARG"); + keys.addOutputComponent("rct","CALC_RCT","scalar","the reweighting factor c(t)."); + keys.addOutputComponent("work","CALC_WORK","scalar","accumulator for work"); + keys.addOutputComponent("acc","ACCELERATION","scalar","the metadynamics acceleration factor"); + keys.addOutputComponent("maxbias", "CALC_MAX_BIAS", "scalar","the maximum of the metadynamics V(s, t)"); + keys.addOutputComponent("transbias", "CALC_TRANSITION_BIAS", "scalar","the metadynamics transition bias V*(t)"); + keys.addOutputComponent("pace","FREQUENCY_ADAPTIVE","scalar","the hill addition frequency when employing frequency adaptive metadynamics"); + keys.addOutputComponent("nlker","NLIST","scalar","number of hills in the neighbor list"); + keys.addOutputComponent("nlsteps","NLIST","scalar","number of steps from last neighbor list update"); keys.add("compulsory","SIGMA","the widths of the Gaussian hills"); keys.add("compulsory","PACE","the frequency for hill addition"); keys.add("compulsory","FILE","HILLS","a file in which the list of added hills is stored"); diff --git a/src/bias/MovingRestraint.cpp b/src/bias/MovingRestraint.cpp index 029dc57005..fae1def8e6 100644 --- a/src/bias/MovingRestraint.cpp +++ b/src/bias/MovingRestraint.cpp @@ -124,7 +124,6 @@ PLUMED_REGISTER_ACTION(MovingRestraint,"MOVINGRESTRAINT") void MovingRestraint::registerKeywords( Keywords& keys ) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","VERSE","B","Tells plumed whether the restraint is only acting for CV larger (U) or smaller (L) than " "the restraint or whether it is acting on both sides (B)"); keys.add("numbered","STEP","This keyword appears multiple times as STEPx with x=0,1,2,...,n. Each value given represents " @@ -138,17 +137,17 @@ void MovingRestraint::registerKeywords( Keywords& keys ) { "parameter is linearly interpolated. If no KAPPAx is specified for STEPx then the values of KAPPAx " "are kept constant during the interval of time between STEP(x-1) and STEPx."); keys.reset_style("KAPPA","compulsory"); - keys.addOutputComponent("work","default","the total work performed changing this restraint"); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); - keys.addOutputComponent("_cntr","default","one or multiple instances of this quantity can be referenced elsewhere in the input file. " + keys.addOutputComponent("work","default","scalar","the total work performed changing this restraint"); + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("_cntr","default","scalar","one or multiple instances of this quantity can be referenced elsewhere in the input file. " "these quantities will named with the arguments of the bias followed by " "the character string _cntr. These quantities give the instantaneous position " "of the center of the harmonic potential."); - keys.addOutputComponent("_work","default","one or multiple instances of this quantity can be referenced elsewhere in the input file. " + keys.addOutputComponent("_work","default","scalar","one or multiple instances of this quantity can be referenced elsewhere in the input file. " "These quantities will named with the arguments of the bias followed by " "the character string _work. These quantities tell the user how much work has " "been done by the potential in dragging the system along the various colvar axis."); - keys.addOutputComponent("_kappa","default","one or multiple instances of this quantity can be referenced elsewhere in the input file. " + keys.addOutputComponent("_kappa","default","scalar","one or multiple instances of this quantity can be referenced elsewhere in the input file. " "These quantities will named with the arguments of the bias followed by " "the character string _kappa. These quantities tell the user the time dependent value of kappa."); } diff --git a/src/bias/PBMetaD.cpp b/src/bias/PBMetaD.cpp index 3f7c4b1b8d..7a4661c171 100644 --- a/src/bias/PBMetaD.cpp +++ b/src/bias/PBMetaD.cpp @@ -330,7 +330,6 @@ PLUMED_REGISTER_ACTION(PBMetaD,"PBMETAD") void PBMetaD::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","SIGMA","the widths of the Gaussian hills"); keys.add("compulsory","PACE","the frequency for hill addition, one for all biases"); keys.add("optional","FILE","files in which the lists of added hills are stored, default names are assigned using arguments if FILE is not found"); @@ -351,7 +350,7 @@ void PBMetaD::registerKeywords(Keywords& keys) { keys.add("optional","ADAPTIVE","use a geometric (=GEOM) or diffusion (=DIFF) based hills width scheme. Sigma is one number that has distance units or timestep dimensions"); keys.add("optional","SIGMA_MAX","the upper bounds for the sigmas (in CV units) when using adaptive hills. Negative number means no bounds "); keys.add("optional","SIGMA_MIN","the lower bounds for the sigmas (in CV units) when using adaptive hills. Negative number means no bounds "); - keys.add("numbered","PF", "specify which CVs belong in a partitioned family. Once a PF is specified, all CVs in ARG must be placed in a PF even if there is one CV per PF”"); + keys.addInputKeyword("numbered","PF", "scalar", "specify which CVs belong in a partitioned family. Once a PF is specified, all CVs in ARG must be placed in a PF even if there is one CV per PF”"); keys.add("optional","SELECTOR", "add forces and do update based on the value of SELECTOR"); keys.add("optional","SELECTOR_ID", "value of SELECTOR"); keys.add("optional","WALKERS_ID", "walker id"); diff --git a/src/bias/Restraint.cpp b/src/bias/Restraint.cpp index 481d07a93f..f097d5f899 100644 --- a/src/bias/Restraint.cpp +++ b/src/bias/Restraint.cpp @@ -79,12 +79,11 @@ class Restraint : public Bias { PLUMED_REGISTER_ACTION(Restraint,"RESTRAINT_SCALAR") void Restraint::registerKeywords(Keywords& keys) { - Bias::registerKeywords(keys); - keys.use("ARG"); keys.setDisplayName("RESTRAINT"); + Bias::registerKeywords(keys); keys.setDisplayName("RESTRAINT"); keys.add("compulsory","SLOPE","0.0","specifies that the restraint is linear and what the values of the force constants on each of the variables are"); keys.add("compulsory","KAPPA","0.0","specifies that the restraint is harmonic and what the values of the force constants on each of the variables are"); keys.add("compulsory","AT","the position of the restraint"); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential"); } Restraint::Restraint(const ActionOptions&ao): diff --git a/src/bias/RestraintShortcut.cpp b/src/bias/RestraintShortcut.cpp index 304120b1ab..ac0d17668c 100644 --- a/src/bias/RestraintShortcut.cpp +++ b/src/bias/RestraintShortcut.cpp @@ -38,13 +38,13 @@ PLUMED_REGISTER_ACTION(RestraintShortcut,"RESTRAINT") void RestraintShortcut::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); - keys.add("numbered","ARG","the arguments on which the bias is acting"); + keys.addInputKeyword("numbered","ARG","scalar/vector","the values the harmonic restraint acts upon"); keys.add("compulsory","SLOPE","0.0","specifies that the restraint is linear and what the values of the force constants on each of the variables are"); keys.add("compulsory","KAPPA","0.0","specifies that the restraint is harmonic and what the values of the force constants on each of the variables are"); keys.add("compulsory","AT","the position of the restraint"); keys.add("hidden","STRIDE","1","the frequency with which the forces due to the bias should be calculated. This can be used to correctly set up multistep algorithms"); - keys.addOutputComponent("bias","default","the instantaneous value of the bias potential"); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("bias","default","scalar","the instantaneous value of the bias potential"); + keys.addOutputComponent("force2","default","scalar/vector","the instantaneous value of the squared force due to this bias potential"); keys.addActionNameSuffix("_SCALAR"); keys.needsAction("COMBINE"); keys.needsAction("SUM"); keys.needsAction("CUSTOM"); keys.needsAction("BIASVALUE"); } diff --git a/src/bias/ReweightBias.cpp b/src/bias/ReweightBias.cpp index e394eb471c..85cc51a6f1 100644 --- a/src/bias/ReweightBias.cpp +++ b/src/bias/ReweightBias.cpp @@ -78,9 +78,9 @@ class ReweightBias : public ReweightBase { PLUMED_REGISTER_ACTION(ReweightBias,"REWEIGHT_BIAS") void ReweightBias::registerKeywords(Keywords& keys ) { - ReweightBase::registerKeywords( keys ); keys.remove("ARG"); - keys.add("compulsory","ARG","*.bias","the biases that must be taken into account when reweighting"); - keys.setValueDescription("the weight to use for this frame to negate the effect the bias"); + ReweightBase::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","scalar","*.bias","the biases that must be taken into account when reweighting"); + keys.setValueDescription("scalar","the weight to use for this frame to negate the effect the bias"); } ReweightBias::ReweightBias(const ActionOptions&ao): diff --git a/src/bias/ReweightMetad.cpp b/src/bias/ReweightMetad.cpp index 05e5901892..886d44a2ba 100644 --- a/src/bias/ReweightMetad.cpp +++ b/src/bias/ReweightMetad.cpp @@ -75,9 +75,9 @@ class ReweightMetad : public ReweightBase { PLUMED_REGISTER_ACTION(ReweightMetad,"REWEIGHT_METAD") void ReweightMetad::registerKeywords(Keywords& keys ) { - ReweightBase::registerKeywords( keys ); keys.remove("ARG"); - keys.add("compulsory","ARG","*.rbias","the biases that must be taken into account when reweighting"); - keys.setValueDescription("the weight to use for this frame to negate the effect the metadynamics bias"); + ReweightBase::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","scalar","*.rbias","the biases that must be taken into account when reweighting"); + keys.setValueDescription("scalar","the weight to use for this frame to negate the effect the metadynamics bias"); } ReweightMetad::ReweightMetad(const ActionOptions&ao): diff --git a/src/bias/ReweightTemperaturePressure.cpp b/src/bias/ReweightTemperaturePressure.cpp index 71e55aadeb..3699e3fd4c 100644 --- a/src/bias/ReweightTemperaturePressure.cpp +++ b/src/bias/ReweightTemperaturePressure.cpp @@ -189,13 +189,12 @@ PLUMED_REGISTER_ACTION(ReweightTemperaturePressure,"REWEIGHT_TEMP_PRESS") void ReweightTemperaturePressure::registerKeywords(Keywords& keys ) { ReweightBase::registerKeywords( keys ); - keys.remove("ARG"); - keys.add("optional","ENERGY","Energy"); - keys.add("optional","VOLUME","Volume"); + keys.addInputKeyword("optional","ENERGY","scalar","Energy"); + keys.addInputKeyword("optional","VOLUME","scalar","Volume"); keys.add("optional","REWEIGHT_PRESSURE","Reweighting pressure"); keys.add("optional","PRESSURE","The system pressure"); keys.add("optional","REWEIGHT_TEMP","Reweighting temperature"); - keys.setValueDescription("the weight to use for this frame to determine its contribution at a different temperature/pressure"); + keys.setValueDescription("scalar","the weight to use for this frame to determine its contribution at a different temperature/pressure"); } ReweightTemperaturePressure::ReweightTemperaturePressure(const ActionOptions&ao): diff --git a/src/bias/UWalls.cpp b/src/bias/UWalls.cpp index 9bcb4b3ae0..635aca09c8 100644 --- a/src/bias/UWalls.cpp +++ b/src/bias/UWalls.cpp @@ -86,13 +86,13 @@ PLUMED_REGISTER_ACTION(UWalls,"UPPER_WALLS_SCALAR") void UWalls::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); keys.setDisplayName("UPPER_WALLS"); - keys.use("ARG"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); + keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); keys.add("compulsory","AT","the positions of the wall. The a_i in the expression for a wall."); keys.add("compulsory","KAPPA","the force constant for the wall. The k_i in the expression for a wall."); keys.add("compulsory","OFFSET","0.0","the offset for the start of the wall. The o_i in the expression for a wall."); keys.add("compulsory","EXP","2.0","the powers for the walls. The e_i in the expression for a wall."); keys.add("compulsory","EPS","1.0","the values for s_i in the expression for a wall"); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential"); } UWalls::UWalls(const ActionOptions&ao): diff --git a/src/bias/Walls.cpp b/src/bias/Walls.cpp index 34530e8f1f..28d5c89e04 100644 --- a/src/bias/Walls.cpp +++ b/src/bias/Walls.cpp @@ -39,15 +39,15 @@ PLUMED_REGISTER_ACTION(Walls,"LOWER_WALLS") void Walls::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords(keys); - keys.add("numbered","ARG","the arguments on which the bias is acting"); + keys.addInputKeyword("numbered","ARG","scalar/vector","the arguments on which the bias is acting"); keys.add("compulsory","AT","the positions of the wall. The a_i in the expression for a wall."); keys.add("compulsory","KAPPA","the force constant for the wall. The k_i in the expression for a wall."); keys.add("compulsory","OFFSET","0.0","the offset for the start of the wall. The o_i in the expression for a wall."); keys.add("compulsory","EXP","2.0","the powers for the walls. The e_i in the expression for a wall."); keys.add("compulsory","EPS","1.0","the values for s_i in the expression for a wall"); keys.add("hidden","STRIDE","the frequency with which the forces due to the bias should be calculated. This can be used to correctly set up multistep algorithms"); - keys.addOutputComponent("bias","default","the instantaneous value of the bias potential"); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("bias","default","scalar","the instantaneous value of the bias potential"); + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential"); keys.addActionNameSuffix("_SCALAR"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); keys.needsAction("SUM"); keys.needsAction("COMBINE"); keys.needsAction("BIASVALUE"); } diff --git a/src/cltools/GenJson.cpp b/src/cltools/GenJson.cpp index 86ed8f2ef4..a7d599bab1 100644 --- a/src/cltools/GenJson.cpp +++ b/src/cltools/GenJson.cpp @@ -121,7 +121,9 @@ int GenJson::main(FILE* in, FILE*out,Communicator& pc) { } std::size_t dot=desc.find_first_of("."); std::string mydescrip = desc.substr(0,dot); if( mydescrip.find("\\")!=std::string::npos ) error("found invalid backslash character documentation for keyword " + keys.getKeyword(j) + " in action " + action_names[i] ); - std::cout<<" \""<0 ) std::cout<<" \""<& atoms, ActionAtomistic* aa ) { diff --git a/src/colvar/Cell.cpp b/src/colvar/Cell.cpp index 9385e854a7..c35f4d8d68 100644 --- a/src/colvar/Cell.cpp +++ b/src/colvar/Cell.cpp @@ -79,15 +79,15 @@ void Cell::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionAtomistic::registerKeywords( keys ); - keys.addOutputComponent("ax","default","the ax component of the cell matrix"); - keys.addOutputComponent("ay","default","the ay component of the cell matrix"); - keys.addOutputComponent("az","default","the az component of the cell matrix"); - keys.addOutputComponent("bx","default","the bx component of the cell matrix"); - keys.addOutputComponent("by","default","the by component of the cell matrix"); - keys.addOutputComponent("bz","default","the bz component of the cell matrix"); - keys.addOutputComponent("cx","default","the cx component of the cell matrix"); - keys.addOutputComponent("cy","default","the cy component of the cell matrix"); - keys.addOutputComponent("cz","default","the cz component of the cell matrix"); + keys.addOutputComponent("ax","default","scalar","the ax component of the cell matrix"); + keys.addOutputComponent("ay","default","scalar","the ay component of the cell matrix"); + keys.addOutputComponent("az","default","scalar","the az component of the cell matrix"); + keys.addOutputComponent("bx","default","scalar","the bx component of the cell matrix"); + keys.addOutputComponent("by","default","scalar","the by component of the cell matrix"); + keys.addOutputComponent("bz","default","scalar","the bz component of the cell matrix"); + keys.addOutputComponent("cx","default","scalar","the cx component of the cell matrix"); + keys.addOutputComponent("cy","default","scalar","the cy component of the cell matrix"); + keys.addOutputComponent("cz","default","scalar","the cz component of the cell matrix"); } diff --git a/src/colvar/ContactMap.cpp b/src/colvar/ContactMap.cpp index 285554dcb9..3ad5016138 100644 --- a/src/colvar/ContactMap.cpp +++ b/src/colvar/ContactMap.cpp @@ -138,7 +138,8 @@ void ContactMap::registerKeywords( Keywords& keys ) { keys.addFlag("SUM",false,"calculate the sum of all the contacts in the input"); keys.addFlag("CMDIST",false,"calculate the distance with respect to the provided reference contact map"); keys.addFlag("SERIAL",false,"Perform the calculation in serial - for debug purpose"); - keys.addOutputComponent("contact","default","By not using SUM or CMDIST each contact will be stored in a component"); + keys.addOutputComponent("contact","default","scalar","By not using SUM or CMDIST each contact will be stored in a component"); + keys.setValueDescription("scalar","the sum of all the switching function on all the distances"); } ContactMap::ContactMap(const ActionOptions&ao): diff --git a/src/colvar/Coordination.cpp b/src/colvar/Coordination.cpp index 0ebd429097..587866670b 100644 --- a/src/colvar/Coordination.cpp +++ b/src/colvar/Coordination.cpp @@ -113,7 +113,7 @@ void Coordination::registerKeywords( Keywords& keys ) { keys.add("optional","SWITCH","This keyword is used if you want to employ an alternative to the continuous switching function defined above. " "The following provides information on the \\ref switchingfunction that are available. " "When this keyword is present you no longer need the NN, MM, D_0 and R_0 keywords."); - keys.setValueDescription("the value of the coordination"); + keys.setValueDescription("scalar","the value of the coordination"); } Coordination::Coordination(const ActionOptions&ao): diff --git a/src/colvar/DHEnergy.cpp b/src/colvar/DHEnergy.cpp index 677fa3978d..d25d67ca3c 100644 --- a/src/colvar/DHEnergy.cpp +++ b/src/colvar/DHEnergy.cpp @@ -78,7 +78,7 @@ void DHEnergy::registerKeywords( Keywords& keys ) { keys.add("compulsory","I","1.0","Ionic strength (M)"); keys.add("compulsory","TEMP","300.0","Simulation temperature (K)"); keys.add("compulsory","EPSILON","80.0","Dielectric constant of solvent"); - keys.setValueDescription("the value of the DHENERGY"); + keys.setValueDescription("scalar","the value of the DHENERGY"); } /* diff --git a/src/colvar/DRMSD.cpp b/src/colvar/DRMSD.cpp index 6c9a25bdea..34ecb257be 100644 --- a/src/colvar/DRMSD.cpp +++ b/src/colvar/DRMSD.cpp @@ -125,7 +125,7 @@ void DRMSD::registerKeywords( Keywords& keys ) { keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances"); // This is just ignored in reality which is probably bad keys.addFlag("NUMERICAL_DERIVATIVES",false,"calculate the derivatives for these quantities numerically"); - keys.setValueDescription("the DRMSD distance between the instantaneous structure and the reference structure"); + keys.setValueDescription("scalar/vector","the DRMSD distance between the instantaneous structure and the reference structure"); keys.needsAction("SUM"); keys.needsAction("DISTANCE"); keys.needsAction("CONSTANT"); keys.needsAction("EUCLIDEAN_DISTANCE"); keys.needsAction("CUSTOM"); } diff --git a/src/colvar/DihedralCorrelation.cpp b/src/colvar/DihedralCorrelation.cpp index 19e08feb1b..8e2bdb6825 100644 --- a/src/colvar/DihedralCorrelation.cpp +++ b/src/colvar/DihedralCorrelation.cpp @@ -88,7 +88,7 @@ void DihedralCorrelation::registerKeywords( Keywords& keys ) { Colvar::registerKeywords( keys ); keys.setDisplayName("DIHEDRAL_CORRELATION"); keys.add("atoms","ATOMS","the set of 8 atoms that are being used to calculate this quantity"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); - keys.setValueDescription("the DIHEDRAL_CORRELATION for these atoms"); + keys.setValueDescription("scalar/vector","the DIHEDRAL_CORRELATION for these atoms"); } DihedralCorrelation::DihedralCorrelation(const ActionOptions&ao): diff --git a/src/colvar/Dimer.cpp b/src/colvar/Dimer.cpp index edcea7fa32..bbf28c7a5d 100644 --- a/src/colvar/Dimer.cpp +++ b/src/colvar/Dimer.cpp @@ -155,7 +155,7 @@ void Dimer::registerKeywords( Keywords& keys) { keys.add("atoms", "ATOMS2", "The list of atoms representing the second bead of each Dimer being considered by this CV. Used if ALLATOMS flag is missing"); keys.addFlag("ALLATOMS", false, "Use EVERY atom of the system. Overrides ATOMS keyword."); keys.addFlag("NOVSITES", false, "If present the configuration is without virtual sites at the centroid positions."); - keys.setValueDescription("the dimer interaction energy"); + keys.setValueDescription("scalar","the dimer interaction energy"); } diff --git a/src/colvar/Dipole.cpp b/src/colvar/Dipole.cpp index e0a9212455..a87c16cb43 100644 --- a/src/colvar/Dipole.cpp +++ b/src/colvar/Dipole.cpp @@ -109,11 +109,11 @@ void Dipole::registerKeywords(Keywords& keys) { Colvar::registerKeywords(keys); keys.setDisplayName("DIPOLE"); keys.add("atoms","GROUP","the group of atoms we are calculating the dipole moment for"); keys.addFlag("COMPONENTS",false,"calculate the x, y and z components of the dipole separately and store them as label.x, label.y and label.z"); - keys.addOutputComponent("x","COMPONENTS","the x-component of the dipole"); - keys.addOutputComponent("y","COMPONENTS","the y-component of the dipole"); - keys.addOutputComponent("z","COMPONENTS","the z-component of the dipole"); + keys.addOutputComponent("x","COMPONENTS","scalar/vector","the x-component of the dipole"); + keys.addOutputComponent("y","COMPONENTS","scalar/vector","the y-component of the dipole"); + keys.addOutputComponent("z","COMPONENTS","scalar/vector","the z-component of the dipole"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); - keys.setValueDescription("the DIPOLE for these atoms"); + keys.setValueDescription("scalar/vector","the DIPOLE for these atoms"); } Dipole::Dipole(const ActionOptions&ao): diff --git a/src/colvar/Distance.cpp b/src/colvar/Distance.cpp index b2d75a27fe..b559e23a3d 100644 --- a/src/colvar/Distance.cpp +++ b/src/colvar/Distance.cpp @@ -154,14 +154,14 @@ void Distance::registerKeywords( Keywords& keys ) { keys.add("atoms","ATOMS","the pair of atom that we are calculating the distance between"); keys.addFlag("COMPONENTS",false,"calculate the x, y and z components of the distance separately and store them as label.x, label.y and label.z"); keys.addFlag("SCALED_COMPONENTS",false,"calculate the a, b and c scaled components of the distance separately and store them as label.a, label.b and label.c"); - keys.addOutputComponent("x","COMPONENTS","the x-component of the vector connecting the two atoms"); - keys.addOutputComponent("y","COMPONENTS","the y-component of the vector connecting the two atoms"); - keys.addOutputComponent("z","COMPONENTS","the z-component of the vector connecting the two atoms"); - keys.addOutputComponent("a","SCALED_COMPONENTS","the normalized projection on the first lattice vector of the vector connecting the two atoms"); - keys.addOutputComponent("b","SCALED_COMPONENTS","the normalized projection on the second lattice vector of the vector connecting the two atoms"); - keys.addOutputComponent("c","SCALED_COMPONENTS","the normalized projection on the third lattice vector of the vector connecting the two atoms"); + keys.addOutputComponent("x","COMPONENTS","scalar/vector","the x-component of the vector connecting the two atoms"); + keys.addOutputComponent("y","COMPONENTS","scalar/vector","the y-component of the vector connecting the two atoms"); + keys.addOutputComponent("z","COMPONENTS","scalar/vector","the z-component of the vector connecting the two atoms"); + keys.addOutputComponent("a","SCALED_COMPONENTS","scalar/vector","the normalized projection on the first lattice vector of the vector connecting the two atoms"); + keys.addOutputComponent("b","SCALED_COMPONENTS","scalar/vector","the normalized projection on the second lattice vector of the vector connecting the two atoms"); + keys.addOutputComponent("c","SCALED_COMPONENTS","scalar/vector","the normalized projection on the third lattice vector of the vector connecting the two atoms"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); - keys.setValueDescription("the DISTANCE between this pair of atoms"); + keys.setValueDescription("scalar/vector","the DISTANCE between this pair of atoms"); } Distance::Distance(const ActionOptions&ao): diff --git a/src/colvar/EEFSolv.cpp b/src/colvar/EEFSolv.cpp index 5d460ad977..37ce40b530 100644 --- a/src/colvar/EEFSolv.cpp +++ b/src/colvar/EEFSolv.cpp @@ -109,7 +109,7 @@ void EEFSolv::registerKeywords(Keywords& keys) { keys.add("compulsory", "NL_STRIDE", "40", "The frequency with which the neighbor list is updated."); keys.addFlag("SERIAL",false,"Perform the calculation in serial - for debug purpose"); keys.addFlag("TEMP_CORRECTION", false, "Correct free energy of solvation constants for temperatures different from 298.15 K"); - keys.setValueDescription("the EEF1 solvation free energy for the input atoms"); + keys.setValueDescription("scalar","the EEF1 solvation free energy for the input atoms"); } EEFSolv::EEFSolv(const ActionOptions&ao): diff --git a/src/colvar/ERMSD.cpp b/src/colvar/ERMSD.cpp index b5027ea0a3..68cad650c9 100644 --- a/src/colvar/ERMSD.cpp +++ b/src/colvar/ERMSD.cpp @@ -121,7 +121,7 @@ void ERMSD::registerKeywords(Keywords& keys) { keys.add("compulsory","CUTOFF","2.4","only pairs of atoms closer than CUTOFF are considered in the calculation."); keys.add("atoms","ATOMS","the list of atoms (use lcs)"); keys.add("optional","PAIRS","List of pairs considered. All pairs are considered if this value is not specified."); - keys.setValueDescription("the eRMSD between the instantaneous structure and the reference structure that was input"); + keys.setValueDescription("scalar","the eRMSD between the instantaneous structure and the reference structure that was input"); } ERMSD::ERMSD(const ActionOptions&ao): diff --git a/src/colvar/Energy.cpp b/src/colvar/Energy.cpp index 9a131d6b81..723d7683a2 100644 --- a/src/colvar/Energy.cpp +++ b/src/colvar/Energy.cpp @@ -101,6 +101,7 @@ Energy::Energy(const ActionOptions&ao): void Energy::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); + keys.setValueDescription("scalar","the internal energy"); } void Energy::wait() { diff --git a/src/colvar/ExtraCV.cpp b/src/colvar/ExtraCV.cpp index 5360a0201b..a4dc3f4e1f 100644 --- a/src/colvar/ExtraCV.cpp +++ b/src/colvar/ExtraCV.cpp @@ -69,7 +69,7 @@ ExtraCV::ExtraCV(const ActionOptions&ao): void ExtraCV::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); keys.add("compulsory","NAME","name of the CV as computed by the MD engine"); - keys.setValueDescription("the value of the CV that was passed from the MD code to PLUMED"); + keys.setValueDescription("scalar","the value of the CV that was passed from the MD code to PLUMED"); keys.needsAction("PUT"); keys.needsAction("COMBINE"); } diff --git a/src/colvar/GHBFIX.cpp b/src/colvar/GHBFIX.cpp index c21acf9af1..2d3ed6a1b0 100644 --- a/src/colvar/GHBFIX.cpp +++ b/src/colvar/GHBFIX.cpp @@ -92,7 +92,7 @@ void GHBFIX::registerKeywords( Keywords& keys ) { keys.add("compulsory","D_MAX","the value of D_MAX in the switching function"); keys.add("compulsory","D_0","the value of D_0 in the switching function"); keys.add("compulsory","C","the value of C in the switching function"); - keys.setValueDescription("the GHBFIX interaction energy between the atoms in GROUPA and GROUPB"); + keys.setValueDescription("scalar","the GHBFIX interaction energy between the atoms in GROUPA and GROUPB"); } GHBFIX::GHBFIX(const ActionOptions&ao): diff --git a/src/colvar/Gyration.cpp b/src/colvar/Gyration.cpp index c9ad222fc1..6443600293 100644 --- a/src/colvar/Gyration.cpp +++ b/src/colvar/Gyration.cpp @@ -97,7 +97,7 @@ void Gyration::registerKeywords(Keywords& keys) { keys.add("atoms","ATOMS","the group of atoms that you are calculating the Gyration Tensor for"); keys.add("compulsory","TYPE","RADIUS","The type of calculation relative to the Gyration Tensor you want to perform"); keys.addFlag("MASS_WEIGHTED",false,"set the masses of all the atoms equal to one"); - keys.setValueDescription("the radius of gyration"); + keys.setValueDescription("scalar","the radius of gyration"); } Gyration::Gyration(const ActionOptions&ao): diff --git a/src/colvar/GyrationShortcut.cpp b/src/colvar/GyrationShortcut.cpp index de87555798..8349042e20 100644 --- a/src/colvar/GyrationShortcut.cpp +++ b/src/colvar/GyrationShortcut.cpp @@ -66,7 +66,8 @@ void GyrationShortcut::registerKeywords( Keywords& keys ) { keys.addFlag("MASS",false,"calculate the center of mass"); keys.addFlag("MASS_WEIGHTED",false,"set the masses of all the atoms equal to one"); keys.addFlag("UNORMALIZED",false,"do not divide by the sum of the weights"); - keys.setValueDescription("the radius that was computed from the weights"); + if( keys.getDisplayName()=="GYRATION" ) keys.setValueDescription("scalar","the radius that was computed from the weights"); + else if( keys.getDisplayName()=="GYRATION_TENSOR" ) keys.setValueDescription("matrix","the gyration tensor that was computed from the weights"); keys.addActionNameSuffix("_FAST"); keys.needsAction("CENTER"); keys.needsAction("CONSTANT"); keys.needsAction("ONES"); keys.needsAction("MASS"); keys.needsAction("DISTANCE"); keys.needsAction("COVARIANCE_MATRIX"); keys.needsAction("SELECT_COMPONENTS"); diff --git a/src/colvar/MultiColvarTemplate.h b/src/colvar/MultiColvarTemplate.h index 3c15e05bec..d9cdb6ec29 100644 --- a/src/colvar/MultiColvarTemplate.h +++ b/src/colvar/MultiColvarTemplate.h @@ -56,7 +56,7 @@ void MultiColvarTemplate::registerKeywords(Keywords& keys ) { for(unsigned i=0; i diff --git a/src/colvar/MultiRMSD.cpp b/src/colvar/MultiRMSD.cpp index f2d934e68c..8b4264e2c4 100644 --- a/src/colvar/MultiRMSD.cpp +++ b/src/colvar/MultiRMSD.cpp @@ -58,7 +58,7 @@ void MultiRMSD::registerKeywords(Keywords& keys) { keys.add("compulsory","TYPE","SIMPLE","the manner in which RMSD alignment is performed. Should be MULTI-OPTIMAL, MULTI-OPTIMAL-FAST, MULTI-SIMPLE or MULTI-DRMSD."); keys.addFlag("SQUARED",false," This should be set if you want the mean squared displacement instead of the root mean squared displacement"); keys.addFlag("NOPBC",false,"don't use periodic boundary conditions"); - keys.setValueDescription("the sum of the multiple RMSD distances"); + keys.setValueDescription("scalar","the sum of the multiple RMSD distances"); keys.needsAction("CONSTANT"); keys.needsAction("WHOLEMOLECULES"); keys.needsAction("POSITION"); keys.needsAction("CONCATENATE"); keys.needsAction("RMSD_VECTOR"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); } diff --git a/src/colvar/PCARMSD.cpp b/src/colvar/PCARMSD.cpp index b2feb680c6..c34593b975 100644 --- a/src/colvar/PCARMSD.cpp +++ b/src/colvar/PCARMSD.cpp @@ -105,8 +105,8 @@ void PCARMSD::registerKeywords(Keywords& keys) { Colvar::registerKeywords(keys); keys.add("compulsory","AVERAGE","a file in pdb format containing the reference structure and the atoms involved in the CV."); keys.add("compulsory","EIGENVECTORS","a file in pdb format containing the reference structure and the atoms involved in the CV."); - keys.addOutputComponent("eig","default","the projections on each eigenvalue are stored on values labeled eig-1, eig-2, ..."); - keys.addOutputComponent("residual","default","the distance of the present configuration from the configuration supplied as AVERAGE in terms of mean squared displacement after optimal alignment "); + keys.addOutputComponent("eig","default","scalar","the projections on each eigenvalue are stored on values labeled eig-1, eig-2, ..."); + keys.addOutputComponent("residual","default","scalar","the distance of the present configuration from the configuration supplied as AVERAGE in terms of mean squared displacement after optimal alignment "); keys.addFlag("SQUARED_ROOT",false," This should be set if you want RMSD instead of mean squared displacement "); } diff --git a/src/colvar/PathMSD.cpp b/src/colvar/PathMSD.cpp index eac2131987..cd2a8930ba 100644 --- a/src/colvar/PathMSD.cpp +++ b/src/colvar/PathMSD.cpp @@ -99,8 +99,8 @@ PLUMED_REGISTER_ACTION(PathMSD,"PATHMSD") void PathMSD::registerKeywords(Keywords& keys) { PathMSDBase::registerKeywords(keys); - keys.addOutputComponent("sss","default","the position on the path"); - keys.addOutputComponent("zzz","default","the distance from the path"); + keys.addOutputComponent("sss","default","scalar","the position on the path"); + keys.addOutputComponent("zzz","default","scalar","the distance from the path"); } PathMSD::PathMSD(const ActionOptions&ao): diff --git a/src/colvar/Plane.cpp b/src/colvar/Plane.cpp index 9d57a1832d..4c9a00b6a6 100644 --- a/src/colvar/Plane.cpp +++ b/src/colvar/Plane.cpp @@ -86,9 +86,9 @@ PLUMED_REGISTER_ACTION(PlaneMulti,"PLANE_VECTOR") void Plane::registerKeywords( Keywords& keys ) { Colvar::registerKeywords( keys ); keys.setDisplayName("PLANE"); keys.add("atoms","ATOMS","the three or four atoms whose plane we are computing"); - keys.addOutputComponent("x","default","the x-component of the vector that is normal to the plane containing the atoms"); - keys.addOutputComponent("y","default","the y-component of the vector that is normal to the plane containing the atoms"); - keys.addOutputComponent("z","default","the z-component of the vector that is normal to the plane containing the atoms"); + keys.addOutputComponent("x","default","scalar/vector","the x-component of the vector that is normal to the plane containing the atoms"); + keys.addOutputComponent("y","default","scalar/vector","the y-component of the vector that is normal to the plane containing the atoms"); + keys.addOutputComponent("z","default","scalar/vector","the z-component of the vector that is normal to the plane containing the atoms"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); } diff --git a/src/colvar/Position.cpp b/src/colvar/Position.cpp index 20bdc8f234..a05cc492be 100644 --- a/src/colvar/Position.cpp +++ b/src/colvar/Position.cpp @@ -120,12 +120,12 @@ void Position::registerKeywords( Keywords& keys ) { keys.add("atoms","ATOMS","the atom numbers that you would like to use the positions of"); keys.addFlag("WHOLEMOLECULES",false,"if this is a vector of positions do you want to make the positions into a whole before"); keys.addFlag("SCALED_COMPONENTS",false,"calculate the a, b and c scaled components of the position separately and store them as label.a, label.b and label.c"); - keys.addOutputComponent("x","default","the x-component of the atom position"); - keys.addOutputComponent("y","default","the y-component of the atom position"); - keys.addOutputComponent("z","default","the z-component of the atom position"); - keys.addOutputComponent("a","SCALED_COMPONENTS","the normalized projection on the first lattice vector of the atom position"); - keys.addOutputComponent("b","SCALED_COMPONENTS","the normalized projection on the second lattice vector of the atom position"); - keys.addOutputComponent("c","SCALED_COMPONENTS","the normalized projection on the third lattice vector of the atom position"); + keys.addOutputComponent("x","default","scalar/vector","the x-component of the atom position"); + keys.addOutputComponent("y","default","scalar/vector","the y-component of the atom position"); + keys.addOutputComponent("z","default","scalar/vector","the z-component of the atom position"); + keys.addOutputComponent("a","SCALED_COMPONENTS","scalar/vector","the normalized projection on the first lattice vector of the atom position"); + keys.addOutputComponent("b","SCALED_COMPONENTS","scalar/vector","the normalized projection on the second lattice vector of the atom position"); + keys.addOutputComponent("c","SCALED_COMPONENTS","scalar/vector","the normalized projection on the third lattice vector of the atom position"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); } diff --git a/src/colvar/ProjectionOnAxis.cpp b/src/colvar/ProjectionOnAxis.cpp index a549c0ebad..fb4820e163 100644 --- a/src/colvar/ProjectionOnAxis.cpp +++ b/src/colvar/ProjectionOnAxis.cpp @@ -82,9 +82,9 @@ void ProjectionOnAxis::registerKeywords( Keywords& keys ) { Colvar::registerKeywords(keys); keys.add("atoms","AXIS_ATOMS","The atoms that define the direction of the axis of interest"); keys.add("atoms","ATOM","The atom whose position we want to project on the axis of interest"); - keys.addOutputComponent("proj","COMPONENTS","The value of the projection along the axis"); - keys.addOutputComponent("ext","COMPONENTS","The value of the extension from the axis"); - keys.setValueDescription("the value of the projection along the axis"); + keys.addOutputComponent("proj","COMPONENTS","scalar","The value of the projection along the axis"); + keys.addOutputComponent("ext","COMPONENTS","scalar","The value of the extension from the axis"); + keys.setValueDescription("scalar","the value of the projection along the axis"); } ProjectionOnAxis::ProjectionOnAxis(const ActionOptions&ao): diff --git a/src/colvar/PropertyMap.cpp b/src/colvar/PropertyMap.cpp index 347ac5a856..1624eaba8c 100644 --- a/src/colvar/PropertyMap.cpp +++ b/src/colvar/PropertyMap.cpp @@ -100,7 +100,7 @@ PLUMED_REGISTER_ACTION(PropertyMap,"PROPERTYMAP") void PropertyMap::registerKeywords(Keywords& keys) { PathMSDBase::registerKeywords(keys); keys.add("compulsory","PROPERTY","the property to be used in the indexing: this goes in the REMARK field of the reference"); - keys.addOutputComponent("zzz","default","the minimum distance from the reference points"); + keys.addOutputComponent("zzz","default","scalar","the minimum distance from the reference points"); ActionWithValue::useCustomisableComponents(keys); } diff --git a/src/colvar/Puckering.cpp b/src/colvar/Puckering.cpp index 08be02dc0e..8b98b2a7bf 100644 --- a/src/colvar/Puckering.cpp +++ b/src/colvar/Puckering.cpp @@ -84,16 +84,16 @@ void Puckering::registerKeywords(Keywords& keys) { Colvar::registerKeywords( keys ); keys.remove("NOPBC"); keys.add("atoms","ATOMS","the five or six atoms of the sugar ring in the proper order"); - keys.addOutputComponent("phs","default","Pseudorotation phase (5 membered rings)"); - keys.addOutputComponent("amp","default","Pseudorotation amplitude (5 membered rings)"); - keys.addOutputComponent("Zx","default","Pseudorotation x Cartesian component (5 membered rings)"); - keys.addOutputComponent("Zy","default","Pseudorotation y Cartesian component (5 membered rings)"); - keys.addOutputComponent("phi","default","Pseudorotation phase (6 membered rings)"); - keys.addOutputComponent("theta","default","Theta angle (6 membered rings)"); - keys.addOutputComponent("amplitude","default","Pseudorotation amplitude (6 membered rings)"); - keys.addOutputComponent("qx","default","Cartesian component x (6 membered rings)"); - keys.addOutputComponent("qy","default","Cartesian component y (6 membered rings)"); - keys.addOutputComponent("qz","default","Cartesian component z (6 membered rings)"); + keys.addOutputComponent("phs","default","scalar","Pseudorotation phase (5 membered rings)"); + keys.addOutputComponent("amp","default","scalar","Pseudorotation amplitude (5 membered rings)"); + keys.addOutputComponent("Zx","default","scalar","Pseudorotation x Cartesian component (5 membered rings)"); + keys.addOutputComponent("Zy","default","scalar","Pseudorotation y Cartesian component (5 membered rings)"); + keys.addOutputComponent("phi","default","scalar","Pseudorotation phase (6 membered rings)"); + keys.addOutputComponent("theta","default","scalar","Theta angle (6 membered rings)"); + keys.addOutputComponent("amplitude","default","scalar","Pseudorotation amplitude (6 membered rings)"); + keys.addOutputComponent("qx","default","scalar","Cartesian component x (6 membered rings)"); + keys.addOutputComponent("qy","default","scalar","Cartesian component y (6 membered rings)"); + keys.addOutputComponent("qz","default","scalar","Cartesian component z (6 membered rings)"); } Puckering::Puckering(const ActionOptions&ao): diff --git a/src/colvar/RMSD.cpp b/src/colvar/RMSD.cpp index 55ad012ebc..9ae8fbb509 100644 --- a/src/colvar/RMSD.cpp +++ b/src/colvar/RMSD.cpp @@ -171,7 +171,7 @@ void RMSD::registerKeywords(Keywords& keys) { keys.add("compulsory","REFERENCE","a file in pdb format containing the reference structure and the atoms involved in the CV."); keys.add("compulsory","TYPE","SIMPLE","the manner in which RMSD alignment is performed. Should be OPTIMAL or SIMPLE."); keys.addFlag("SQUARED",false," This should be set if you want mean squared displacement instead of RMSD "); - keys.setValueDescription("the RMSD between the instantaneous structure and the reference structure that was input"); + keys.setValueDescription("scalar","the RMSD between the instantaneous structure and the reference structure that was input"); } RMSD::RMSD(const ActionOptions&ao): diff --git a/src/colvar/RMSDShortcut.cpp b/src/colvar/RMSDShortcut.cpp index c068127b44..4e27bf2c49 100644 --- a/src/colvar/RMSDShortcut.cpp +++ b/src/colvar/RMSDShortcut.cpp @@ -45,7 +45,9 @@ void RMSDShortcut::registerKeywords(Keywords& keys) { keys.addFlag("NUMERICAL_DERIVATIVES", false, "calculate the derivatives for these quantities numerically"); keys.addFlag("DISPLACEMENT",false,"Calculate the vector of displacements instead of the length of this vector"); keys.add("compulsory","NUMBER","0","if there are multiple structures in the pdb file you can specify that you want the RMSD from a specific structure by specifying its place in the file here. If NUMBER=0 then the RMSD from all structures are computed"); - keys.setValueDescription("the RMSD distance between the instaneous structure and the reference structure/s that were input"); + keys.addOutputComponent("disp","DISPLACEMENT","vector/matrix","the vector of displacements for the atoms"); + keys.addOutputComponent("dist","DISPLACEMENT","scalar/vector","the RMSD distance the atoms have moved"); + keys.setValueDescription("scalar/vector","the RMSD distance between the instaneous structure and the reference structure/s that were input"); keys.addActionNameSuffix("_SCALAR"); keys.addActionNameSuffix("_VECTOR"); keys.needsAction("PDB2CONSTANT"); keys.needsAction("WHOLEMOLECULES"); keys.needsAction("POSITION"); keys.needsAction("CONCATENATE"); diff --git a/src/colvar/RMSDVector.cpp b/src/colvar/RMSDVector.cpp index b183dd5e1e..8f00c15b57 100644 --- a/src/colvar/RMSDVector.cpp +++ b/src/colvar/RMSDVector.cpp @@ -40,16 +40,17 @@ namespace colvar { PLUMED_REGISTER_ACTION(RMSDVector,"RMSD_VECTOR") void RMSDVector::registerKeywords(Keywords& keys) { - ActionWithVector::registerKeywords(keys); keys.use("ARG"); keys.setDisplayName("RMSD"); + ActionWithVector::registerKeywords(keys); keys.setDisplayName("RMSD"); + keys.addInputKeyword("compulsory","ARG","vector/matrix","the labels of two actions that you are calculating the RMSD between"); keys.add("compulsory","TYPE","SIMPLE","the manner in which RMSD alignment is performed. Should be OPTIMAL or SIMPLE."); keys.add("compulsory","ALIGN","1.0","the weights to use when aligning to the reference structure"); keys.add("compulsory","DISPLACE","1.0","the weights to use when calculating the displacement from the reference structure"); keys.addFlag("SQUARED",false," This should be set if you want mean squared displacement instead of RMSD "); keys.addFlag("UNORMALIZED",false,"by default the mean sequare deviation or root mean square deviation is calculated. If this option is given no averaging is done"); keys.addFlag("DISPLACEMENT",false,"Calculate the vector of displacements instead of the length of this vector"); - keys.addOutputComponent("disp","DISPLACEMENT","the vector of displacements for the atoms"); - keys.addOutputComponent("dist","DISPLACEMENT","the RMSD distance the atoms have moved"); - keys.setValueDescription("a vector containing the RMSD between the instantaneous structure and each of the reference structures that were input"); + keys.addOutputComponent("disp","DISPLACEMENT","vector/matrix","the vector of displacements for the atoms"); + keys.addOutputComponent("dist","DISPLACEMENT","scalar/vector","the RMSD distance the atoms have moved"); + keys.setValueDescription("scalar/vector","a vector containing the RMSD between the instantaneous structure and each of the reference structures that were input"); } RMSDVector::RMSDVector(const ActionOptions&ao): diff --git a/src/colvar/SelectMassCharge.cpp b/src/colvar/SelectMassCharge.cpp index 4d5a4855ea..9d0f4403cd 100644 --- a/src/colvar/SelectMassCharge.cpp +++ b/src/colvar/SelectMassCharge.cpp @@ -111,7 +111,7 @@ void SelectMassCharge::registerKeywords( Keywords& keys ) { keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); std::string acname = keys.getDisplayName(); std::size_t und = acname.find("_SCALAR"); if( und==std::string::npos ) und = acname.find("_VECTOR"); - keys.setDisplayName( acname.substr(0,und) ); keys.setValueDescription("the " + keys.getDisplayName() + " of the atom"); + keys.setDisplayName( acname.substr(0,und) ); keys.setValueDescription("scalar/vector","the " + keys.getDisplayName() + " of the atom"); } SelectMassCharge::SelectMassCharge(const ActionOptions&ao): diff --git a/src/colvar/Template.cpp b/src/colvar/Template.cpp index c507b96b1d..44eff25d39 100644 --- a/src/colvar/Template.cpp +++ b/src/colvar/Template.cpp @@ -64,7 +64,7 @@ void Template::registerKeywords(Keywords& keys) { keys.add("compulsory","TEMPLATE_COMPULSORY","all compulsory keywords should be added like this with a description here"); keys.add("optional","TEMPLATE_OPTIONAL","all optional keywords that have input should be added like a description here"); keys.add("atoms","ATOMS","the keyword with which you specify what atoms to use should be added like this"); - keys.setValueDescription("a description of the value that is computed by this colvar should be included here"); + keys.setValueDescription("scalar","a description of the value that is computed by this colvar should be included here"); } Template::Template(const ActionOptions&ao): diff --git a/src/colvar/Torsion.cpp b/src/colvar/Torsion.cpp index 710b1359eb..6a91e87856 100644 --- a/src/colvar/Torsion.cpp +++ b/src/colvar/Torsion.cpp @@ -141,7 +141,7 @@ void Torsion::registerKeywords(Keywords& keys) { keys.add("atoms-3","VECTOR2","two atoms that define a vector. You can use this in combination with VECTOR1 and AXIS"); keys.addFlag("COSINE",false,"calculate cosine instead of dihedral"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); - keys.setValueDescription("the TORSION involving these atoms"); + keys.setValueDescription("scalar/vector","the TORSION involving these atoms"); } Torsion::Torsion(const ActionOptions&ao): diff --git a/src/colvar/Volume.cpp b/src/colvar/Volume.cpp index a5fc1f5d3e..0a8f2aabac 100644 --- a/src/colvar/Volume.cpp +++ b/src/colvar/Volume.cpp @@ -67,7 +67,7 @@ void Volume::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionAtomistic::registerKeywords( keys ); - keys.setValueDescription("the volume of simulation box"); + keys.setValueDescription("scalar","the volume of simulation box"); } diff --git a/src/contour/ContourFindingBase.cpp b/src/contour/ContourFindingBase.cpp index 85fea0fa80..5ef200e749 100644 --- a/src/contour/ContourFindingBase.cpp +++ b/src/contour/ContourFindingBase.cpp @@ -25,7 +25,8 @@ namespace PLMD { namespace contour { void ContourFindingBase::registerKeywords( Keywords& keys ) { - gridtools::ActionWithGrid::registerKeywords( keys ); keys.use("ARG"); + gridtools::ActionWithGrid::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","grid","the labels of the grid in which the contour will be found"); keys.add("compulsory","CONTOUR","the value we would like to draw the contour at in the space"); gridtools::EvaluateGridFunction gg; gg.registerKeywords(keys); } diff --git a/src/contour/DistanceFromContour.cpp b/src/contour/DistanceFromContour.cpp index 53deddeba3..f95b4b4328 100644 --- a/src/contour/DistanceFromContour.cpp +++ b/src/contour/DistanceFromContour.cpp @@ -83,10 +83,10 @@ PLUMED_REGISTER_ACTION(DistanceFromContour,"DISTANCE_FROM_CONTOUR") void DistanceFromContour::registerKeywords( Keywords& keys ) { DistanceFromContourBase::registerKeywords( keys ); - keys.addOutputComponent("dist1","default","the distance between the reference atom and the nearest contour"); - keys.addOutputComponent("dist2","default","the distance between the reference atom and the other contour"); - keys.addOutputComponent("qdist","default","the differentiable (squared) distance between the two contours (see above)"); - keys.addOutputComponent("thickness","default","the distance between the two contours on the line from the reference atom"); + keys.addOutputComponent("dist1","default","scalar","the distance between the reference atom and the nearest contour"); + keys.addOutputComponent("dist2","default","scalar","the distance between the reference atom and the other contour"); + keys.addOutputComponent("qdist","default","scalar","the differentiable (squared) distance between the two contours (see above)"); + keys.addOutputComponent("thickness","default","scalar","the distance between the two contours on the line from the reference atom"); keys.add("compulsory","DIR","the direction perpendicular to the contour that you are looking for"); keys.add("compulsory","TOLERANCE","0.1","this parameter is used to manage periodic boundary conditions. The problem " "here is that we can be between contours even when we are not within the membrane " diff --git a/src/contour/DistanceFromContourBase.cpp b/src/contour/DistanceFromContourBase.cpp index 6444830865..c65f80f209 100644 --- a/src/contour/DistanceFromContourBase.cpp +++ b/src/contour/DistanceFromContourBase.cpp @@ -27,7 +27,8 @@ namespace contour { void DistanceFromContourBase::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionAtomistic::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); - keys.remove("NUMERICAL_DERIVATIVES"); keys.use("ARG"); + keys.remove("NUMERICAL_DERIVATIVES"); + keys.addInputKeyword("optional","ARG","vector","the label of the weights to use when constructing the density. If this keyword is not here the weights are assumed to be one."); keys.add("atoms","POSITIONS","the positions of the atoms that we are calculating the contour from"); keys.add("atoms","ATOM","The atom whose perpendicular distance we are calculating from the contour"); keys.add("compulsory","BANDWIDTH","the bandwidths for kernel density esimtation"); diff --git a/src/contour/DistanceFromSphericalContour.cpp b/src/contour/DistanceFromSphericalContour.cpp index 97997d80c1..197e324e47 100644 --- a/src/contour/DistanceFromSphericalContour.cpp +++ b/src/contour/DistanceFromSphericalContour.cpp @@ -46,8 +46,8 @@ PLUMED_REGISTER_ACTION(DistanceFromSphericalContour,"DISTANCE_FROM_SPHERICAL_CON void DistanceFromSphericalContour::registerKeywords( Keywords& keys ) { DistanceFromContourBase::registerKeywords( keys ); - keys.addOutputComponent("dist","default","the distance between the reference atom and the nearest contour"); - keys.addOutputComponent("radius","default","the radial distance from the center of the contour to the edge"); + keys.addOutputComponent("dist","default","scalar","the distance between the reference atom and the nearest contour"); + keys.addOutputComponent("radius","default","scalar","the radial distance from the center of the contour to the edge"); keys.add("atoms","ORIGIN","The position of the center of the region that the contour encloses"); } diff --git a/src/contour/DumpContour.cpp b/src/contour/DumpContour.cpp index 3377f38f45..06ceec0b2b 100644 --- a/src/contour/DumpContour.cpp +++ b/src/contour/DumpContour.cpp @@ -57,7 +57,8 @@ PLUMED_REGISTER_ACTION(DumpContour,"DUMPCONTOUR") void DumpContour::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionPilot::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","vector","the labels of the values that should be output to the file"); keys.add("compulsory","STRIDE","1","the frequency with which the grid should be output to the file."); keys.add("compulsory","FILE","density","the file on which to write the grid."); keys.add("optional","FMT","the format that should be used to output real numbers"); diff --git a/src/contour/FindContourSurface.cpp b/src/contour/FindContourSurface.cpp index 1a1d1eb28c..d210f5bbb2 100644 --- a/src/contour/FindContourSurface.cpp +++ b/src/contour/FindContourSurface.cpp @@ -110,7 +110,7 @@ PLUMED_REGISTER_ACTION(FindContourSurface,"FIND_CONTOUR_SURFACE") void FindContourSurface::registerKeywords( Keywords& keys ) { ContourFindingBase::registerKeywords( keys ); keys.add("compulsory","SEARCHDIR","In which directions do you wish to search for the contour."); - keys.setValueDescription("a grid containing the location of the points in the Willard-Chandler surface along the chosen direction"); + keys.setValueDescription("grid","a grid containing the location of the points in the Willard-Chandler surface along the chosen direction"); } FindContourSurface::FindContourSurface(const ActionOptions&ao): diff --git a/src/contour/FindSphericalContour.cpp b/src/contour/FindSphericalContour.cpp index c4d731bae9..e1b73aab2c 100644 --- a/src/contour/FindSphericalContour.cpp +++ b/src/contour/FindSphericalContour.cpp @@ -133,7 +133,7 @@ void FindSphericalContour::registerKeywords( Keywords& keys ) { keys.add("compulsory","INNER_RADIUS","the minimum radius on which to look for the contour"); keys.add("compulsory","OUTER_RADIUS","the outer radius on which to look for the contour"); keys.add("compulsory","NBINS","1","the number of discrete sections in which to divide the distance between the inner and outer radius when searching for a contour"); - keys.setValueDescription("a grid on a Fibonacci sphere that describes the radial distance from the origin for the points on the Willard-Chandler surface"); + keys.setValueDescription("grid","a grid on a Fibonacci sphere that describes the radial distance from the origin for the points on the Willard-Chandler surface"); } FindSphericalContour::FindSphericalContour(const ActionOptions&ao): diff --git a/src/core/ActionShortcut.cpp b/src/core/ActionShortcut.cpp index 29e5658155..377e37ce49 100644 --- a/src/core/ActionShortcut.cpp +++ b/src/core/ActionShortcut.cpp @@ -93,13 +93,20 @@ void ActionShortcut::readInputLine( const std::string& input, bool saveline ) { } if( av ) { std::string av_label = av->getLabel(); - if( av_label == getShortcutLabel() ) savedOutputs.push_back( av_label ); - else { + if( av_label == getShortcutLabel() && av->getNumberOfComponents()==1 ) { + savedOutputs.push_back( av_label ); + plumed_massert( keywords.componentHasCorrectType(".#!value", (av->copyOutput(0))->getRank(), (av->copyOutput(0))->hasDerivatives() ), "documentation for type of value is incorrect"); + } else { for(unsigned i=0; icopyOutput(0))->getRank(), (av->copyOutput(0))->hasDerivatives() ), "documentation for type of component " + keywords.cnames[i] + " is incorrect"); + } else if( keywords.getOutputComponentFlag(keywords.cnames[i])!="default" ) { std::string thisflag = keywords.getOutputComponentFlag(keywords.cnames[i]); - if( keywords.numbered(thisflag) && av_label.find(getShortcutLabel() + "_" + keywords.cnames[i])!=std::string::npos ) savedOutputs.push_back( av_label ); + if( keywords.numbered(thisflag) && av_label.find(getShortcutLabel() + "_" + keywords.cnames[i])!=std::string::npos ) { + savedOutputs.push_back( av_label ); + plumed_massert( keywords.componentHasCorrectType(keywords.cnames[i], (av->copyOutput(0))->getRank(), (av->copyOutput(0))->hasDerivatives() ), "documentation for type of component " + keywords.cnames[i] + " is incorrect"); + } } } } diff --git a/src/core/ActionToGetData.cpp b/src/core/ActionToGetData.cpp index 8c363b1e61..e1f3fad415 100644 --- a/src/core/ActionToGetData.cpp +++ b/src/core/ActionToGetData.cpp @@ -38,10 +38,10 @@ PLUMED_REGISTER_ACTION(ActionToGetData,"GET") void ActionToGetData::registerKeywords(Keywords& keys) { Action::registerKeywords(keys); ActionPilot::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); + keys.addInputKeyword("optional","ARG","scalar/vector/matrix/grid","the label of the value that you would like to GET"); keys.add("compulsory","STRIDE","1","the frequency with which the quantities of interest should be stored"); keys.add("compulsory","TYPE","value","what do you want to collect for the value can be derivative/force"); - keys.use("ARG"); - keys.setValueDescription("a copy of the data in the value specified by the ARG keyword"); + keys.setValueDescription("scalar/vector/matrix/grid","a copy of the data in the value specified by the ARG keyword"); } ActionToGetData::ActionToGetData(const ActionOptions&ao): diff --git a/src/core/ActionToPutData.cpp b/src/core/ActionToPutData.cpp index 06d75abf61..18bc950554 100644 --- a/src/core/ActionToPutData.cpp +++ b/src/core/ActionToPutData.cpp @@ -48,7 +48,7 @@ void ActionToPutData::registerKeywords(Keywords& keys) { keys.addFlag("CONSTANT",false,"does this quantity not depend on time"); keys.addFlag("FROM_DOMAINS",false,"is this quantity passed through the domain decomposition object"); keys.addFlag("MUTABLE",false,"can plumed change the value of the pointer that is passed from the MD code"); - keys.setValueDescription("the data that was passed from the MD code"); + keys.setValueDescription("scalar/vector/matrix/grid","the data that was passed from the MD code"); } ActionToPutData::ActionToPutData(const ActionOptions&ao): diff --git a/src/core/ActionWithArguments.cpp b/src/core/ActionWithArguments.cpp index a1b9208e6a..71f2f1c019 100644 --- a/src/core/ActionWithArguments.cpp +++ b/src/core/ActionWithArguments.cpp @@ -35,19 +35,20 @@ namespace PLMD { void ActionWithArguments::registerKeywords(Keywords& keys) { - keys.reserve("numbered","ARG","the input for this action is the scalar output from one or more other actions. The particular scalars that you will use " - "are referenced using the label of the action. If the label appears on its own then it is assumed that the Action calculates " - "a single scalar value. The value of this scalar is thus used as the input to this new action. If * or *.* appears the " - "scalars calculated by all the proceeding actions in the input file are taken. Some actions have multi-component outputs and " - "each component of the output has a specific label. For example a \\ref DISTANCE action labelled dist may have three components " - "x, y and z. To take just the x component you should use dist.x, if you wish to take all three components then use dist.*." - "More information on the referencing of Actions can be found in the section of the manual on the PLUMED \\ref Syntax. " - "Scalar values can also be " - "referenced using POSIX regular expressions as detailed in the section on \\ref Regex. To use this feature you you must compile " - "PLUMED with the appropriate flag."); +// keys.reserve("numbered","ARG","the input for this action is the scalar output from one or more other actions. The particular scalars that you will use " +// "are referenced using the label of the action. If the label appears on its own then it is assumed that the Action calculates " +// "a single scalar value. The value of this scalar is thus used as the input to this new action. If * or *.* appears the " +// "scalars calculated by all the proceeding actions in the input file are taken. Some actions have multi-component outputs and " +// "each component of the output has a specific label. For example a \\ref DISTANCE action labelled dist may have three components " +// "x, y and z. To take just the x component you should use dist.x, if you wish to take all three components then use dist.*." +// "More information on the referencing of Actions can be found in the section of the manual on the PLUMED \\ref Syntax. " +// "Scalar values can also be " +// "referenced using POSIX regular expressions as detailed in the section on \\ref Regex. To use this feature you you must compile " +// "PLUMED with the appropriate flag."); } void ActionWithArguments::parseArgumentList(const std::string&key,std::vector&arg) { + if( keywords.getArgumentType(key).length()==0 ) warning("keyword " + key + " for reading arguments should is registered using Keyword::add rather than Keyword::addInputKeyword. The keyword will thus not appear in the correct place in the manual"); std::string def; std::vector c; arg.clear(); parseVector(key,c); if( c.size()==0 && (keywords.style(key,"compulsory") || keywords.style(key,"hidden")) ) { if( keywords.getDefaultValue(key,def) ) c.push_back( def ); @@ -57,6 +58,7 @@ void ActionWithArguments::parseArgumentList(const std::string&key,std::vector&arg) { + if( keywords.getArgumentType(key).length()==0 ) warning("keyword " + key + " for reading argument should is registered using Keyword::add rather than Keyword::addInputKeyword. The keyword will thus not appear in the correct place in the manual"); std::vector c; arg.clear(); if(parseNumberedVector(key,i,c)) { @@ -189,6 +191,9 @@ void ActionWithArguments::interpretArgumentList(const std::vector& } } } + for(unsigned i=0; ikeywords.checkArgumentType( arg[i]->getRank(), arg[i]->hasDerivatives() ) ) readact->warning("documentation for input type is not provided in " + readact->getName() ); + } } void ActionWithArguments::expandArgKeywordInPDB( const PDB& pdb ) { diff --git a/src/core/ActionWithMatrix.cpp b/src/core/ActionWithMatrix.cpp index bc0609f41b..2ddadb5384 100644 --- a/src/core/ActionWithMatrix.cpp +++ b/src/core/ActionWithMatrix.cpp @@ -25,7 +25,7 @@ namespace PLMD { void ActionWithMatrix::registerKeywords( Keywords& keys ) { - ActionWithVector::registerKeywords( keys ); keys.use("ARG"); + ActionWithVector::registerKeywords( keys ); } ActionWithMatrix::ActionWithMatrix(const ActionOptions&ao): diff --git a/src/core/ActionWithValue.cpp b/src/core/ActionWithValue.cpp index 320450ae63..c49d3ff35b 100644 --- a/src/core/ActionWithValue.cpp +++ b/src/core/ActionWithValue.cpp @@ -45,7 +45,7 @@ void ActionWithValue::noAnalyticalDerivatives(Keywords& keys) { } void ActionWithValue::useCustomisableComponents(Keywords& keys) { - if( !keys.outputComponentExists(".#!custom") ) keys.addOutputComponent(".#!custom","default","the names of the output components for this action depend on the actions input file see the example inputs below for details"); + if( !keys.outputComponentExists(".#!custom") ) keys.addOutputComponent(".#!custom","default","scalar","the names of the output components for this action depend on the actions input file see the example inputs below for details"); keys.setComponentsIntroduction("The names of the components in this action can be customized by the user in the " "actions input file. However, in addition to the components that can be customized the " "following quantities will always be output"); @@ -109,12 +109,14 @@ Value* ActionWithValue::copyOutput( const unsigned& n ) const { void ActionWithValue::addValue( const std::vector& shape ) { if( !keywords.outputComponentExists(".#!value") ) warning("documentation for the value calculated by this action has not been included"); + else plumed_massert( keywords.componentHasCorrectType(".#!value",shape.size(),false), "documentation for type of value is incorrect"); plumed_massert(values.empty(),"You have already added the default value for this action"); values.emplace_back(Tools::make_unique(this,getLabel(), false, shape ) ); } void ActionWithValue::addValueWithDerivatives( const std::vector& shape ) { if( !keywords.outputComponentExists(".#!value") ) warning("documentation for the value calculated by this action has not been included"); + else plumed_massert( keywords.componentHasCorrectType(".#!value",shape.size(),true), "documentation for type of value is incorrect"); plumed_massert(values.empty(),"You have already added the default value for this action"); values.emplace_back(Tools::make_unique(this,getLabel(), true, shape ) ); } @@ -139,6 +141,7 @@ void ActionWithValue::addComponent( const std::string& name, const std::vectorname!=getLabel(),"Cannot mix single values with components"); @@ -156,6 +159,7 @@ void ActionWithValue::addComponentWithDerivatives( const std::string& name, cons plumed_merror("a description of component " + name + " has not been added to the manual. Components should be registered like keywords in " "registerKeywords as described in the developer doc."); } + plumed_massert( keywords.componentHasCorrectType(name,shape.size(),true), "documentation for type of component " + name + " is incorrect"); std::string thename; thename=getLabel() + "." + name; for(unsigned i=0; iname!=getLabel(),"Cannot mix single values with components"); diff --git a/src/core/ActionWithVirtualAtom.cpp b/src/core/ActionWithVirtualAtom.cpp index afd1a6e156..417906dfa2 100644 --- a/src/core/ActionWithVirtualAtom.cpp +++ b/src/core/ActionWithVirtualAtom.cpp @@ -29,11 +29,11 @@ void ActionWithVirtualAtom::registerKeywords(Keywords& keys) { Action::registerKeywords(keys); ActionAtomistic::registerKeywords(keys); keys.add("atoms","ATOMS","the list of atoms which are involved the virtual atom's definition"); - keys.addOutputComponent("x","default","the x coordinate of the virtual atom"); - keys.addOutputComponent("y","default","the y coordinate of the virtual atom"); - keys.addOutputComponent("z","default","the z coordinate of the virtual atom"); - keys.addOutputComponent("mass","default","the mass of the virtual atom"); - keys.addOutputComponent("charge","default","the charge of the virtual atom"); + keys.addOutputComponent("x","default","scalar","the x coordinate of the virtual atom"); + keys.addOutputComponent("y","default","scalar","the y coordinate of the virtual atom"); + keys.addOutputComponent("z","default","scalar","the z coordinate of the virtual atom"); + keys.addOutputComponent("mass","default","scalar","the mass of the virtual atom"); + keys.addOutputComponent("charge","default","scalar","the charge of the virtual atom"); } ActionWithVirtualAtom::ActionWithVirtualAtom(const ActionOptions&ao): diff --git a/src/core/DomainDecomposition.cpp b/src/core/DomainDecomposition.cpp index f1916a68b2..2c4215fe6d 100644 --- a/src/core/DomainDecomposition.cpp +++ b/src/core/DomainDecomposition.cpp @@ -94,7 +94,7 @@ void DomainDecomposition::registerKeywords(Keywords& keys) { "to deal with pbc"); keys.add("numbered","ROLE","Get the role this value plays in the code can be x/y/z/m/q to signify that this is x, y, z positions of atoms or masses or charges of atoms"); keys.add("compulsory","PBCLABEL","Box","the label to use for the PBC action that will be created"); - keys.setValueDescription("the domain that each atom is within"); + keys.setValueDescription("vector","the domain that each atom is within"); } DomainDecomposition::DomainDecomposition(const ActionOptions&ao): diff --git a/src/core/PbcAction.cpp b/src/core/PbcAction.cpp index ccbca7ebbe..763a298e9d 100644 --- a/src/core/PbcAction.cpp +++ b/src/core/PbcAction.cpp @@ -42,7 +42,7 @@ PLUMED_REGISTER_ACTION(PbcAction,"PBC") void PbcAction::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); - keys.setValueDescription("a matrix containing the cell vectors that were passed from the MD code"); + keys.setValueDescription("matrix","a matrix containing the cell vectors that were passed from the MD code"); } PbcAction::PbcAction(const ActionOptions&ao): diff --git a/src/crystdistrib/BopsShortcut.cpp b/src/crystdistrib/BopsShortcut.cpp index f06ecc1e4c..e02d8a41db 100644 --- a/src/crystdistrib/BopsShortcut.cpp +++ b/src/crystdistrib/BopsShortcut.cpp @@ -63,7 +63,7 @@ void BopsShortcut::registerKeywords( Keywords& keys ) { keys.add("compulsory","KERNELFILE_BOPS","the second file containing the list of kernel parameters. Expecting a normalization factor (height), concentration parameter (kappa), and 3 norm vector pieces of the mean (mu_i, mu_j, mu_k )for a fisher distribution. of the form h*exp(kappa*dot(r_mean,r)), where dot is a standard dot product."); keys.add("compulsory", "CUTOFF", "cutoff for the distance matrix"); // keys.add("compulsory","SWITCH","the switching function that acts on the distances between points)"); - keys.setValueDescription("the values of the bops order parameters"); + keys.setValueDescription("vector","the values of the bops order parameters"); keys.needsAction("DISTANCE_MATRIX"); keys.needsAction("QUATERNION_BOND_PRODUCT_MATRIX"); keys.needsAction("CUSTOM"); keys.needsAction("ONES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); } diff --git a/src/crystdistrib/DopsShortcut.cpp b/src/crystdistrib/DopsShortcut.cpp index 7465b3b732..793733759f 100644 --- a/src/crystdistrib/DopsShortcut.cpp +++ b/src/crystdistrib/DopsShortcut.cpp @@ -60,7 +60,7 @@ void DopsShortcut::registerKeywords( Keywords& keys ) { "the documentation for that keyword"); keys.add("compulsory","KERNELFILE","the file containing the list of kernel parameters. We expect h, mu and sigma parameters for a 1D Gaussian kernel of the form h*exp(-(x-mu)^2/2sigma^2)"); keys.add("compulsory","CUTOFF","6.25","to make the calculation faster we calculate a cutoff value on the distances. The input to this keyword determines x in this expreession max(mu + sqrt(2*x)/sigma)"); - keys.setValueDescription("the values of the DOPS order parameters"); + keys.setValueDescription("vector","the values of the DOPS order parameters"); keys.needsAction("DISTANCE_MATRIX"); keys.needsAction("CUSTOM"); keys.needsAction("ONES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); } diff --git a/src/crystdistrib/Quaternion.cpp b/src/crystdistrib/Quaternion.cpp index 700b04d016..1eb16b2b0d 100644 --- a/src/crystdistrib/Quaternion.cpp +++ b/src/crystdistrib/Quaternion.cpp @@ -121,10 +121,10 @@ PLUMED_REGISTER_ACTION(QuaternionMulti,"QUATERNION_VECTOR") void Quaternion::registerKeywords( Keywords& keys ) { Colvar::registerKeywords( keys ); keys.setDisplayName("QUATERNION"); keys.add("atoms","ATOMS","the three atom that we are using to calculate the quaternion"); - keys.addOutputComponent("w","default","the real component of quaternion"); - keys.addOutputComponent("i","default","the i component of the quaternion"); - keys.addOutputComponent("j","default","the j component of the quaternion"); - keys.addOutputComponent("k","default","the k component of the quaternion"); + keys.addOutputComponent("w","default","scalar/vector","the real component of quaternion"); + keys.addOutputComponent("i","default","scalar/vector","the i component of the quaternion"); + keys.addOutputComponent("j","default","scalar/vector","the j component of the quaternion"); + keys.addOutputComponent("k","default","scalar/vector","the k component of the quaternion"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); } diff --git a/src/crystdistrib/QuaternionBondProductMatrix.cpp b/src/crystdistrib/QuaternionBondProductMatrix.cpp index fb92cb1969..ce14058cc2 100644 --- a/src/crystdistrib/QuaternionBondProductMatrix.cpp +++ b/src/crystdistrib/QuaternionBondProductMatrix.cpp @@ -73,11 +73,12 @@ PLUMED_REGISTER_ACTION(QuaternionBondProductMatrix,"QUATERNION_BOND_PRODUCT_MATR void QuaternionBondProductMatrix::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); - keys.addOutputComponent("w","default","the real component of quaternion"); - keys.addOutputComponent("i","default","the i component of the quaternion"); - keys.addOutputComponent("j","default","the j component of the quaternion"); - keys.addOutputComponent("k","default","the k component of the quaternion"); + ActionWithMatrix::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","vector/matrix","this action takes 8 arguments. The first four should be the w,i,j and k components of a quaternion vector. The second four should be contact matrix and the matrices should be the x, y and z components of the bond vectors"); + keys.addOutputComponent("w","default","matrix","the real component of quaternion"); + keys.addOutputComponent("i","default","matrix","the i component of the quaternion"); + keys.addOutputComponent("j","default","matrix","the j component of the quaternion"); + keys.addOutputComponent("k","default","matrix","the k component of the quaternion"); } QuaternionBondProductMatrix::QuaternionBondProductMatrix(const ActionOptions&ao): diff --git a/src/crystdistrib/QuaternionProductMatrix.cpp b/src/crystdistrib/QuaternionProductMatrix.cpp index 53213f7ab0..a14cca09c4 100644 --- a/src/crystdistrib/QuaternionProductMatrix.cpp +++ b/src/crystdistrib/QuaternionProductMatrix.cpp @@ -50,11 +50,12 @@ class QuaternionProductMatrix : public ActionWithMatrix { PLUMED_REGISTER_ACTION(QuaternionProductMatrix,"QUATERNION_PRODUCT_MATRIX") void QuaternionProductMatrix::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); - keys.addOutputComponent("w","default","the real component of quaternion"); - keys.addOutputComponent("i","default","the i component of the quaternion"); - keys.addOutputComponent("j","default","the j component of the quaternion"); - keys.addOutputComponent("k","default","the k component of the quaternion"); + ActionWithMatrix::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","vector","the labels of the quaternion vectors that you are outer product of"); + keys.addOutputComponent("w","default","matrix","the real component of quaternion"); + keys.addOutputComponent("i","default","matrix","the i component of the quaternion"); + keys.addOutputComponent("j","default","matrix","the j component of the quaternion"); + keys.addOutputComponent("k","default","matrix","the k component of the quaternion"); } QuaternionProductMatrix::QuaternionProductMatrix(const ActionOptions&ao): diff --git a/src/crystdistrib/RopsShortcut.cpp b/src/crystdistrib/RopsShortcut.cpp index d647de6664..79520f1dca 100644 --- a/src/crystdistrib/RopsShortcut.cpp +++ b/src/crystdistrib/RopsShortcut.cpp @@ -63,7 +63,7 @@ void RopsShortcut::registerKeywords( Keywords& keys ) { keys.add("compulsory","KERNELFILE_ROPS","the file containing the list of kernel parameters. We expect the normalization factor (height), concentration parameter (kappa), and 4 quaternion pieces of the mean for a bipolar watson distribution (mu_w,mu_i,mu_j,mu_k)): (h*exp(kappa*dot(q_mean,q))), where dot is the dot product "); keys.add("compulsory", "CUTOFF", "cutoff for the distance matrix"); // keys.add("compulsory","SWITCH","the switching function that acts on the distances between points)"); - keys.setValueDescription("the values of the ROPS order parameters"); + keys.setValueDescription("vector","the values of the ROPS order parameters"); keys.needsAction("DISTANCE_MATRIX"); keys.needsAction("QUATERNION_PRODUCT_MATRIX"); keys.needsAction("ONES"); keys.needsAction("CUSTOM"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); } diff --git a/src/dimred/ArrangePoints.cpp b/src/dimred/ArrangePoints.cpp index 357eefe4d0..5296042c94 100644 --- a/src/dimred/ArrangePoints.cpp +++ b/src/dimred/ArrangePoints.cpp @@ -70,10 +70,11 @@ PLUMED_REGISTER_ACTION(ArrangePoints,"ARRANGE_POINTS") void ArrangePoints::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); - keys.add("numbered","TARGET","the matrix of target quantities that you would like to match"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","vector","the initial positions for the projections"); + keys.addInputKeyword("numbered","TARGET","matrix","the matrix of target quantities that you would like to match"); keys.add("numbered","FUNC","a function that is applied on the distances between the points in the low dimensional space"); - keys.add("numbered","WEIGHTS","the matrix with the weights of the target quantities"); + keys.addInputKeyword("numbered","WEIGHTS","matrix","the matrix with the weights of the target quantities"); keys.add("compulsory","MINTYPE","conjgrad","the method to use for the minimisation"); keys.add("compulsory","MAXITER","1000","maximum number of optimization cycles for optimisation algorithms"); keys.add("compulsory","CGTOL","1E-6","the tolerance for the conjugate gradient minimization"); @@ -83,7 +84,7 @@ void ArrangePoints::registerKeywords( Keywords& keys ) { keys.add("compulsory","FGRID_SIZE","0","interpolate the grid onto this number of points -- only works in 2D"); keys.add("compulsory","SMACTOL","1E-4","the tolerance for the smacof algorithm"); keys.add("compulsory","SMACREG","0.001","this is used to ensure that we don't divide by zero when updating weights for SMACOF algorithm"); - keys.addOutputComponent("coord","default","the coordinates of the points in the low dimensional space"); + keys.addOutputComponent("coord","default","vector","the coordinates of the points in the low dimensional space"); } diff --git a/src/dimred/ClassicalMultiDimensionalScaling.cpp b/src/dimred/ClassicalMultiDimensionalScaling.cpp index ff948203e2..5503b1ed39 100644 --- a/src/dimred/ClassicalMultiDimensionalScaling.cpp +++ b/src/dimred/ClassicalMultiDimensionalScaling.cpp @@ -175,7 +175,7 @@ void ClassicalMultiDimensionalScaling::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); keys.add("compulsory","ARG","the arguments that you would like to make the histogram for"); keys.add("compulsory","NLOW_DIM","number of low-dimensional coordinates required"); - keys.setValueDescription("the low dimensional projections for the input data points"); + keys.setValueDescription("matrix","the low dimensional projections for the input data points"); keys.needsAction("TRANSPOSE"); keys.needsAction("DISSIMILARITIES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("VSTACK"); keys.needsAction("SUM"); keys.needsAction("CUSTOM"); keys.needsAction("OUTER_PRODUCT"); keys.needsAction("DIAGONALIZE"); } diff --git a/src/dimred/PCA.cpp b/src/dimred/PCA.cpp index 711697f6e3..4e3849bba9 100644 --- a/src/dimred/PCA.cpp +++ b/src/dimred/PCA.cpp @@ -113,7 +113,7 @@ void PCA::registerKeywords( Keywords& keys ) { keys.add("compulsory","STRIDE","0","the frequency with which to perform this analysis"); keys.add("optional","FILE","the file on which to output the low dimensional coordinates"); keys.add("optional","FMT","the format to use when outputting the low dimensional coordinates"); - keys.setValueDescription("the projections of the input coordinates on the PCA components that were found from the covariance matrix"); + keys.setValueDescription("matrix","the projections of the input coordinates on the PCA components that were found from the covariance matrix"); keys.needsAction("LOGSUMEXP"); keys.needsAction("TRANSPOSE"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("CONSTANT"); keys.needsAction("COLLECT"); keys.needsAction("OUTER_PRODUCT"); keys.needsAction("CUSTOM"); keys.needsAction("MATRIX_PRODUCT"); keys.needsAction("DIAGONALIZE"); keys.needsAction("VSTACK"); keys.needsAction("DUMPPDB"); diff --git a/src/dimred/ProjectPoints.cpp b/src/dimred/ProjectPoints.cpp index 1b6bb2de57..128eeadf31 100644 --- a/src/dimred/ProjectPoints.cpp +++ b/src/dimred/ProjectPoints.cpp @@ -60,12 +60,13 @@ class ProjectPoints : public ActionWithVector { PLUMED_REGISTER_ACTION(ProjectPoints,"PROJECT_POINTS") void ProjectPoints::registerKeywords( Keywords& keys ) { - ActionWithVector::registerKeywords( keys ); keys.use("ARG"); - keys.add("numbered","TARGET","the matrix of target quantities that you would like to match"); + ActionWithVector::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","vector","the projections of the landmark points"); + keys.addInputKeyword("numbered","TARGET","vector/matrix","the matrix of target quantities that you would like to match"); keys.add("numbered","FUNC","a function that is applied on the distances between the points in the low dimensional space"); - keys.add("numbered","WEIGHTS","the matrix with the weights of the target quantities"); + keys.addInputKeyword("numbered","WEIGHTS","vector","the matrix with the weights of the target quantities"); keys.add("compulsory","CGTOL","1E-6","the tolerance for the conjugate gradient minimization"); - keys.addOutputComponent("coord","default","the coordinates of the points in the low dimensional space"); + keys.addOutputComponent("coord","default","scalar/vector","the coordinates of the points in the low dimensional space"); } diff --git a/src/dimred/SketchMap.cpp b/src/dimred/SketchMap.cpp index 698ad35b8c..b189ba4913 100644 --- a/src/dimred/SketchMap.cpp +++ b/src/dimred/SketchMap.cpp @@ -63,8 +63,8 @@ void SketchMap::registerKeywords( Keywords& keys ) { keys.addFlag("USE_SMACOF",false,"find the projection in the low dimensional space using the SMACOF algorithm"); keys.add("compulsory","SMACTOL","1E-4","the tolerance for the smacof algorithm"); keys.add("compulsory","SMACREG","0.001","this is used to ensure that we don't divide by zero when updating weights for SMACOF algorithm"); - keys.setValueDescription("the sketch-map projection of the input points"); - keys.addOutputComponent("osample","PROJECT_ALL","the out-of-sample projections"); + keys.setValueDescription("matrix","the sketch-map projection of the input points"); + keys.addOutputComponent("osample","PROJECT_ALL","matrix","the out-of-sample projections"); keys.needsAction("CLASSICAL_MDS"); keys.needsAction("MORE_THAN"); keys.needsAction("SUM"); keys.needsAction("CUSTOM"); keys.needsAction("OUTER_PRODUCT"); keys.needsAction("ARRANGE_POINTS"); keys.needsAction("PROJECT_POINTS"); keys.needsAction("VSTACK"); } diff --git a/src/dimred/SketchMapProjection.cpp b/src/dimred/SketchMapProjection.cpp index a047bd5ed0..8fdac8dbb2 100644 --- a/src/dimred/SketchMapProjection.cpp +++ b/src/dimred/SketchMapProjection.cpp @@ -50,7 +50,7 @@ void SketchMapProjection::registerKeywords( Keywords& keys ) { keys.add("compulsory","HIGH_DIM_FUNCTION","the parameters of the switching function in the high dimensional space"); keys.add("compulsory","LOW_DIM_FUNCTION","the parameters of the switching function in the low dimensional space"); keys.add("compulsory","CGTOL","1E-6","The tolerance for the conjugate gradient minimization that finds the out of sample projections"); - keys.setValueDescription("the out-of-sample projections of the input arguments using the input sketch-map projection"); + keys.setValueDescription("scalar/vector","the out-of-sample projections of the input arguments using the input sketch-map projection"); keys.needsAction("RMSD"); keys.needsAction("PDB2CONSTANT"); keys.needsAction("CONSTANT"); keys.needsAction("CUSTOM"); keys.needsAction("EUCLIDEAN_DISTANCE"); keys.needsAction("NORMALIZED_EUCLIDEAN_DISTANCE"); keys.needsAction("SUM"); keys.needsAction("MORE_THAN"); keys.needsAction("PROJECT_POINTS"); diff --git a/src/drr/DynamicReferenceRestraining.cpp b/src/drr/DynamicReferenceRestraining.cpp index 77c40ff532..c85ece3ece 100644 --- a/src/drr/DynamicReferenceRestraining.cpp +++ b/src/drr/DynamicReferenceRestraining.cpp @@ -246,7 +246,6 @@ PLUMED_REGISTER_ACTION(DynamicReferenceRestraining, "DRR") void DynamicReferenceRestraining::registerKeywords(Keywords &keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("optional", "KAPPA", "specifies that the restraint is harmonic and " "what the values of the force constants on " "each of the variables are (default to " diff --git a/src/eds/EDS.cpp b/src/eds/EDS.cpp index 6b86d470d9..8444f48cbf 100644 --- a/src/eds/EDS.cpp +++ b/src/eds/EDS.cpp @@ -281,10 +281,9 @@ PLUMED_REGISTER_ACTION(EDS, "EDS") void EDS::registerKeywords(Keywords &keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("optional", "CENTER", "The desired centers (equilibrium values) which will be sought during the adaptive linear biasing. This is for fixed centers"); - keys.add("optional", "CENTER_ARG", "The desired centers (equilibrium values) which will be sought during the adaptive linear biasing. " - "CENTER_ARG is for calculated centers, e.g. from a CV or analysis. "); + keys.addInputKeyword("optional", "CENTER_ARG", "scalar", "The desired centers (equilibrium values) which will be sought during the adaptive linear biasing. " + "CENTER_ARG is for calculated centers, e.g. from a CV or analysis. "); keys.add("optional", "PERIOD", "Steps over which to adjust bias for adaptive or ramping"); keys.add("compulsory", "RANGE", "25.0", "The (starting) maximum increase in coupling constant per PERIOD (in k_B T/[BIAS_SCALE unit]) for each CV biased"); @@ -298,7 +297,7 @@ void EDS::registerKeywords(Keywords &keys) "Must be in interval [1,0), where 1 indicates all and any other indicates a stochastic update. " "If not set, default is 1 / N, where N is the number of CVs. "); keys.add("optional", "VIRIAL", "Add an update penalty for having non-zero virial contributions. Only makes sense with multiple correlated CVs."); - keys.add("optional", "LOGWEIGHTS", "Add weights to use for computing statistics. For example, if biasing with metadynamics."); + keys.addInputKeyword("optional", "LOGWEIGHTS", "scalar", "Add weights to use for computing statistics. For example, if biasing with metadynamics."); keys.addFlag("LM", false, "Use Levenberg-Marquadt algorithm along with simultaneous keyword. Otherwise use gradient descent."); keys.add("compulsory", "LM_MIXING", "1", "Initial mixing parameter when using Levenberg-Marquadt minimization."); keys.add("optional", "RESTART_FMT", "the format that should be used to output real numbers in EDS restarts"); @@ -316,9 +315,9 @@ void EDS::registerKeywords(Keywords &keys) keys.use("RESTART"); - keys.addOutputComponent("force2", "default", "squared value of force from the bias"); - keys.addOutputComponent("pressure", "default", "If using virial keyword, this is the current sum of virial terms. It is in units of pressure (energy / vol^3)"); - keys.addOutputComponent("_coupling", "default", "For each named CV biased, there will be a corresponding output CV_coupling storing the current linear bias prefactor."); + keys.addOutputComponent("force2", "default", "scalar", "squared value of force from the bias"); + keys.addOutputComponent("pressure", "default", "scalar", "If using virial keyword, this is the current sum of virial terms. It is in units of pressure (energy / vol^3)"); + keys.addOutputComponent("_coupling", "default", "scalar", "For each named CV biased, there will be a corresponding output CV_coupling storing the current linear bias prefactor."); } EDS::EDS(const ActionOptions &ao) : PLUMED_BIAS_INIT(ao), diff --git a/src/envsim/EnvironmentSimilarity.cpp b/src/envsim/EnvironmentSimilarity.cpp index 4f67821e4d..1665e441c5 100644 --- a/src/envsim/EnvironmentSimilarity.cpp +++ b/src/envsim/EnvironmentSimilarity.cpp @@ -219,6 +219,7 @@ void EnvironmentSimilarity::registerKeywords( Keywords& keys ) { keys.add("compulsory","LAMBDA","100","Lambda parameter. This is only used if you have more than one reference environment"); keys.add("compulsory","CUTOFF","3","how many multiples of sigma would you like to consider beyond the maximum distance in the environment"); keys.add("optional","ATOM_NAMES_FILE","PDB file with atom names for all atoms in SPECIES. Atoms in reference environments will be compared only if atom names match."); + keys.setValueDescription("vector","the environmental similar parameter for each of the input atoms"); multicolvar::MultiColvarShortcuts::shortcutKeywords( keys ); keys.needsAction("GROUP"); keys.needsAction("DISTANCE_MATRIX"); keys.needsAction("ONES"); keys.needsAction("CONSTANT"); keys.needsAction("CUSTOM"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("COMBINE"); diff --git a/src/fisst/FISST.cpp b/src/fisst/FISST.cpp index 9d1f6038e2..2db59fb765 100644 --- a/src/fisst/FISST.cpp +++ b/src/fisst/FISST.cpp @@ -166,7 +166,6 @@ PLUMED_REGISTER_ACTION(FISST,"FISST") void FISST::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","PERIOD","Steps corresponding to the learning rate"); keys.add("optional","RESET_PERIOD","Reset the learning statistics every time this number of steps comes around."); keys.add("compulsory","NINTERPOLATE","Number of grid points on which to do interpolation."); @@ -191,8 +190,8 @@ void FISST::registerKeywords(Keywords& keys) { keys.add("optional","OBSERVABLE_FREQ","How often to write out observable weights (default=period)."); keys.addFlag("FREEZE",false,"Fix bias weights at current level (only used for restarting)."); keys.use("RESTART"); - keys.addOutputComponent("force2","default","squared value of force from the bias."); - keys.addOutputComponent("_fbar","default", "For each named CV biased, there will be a corresponding output CV_fbar storing the current linear bias prefactor."); + keys.addOutputComponent("force2","default","scalar", "squared value of force from the bias."); + keys.addOutputComponent("_fbar","default", "scalar", "For each named CV biased, there will be a corresponding output CV_fbar storing the current linear bias prefactor."); } FISST::FISST(const ActionOptions&ao): diff --git a/src/fourier/FourierTransform.cpp b/src/fourier/FourierTransform.cpp index 0734325b91..1207f2f3fd 100644 --- a/src/fourier/FourierTransform.cpp +++ b/src/fourier/FourierTransform.cpp @@ -87,14 +87,15 @@ class FourierTransform : public gridtools::ActionWithGrid { PLUMED_REGISTER_ACTION(FourierTransform,"FOURIER_TRANSFORM") void FourierTransform::registerKeywords( Keywords& keys ) { - ActionWithGrid::registerKeywords( keys ); keys.use("ARG"); + ActionWithGrid::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","grid","the label of the grid that you want to fourer transform"); keys.add("optional","FT_TYPE","choose what kind of data you want as output on the grid. Possible values are: ABS = compute the complex modulus of Fourier coefficients (DEFAULT); NORM = compute the norm (i.e. ABS^2) of Fourier coefficients; COMPLEX = store the FFTW complex output on the grid (as a vector)."); keys.add("compulsory","FOURIER_PARAMETERS","default","what kind of normalization is applied to the output and if the Fourier transform in FORWARD or BACKWARD. This keyword takes the form FOURIER_PARAMETERS=A,B, where A and B can be 0, 1 or -1. The default values are A=1 (no normalization at all) and B=1 (forward FFT). Other possible choices for A are: " "A=-1: normalize by the number of data, " "A=0: normalize by the square root of the number of data (one forward and followed by backward FFT recover the original data). "); - keys.addOutputComponent("real","FT_TYPE","the real part of the function"); - keys.addOutputComponent("imag","FT_TYPE","the imaginary part of the function"); - keys.setValueDescription("the fourier transform of the input grid"); + keys.addOutputComponent("real","FT_TYPE","grid","the real part of the function"); + keys.addOutputComponent("imag","FT_TYPE","grid","the imaginary part of the function"); + keys.setValueDescription("grid","the fourier transform of the input grid"); } FourierTransform::FourierTransform(const ActionOptions&ao): diff --git a/src/function/Bessel.cpp b/src/function/Bessel.cpp index d853e209b0..d27c7a1e06 100644 --- a/src/function/Bessel.cpp +++ b/src/function/Bessel.cpp @@ -84,7 +84,7 @@ PLUMED_REGISTER_ACTION(VectorBessel,"BESSEL_VECTOR") void Bessel::registerKeywords(Keywords& keys) { keys.add("compulsory","ORDER","0","the order of Bessel function to use. Can only be zero at the moment."); - keys.setValueDescription("the value of the bessel function"); + keys.setValueDescription("scalar/vector","the value of the bessel function"); } void Bessel::read( ActionWithArguments* action ) { diff --git a/src/function/Between.cpp b/src/function/Between.cpp index 15667e9460..533f778851 100644 --- a/src/function/Between.cpp +++ b/src/function/Between.cpp @@ -71,7 +71,7 @@ void Between::registerKeywords(Keywords& keys) { keys.add("optional","SWITCH","This keyword is used if you want to employ an alternative to the continuous function defined above. " "The following provides information on the \\ref histogrambead that are available. " "When this keyword is present you no longer need the LOWER, UPPER, SMEAR and KERNEL keywords."); - keys.setValueDescription("a function that is one if the input falls within a particular range and zero otherwise"); + keys.setValueDescription("scalar/vector/matrix","a function that is one if the input falls within a particular range and zero otherwise"); } void Between::read( ActionWithArguments* action ) { diff --git a/src/function/Combine.cpp b/src/function/Combine.cpp index 72f9a3961f..fef7f4e5ae 100644 --- a/src/function/Combine.cpp +++ b/src/function/Combine.cpp @@ -119,7 +119,7 @@ void Combine::registerKeywords(Keywords& keys) { keys.add("compulsory","PARAMETERS","0.0","the parameters of the arguments in your function"); keys.add("compulsory","POWERS","1.0","the powers to which you are raising each of the arguments in your function"); keys.addFlag("NORMALIZE",false,"normalize all the coefficients so that in total they are equal to one"); - keys.setValueDescription("a linear compbination"); + keys.setValueDescription("scalar/vector/matrix","a linear compbination"); } void Combine::read( ActionWithArguments* action ) { diff --git a/src/function/Custom.cpp b/src/function/Custom.cpp index 85e20a3579..cd86f6c33d 100644 --- a/src/function/Custom.cpp +++ b/src/function/Custom.cpp @@ -268,7 +268,7 @@ void Custom::registerKeywords(Keywords& keys) { keys.use("PERIODIC"); keys.add("compulsory","FUNC","the function you wish to evaluate"); keys.add("optional","VAR","the names to give each of the arguments in the function. If you have up to three arguments in your function you can use x, y and z to refer to them. Otherwise you must use this flag to give your variables names."); - keys.setValueDescription("an arbitrary function"); + keys.setValueDescription("scalar/vector/matrix/grid","an arbitrary function"); } void Custom::read( ActionWithArguments* action ) { diff --git a/src/function/Ensemble.cpp b/src/function/Ensemble.cpp index 137dc77ab8..1121f9d976 100644 --- a/src/function/Ensemble.cpp +++ b/src/function/Ensemble.cpp @@ -73,7 +73,6 @@ PLUMED_REGISTER_ACTION(Ensemble,"ENSEMBLE") void Ensemble::registerKeywords(Keywords& keys) { Function::registerKeywords(keys); - keys.use("ARG"); keys.addFlag("REWEIGHT",false,"simple REWEIGHT using the latest ARG as energy"); keys.addFlag("CENTRAL",false,"calculate a central moment instead of a standard moment"); keys.add("optional","TEMP","the system temperature - this is only needed if you are reweighting"); diff --git a/src/function/FuncPathGeneral.cpp b/src/function/FuncPathGeneral.cpp index 4df3422894..4dd0ada991 100644 --- a/src/function/FuncPathGeneral.cpp +++ b/src/function/FuncPathGeneral.cpp @@ -155,15 +155,14 @@ void FuncPathGeneral::loadReference() { void FuncPathGeneral::registerKeywords(Keywords& keys) { Function::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory", "LAMBDA", "Lambda parameter required for smoothing"); keys.add("compulsory", "COEFFICIENTS", "Coefficients to be assigned to the CVs"); keys.add("compulsory", "REFERENCE", "Colvar file needed to provide the CV milestones"); keys.add("optional", "COLUMNS", "List of columns in the reference colvar file specifying the CVs"); keys.add("optional", "NEIGH_SIZE", "Size of the neighbor list"); keys.add("optional", "NEIGH_STRIDE", "How often the neighbor list needs to be calculated in time units"); - keys.addOutputComponent("s", "default", "Position on the path"); - keys.addOutputComponent("z", "default", "Distance from the path"); + keys.addOutputComponent("s", "default", "scalar","Position on the path"); + keys.addOutputComponent("z", "default", "scalar","Distance from the path"); } FuncPathGeneral::FuncPathGeneral(const ActionOptions&ao): diff --git a/src/function/FuncPathMSD.cpp b/src/function/FuncPathMSD.cpp index 88f823afe3..5070c284f9 100644 --- a/src/function/FuncPathMSD.cpp +++ b/src/function/FuncPathMSD.cpp @@ -219,12 +219,11 @@ PLUMED_REGISTER_ACTION(FuncPathMSD,"FUNCPATHMSD") void FuncPathMSD::registerKeywords(Keywords& keys) { Function::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","LAMBDA","the lambda parameter is needed for smoothing, is in the units of plumed"); keys.add("optional","NEIGH_SIZE","size of the neighbor list"); keys.add("optional","NEIGH_STRIDE","how often the neighbor list needs to be calculated in time units"); - keys.addOutputComponent("s","default","the position on the path"); - keys.addOutputComponent("z","default","the distance from the path"); + keys.addOutputComponent("s","default","scalar","the position on the path"); + keys.addOutputComponent("z","default","scalar","the distance from the path"); } FuncPathMSD::FuncPathMSD(const ActionOptions&ao): Action(ao), diff --git a/src/function/FuncSumHills.cpp b/src/function/FuncSumHills.cpp index 65eef4238c..627063b717 100644 --- a/src/function/FuncSumHills.cpp +++ b/src/function/FuncSumHills.cpp @@ -200,7 +200,6 @@ PLUMED_REGISTER_ACTION(FuncSumHills,"FUNCSUMHILLS") void FuncSumHills::registerKeywords(Keywords& keys) { Function::registerKeywords(keys); - keys.use("ARG"); keys.add("optional","HILLSFILES"," source file for hills creation(may be the same as HILLS)"); // this can be a vector! keys.add("optional","HISTOFILES"," source file for histogram creation(may be the same as HILLS)"); // also this can be a vector! keys.add("optional","HISTOSIGMA"," sigmas for binning when the histogram correction is needed "); @@ -221,7 +220,7 @@ void FuncSumHills::registerKeywords(Keywords& keys) { keys.addFlag("NOHISTORY",false,"to be used with INITSTRIDE: it splits the bias/histogram in pieces without previous history "); keys.addFlag("MINTOZERO",false,"translate the resulting bias/histogram to have the minimum to zero "); keys.add("optional","FMT","the format that should be used to output real numbers"); - keys.setValueDescription("a scalar"); + keys.setValueDescription("scalar","a scalar"); } FuncSumHills::FuncSumHills(const ActionOptions&ao): diff --git a/src/function/Function.cpp b/src/function/Function.cpp index 053c4a9943..8ca01b585d 100644 --- a/src/function/Function.cpp +++ b/src/function/Function.cpp @@ -30,6 +30,7 @@ void Function::registerKeywords(Keywords& keys) { Action::registerKeywords(keys); ActionWithValue::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the values from which the function is calculated"); keys.reserve("compulsory","PERIODIC","if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO"); } diff --git a/src/function/FunctionOfMatrix.h b/src/function/FunctionOfMatrix.h index 067e83c4b8..048942acc1 100644 --- a/src/function/FunctionOfMatrix.h +++ b/src/function/FunctionOfMatrix.h @@ -75,19 +75,20 @@ class FunctionOfMatrix : public ActionWithMatrix { template void FunctionOfMatrix::registerKeywords(Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); std::string name = keys.getDisplayName(); + ActionWithMatrix::registerKeywords(keys); std::string name = keys.getDisplayName(); std::size_t und=name.find("_MATRIX"); keys.setDisplayName( name.substr(0,und) ); + keys.addInputKeyword("compulsory","ARG","scalar/matrix","the labels of the scalar and matrices that on which the function is being calculated elementwise"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); keys.reserve("compulsory","PERIODIC","if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO"); T tfunc; tfunc.registerKeywords( keys ); if( keys.getDisplayName()=="SUM" ) { - keys.setValueDescription("the sum of all the elements in the input matrix"); + keys.setValueDescription("scalar","the sum of all the elements in the input matrix"); } else if( keys.getDisplayName()=="HIGHEST" ) { - keys.setValueDescription("the largest element of the input matrix"); + keys.setValueDescription("scalar","the largest element of the input matrix"); } else if( keys.getDisplayName()=="LOWEST" ) { - keys.setValueDescription("the smallest element in the input matrix"); + keys.setValueDescription("scalar","the smallest element in the input matrix"); } else if( keys.outputComponentExists(".#!value") ) { - keys.setValueDescription("the matrix obtained by doing an element-wise application of " + keys.getOutputComponentDescription(".#!value") + " to the input matrix"); + keys.setValueDescription("matrix","the matrix obtained by doing an element-wise application of " + keys.getOutputComponentDescription(".#!value") + " to the input matrix"); } } diff --git a/src/function/FunctionOfScalar.h b/src/function/FunctionOfScalar.h index 00ab91197e..b9bef49d02 100644 --- a/src/function/FunctionOfScalar.h +++ b/src/function/FunctionOfScalar.h @@ -54,12 +54,13 @@ class FunctionOfScalar : public Function { template void FunctionOfScalar::registerKeywords(Keywords& keys) { - Function::registerKeywords(keys); keys.use("ARG"); std::string name = keys.getDisplayName(); + Function::registerKeywords(keys); std::string name = keys.getDisplayName(); std::size_t und=name.find("_SCALAR"); keys.setDisplayName( name.substr(0,und) ); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); T tfunc; tfunc.registerKeywords( keys ); - if( keys.getDisplayName()=="SUM" ) keys.setValueDescription("the sum of all the input arguments"); - else if( keys.getDisplayName()=="MEAN" ) keys.setValueDescription("the mean of all the input arguments"); + if( keys.getDisplayName()=="SUM" ) keys.setValueDescription("scalar","the sum of all the input arguments"); + else if( keys.getDisplayName()=="MEAN" ) keys.setValueDescription("scalar","the mean of all the input arguments"); + else if( keys.getDisplayName()=="EVALUATE_FUNCTION_FROM_GRID" ) keys.addInputKeyword("compulsory","ARG","scalar/grid",""); } template diff --git a/src/function/FunctionOfVector.h b/src/function/FunctionOfVector.h index bb962cf924..dafebfed4a 100644 --- a/src/function/FunctionOfVector.h +++ b/src/function/FunctionOfVector.h @@ -74,23 +74,24 @@ class FunctionOfVector : public ActionWithVector { template void FunctionOfVector::registerKeywords(Keywords& keys ) { - Action::registerKeywords(keys); ActionWithValue::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); keys.use("ARG"); + Action::registerKeywords(keys); ActionWithValue::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); std::string name = keys.getDisplayName(); std::size_t und=name.find("_VECTOR"); keys.setDisplayName( name.substr(0,und) ); + keys.addInputKeyword("compulsory","ARG","scalar/vector","the labels of the scalar and vector that on which the function is being calculated elementwise"); keys.reserve("compulsory","PERIODIC","if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); T tfunc; tfunc.registerKeywords( keys ); if( keys.getDisplayName()=="SUM" ) { - keys.setValueDescription("the sum of all the elements in the input vector"); + keys.setValueDescription("scalar","the sum of all the elements in the input vector"); } else if( keys.getDisplayName()=="MEAN" ) { - keys.setValueDescription("the mean of all the elements in the input vector"); + keys.setValueDescription("scalar","the mean of all the elements in the input vector"); } else if( keys.getDisplayName()=="HIGHEST" ) { - keys.setValueDescription("the largest element of the input vector"); + keys.setValueDescription("scalar/vector","the largest element of the input vector if one vector specified. If multiple vectors of the same size specified the largest elements of these vector computed elementwise."); } else if( keys.getDisplayName()=="LOWEST" ) { - keys.setValueDescription("the smallest element in the input vector"); + keys.setValueDescription("scalar/vector","the smallest element in the input vector if one vector specified. If multiple vectors of the same size specified the largest elements of these vector computed elementwise."); } else if( keys.getDisplayName()=="SORT" ) { - keys.setValueDescription("a vector that has been sorted into ascending order"); + keys.setValueDescription("vector","a vector that has been sorted into ascending order"); } else if( keys.outputComponentExists(".#!value") ) { - keys.setValueDescription("the vector obtained by doing an element-wise application of " + keys.getOutputComponentDescription(".#!value") + " to the input vectors"); + keys.setValueDescription("vector","the vector obtained by doing an element-wise application of " + keys.getOutputComponentDescription(".#!value") + " to the input vectors"); } } diff --git a/src/function/FunctionShortcut.h b/src/function/FunctionShortcut.h index 7a730dbddb..9dc006dbbf 100644 --- a/src/function/FunctionShortcut.h +++ b/src/function/FunctionShortcut.h @@ -46,10 +46,12 @@ class FunctionShortcut : public ActionShortcut { template void FunctionShortcut::registerKeywords(Keywords& keys ) { ActionShortcut::registerKeywords( keys ); - keys.add("numbered","ARG","the input to this function"); keys.reserve("compulsory","PERIODIC","if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO"); keys.addActionNameSuffix("_SCALAR"); keys.addActionNameSuffix("_VECTOR"); keys.addActionNameSuffix("_MATRIX"); keys.addActionNameSuffix("_GRID"); T tfunc; tfunc.registerKeywords( keys ); + if( keys.getDisplayName()=="SUM" || keys.getDisplayName()=="CUSTOM" || keys.getDisplayName()=="MATHEVAL" ) { + keys.addInputKeyword("compulsory","ARG","scalar/vector/matrix/grid","the values input to this function"); + } else keys.addInputKeyword("compulsory","ARG","scalar/vector/matrix","the values input to this function"); } template diff --git a/src/function/Highest.cpp b/src/function/Highest.cpp index c66ddfa6b7..00ce59ceff 100644 --- a/src/function/Highest.cpp +++ b/src/function/Highest.cpp @@ -104,8 +104,8 @@ PLUMED_REGISTER_ACTION(VectorHighest,"HIGHEST_VECTOR") PLUMED_REGISTER_ACTION(VectorHighest,"LOWEST_VECTOR") void Highest::registerKeywords( Keywords& keys ) { - if( keys.getDisplayName().find("LOWEST") ) keys.setValueDescription("the lowest of the input values"); - else keys.setValueDescription("the highest of the input values"); + if( keys.getDisplayName().find("LOWEST") ) keys.setValueDescription("scalar","the lowest of the input values"); + else keys.setValueDescription("scalar","the highest of the input values"); } void Highest::read( ActionWithArguments* action ) { diff --git a/src/function/LessThan.cpp b/src/function/LessThan.cpp index 780ae9a6e1..844cec1cbc 100644 --- a/src/function/LessThan.cpp +++ b/src/function/LessThan.cpp @@ -73,7 +73,7 @@ void LessThan::registerKeywords(Keywords& keys) { "The following provides information on the \\ref switchingfunction that are available. " "When this keyword is present you no longer need the NN, MM, D_0 and R_0 keywords."); keys.addFlag("SQUARED",false,"is the input quantity the square of the value that you would like to apply the switching function to"); - keys.setValueDescription("a function that is one if the input is less than a threshold"); + keys.setValueDescription("scalar/vector/matrix","a function that is one if the input is less than a threshold"); } void LessThan::read( ActionWithArguments* action ) { diff --git a/src/function/LocalEnsemble.cpp b/src/function/LocalEnsemble.cpp index f417f3fb8c..61a80a9794 100644 --- a/src/function/LocalEnsemble.cpp +++ b/src/function/LocalEnsemble.cpp @@ -90,7 +90,7 @@ PLUMED_REGISTER_ACTION(LocalEnsemble,"LOCALENSEMBLE") void LocalEnsemble::registerKeywords(Keywords& keys) { Function::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("numbered","ARG","scalar","the labels of the actions that you want to use"); keys.add("compulsory","NUM","the number of local replicas"); useCustomisableComponents(keys); } diff --git a/src/function/Moments.cpp b/src/function/Moments.cpp index cfd2ed3118..a7f5b7c787 100644 --- a/src/function/Moments.cpp +++ b/src/function/Moments.cpp @@ -83,7 +83,7 @@ void Moments::registerKeywords(Keywords& keys) { "The \\f$m\\f$th central moment of a distribution is calculated using \\f$\\frac{1}{N} \\sum_{i=1}^N ( s_i - \\overline{s} )^m \\f$, where \\f$\\overline{s}\\f$ is " "the average for the distribution. The POWERS keyword takes a lists of integers as input or a range. Each integer is a value of \\f$m\\f$. The final " "calculated values can be referenced using moment-\\f$m\\f$."); - keys.addOutputComponent("moment","default","the central moments of the distribution of values. The second central moment " + keys.addOutputComponent("moment","default","scalar","the central moments of the distribution of values. The second central moment " "would be referenced elsewhere in the input file using " "label.moment-2, the third as label.moment-3, etc."); } diff --git a/src/function/MoreThan.cpp b/src/function/MoreThan.cpp index f8ddb55324..30b088ce87 100644 --- a/src/function/MoreThan.cpp +++ b/src/function/MoreThan.cpp @@ -73,7 +73,7 @@ void MoreThan::registerKeywords(Keywords& keys) { "The following provides information on the \\ref switchingfunction that are available. " "When this keyword is present you no longer need the NN, MM, D_0 and R_0 keywords."); keys.addFlag("SQUARED",false,"is the input quantity the square of the value that you would like to apply the switching function to"); - keys.setValueDescription("a function that is one if the if the input is more than a threshold"); + keys.setValueDescription("scalar/vector/matrix","a function that is one if the if the input is more than a threshold"); } void MoreThan::read( ActionWithArguments* action ) { diff --git a/src/function/Piecewise.cpp b/src/function/Piecewise.cpp index 221bfb9243..4e833cd975 100644 --- a/src/function/Piecewise.cpp +++ b/src/function/Piecewise.cpp @@ -93,7 +93,7 @@ PLUMED_REGISTER_ACTION(ScalarPiecewise,"PIECEWISE_SCALAR") void Piecewise::registerKeywords(Keywords& keys) { keys.add("numbered","POINT","This keyword is used to specify the various points in the function above."); keys.reset_style("POINT","compulsory"); - keys.addOutputComponent("_pfunc","default","one or multiple instances of this quantity can be referenced elsewhere " + keys.addOutputComponent("_pfunc","default","scalar","one or multiple instances of this quantity can be referenced elsewhere " "in the input file. These quantities will be named with the arguments of the " "function followed by the character string _pfunc. These quantities tell the " "user the values of the piece wise functions of each of the arguments."); diff --git a/src/function/Product.cpp b/src/function/Product.cpp index 283fedb53b..935614bf78 100644 --- a/src/function/Product.cpp +++ b/src/function/Product.cpp @@ -45,7 +45,7 @@ PLUMED_REGISTER_ACTION(Product,"PRODUCT") void Product::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords(keys); keys.add("compulsory","ARG","The point that we are calculating the distance from"); - keys.setValueDescription("the product of all the elements in the input vector"); + keys.setValueDescription("scalar","the product of all the elements in the input vector"); keys.needsAction("CONCATENATE"); keys.needsAction("CUSTOM"); keys.needsAction("SUM"); } diff --git a/src/function/Sort.cpp b/src/function/Sort.cpp index ce2093f460..9613186676 100644 --- a/src/function/Sort.cpp +++ b/src/function/Sort.cpp @@ -93,7 +93,7 @@ typedef FunctionOfVector VectorSort; PLUMED_REGISTER_ACTION(VectorSort,"SORT_VECTOR") void Sort::registerKeywords(Keywords& keys) { - keys.setValueDescription("sorted"); + keys.setValueDescription("vector","sorted"); keys.setComponentsIntroduction("The names of the components in this action will be customized in accordance with the contents of the input file. " "The largest value is called label.1th, the second largest label.2th, the third label.3th and so on"); } diff --git a/src/function/Stats.cpp b/src/function/Stats.cpp index ae2f5c78b8..f3876c6aac 100644 --- a/src/function/Stats.cpp +++ b/src/function/Stats.cpp @@ -71,17 +71,16 @@ PLUMED_REGISTER_ACTION(Stats,"STATS") void Stats::registerKeywords(Keywords& keys) { Function::registerKeywords(keys); - keys.use("ARG"); - keys.add("optional","PARARG","the input for this action is the scalar output from one or more other actions without derivatives."); + keys.addInputKeyword("optional","PARARG","scalar","the input for this action is the scalar output from one or more other actions without derivatives."); keys.add("optional","PARAMETERS","the parameters of the arguments in your function"); keys.addFlag("SQDEVSUM",false,"calculates only SQDEVSUM"); keys.addFlag("SQDEV",false,"calculates and store the SQDEV as components"); keys.addFlag("UPPERDISTS",false,"calculates and store the SQDEV as components"); - keys.addOutputComponent("sqdevsum","default","the sum of the squared deviations between arguments and parameters"); - keys.addOutputComponent("corr","default","the correlation between arguments and parameters"); - keys.addOutputComponent("slope","default","the slope of a linear fit between arguments and parameters"); - keys.addOutputComponent("intercept","default","the intercept of a linear fit between arguments and parameters"); - keys.addOutputComponent("sqd","SQDEV","the squared deviations between arguments and parameters"); + keys.addOutputComponent("sqdevsum","default","scalar","the sum of the squared deviations between arguments and parameters"); + keys.addOutputComponent("corr","default","scalar","the correlation between arguments and parameters"); + keys.addOutputComponent("slope","default","scalar","the slope of a linear fit between arguments and parameters"); + keys.addOutputComponent("intercept","default","scalar","the intercept of a linear fit between arguments and parameters"); + keys.addOutputComponent("sqd","SQDEV","scalar","the squared deviations between arguments and parameters"); } Stats::Stats(const ActionOptions&ao): diff --git a/src/function/Sum.cpp b/src/function/Sum.cpp index fc2cc01e56..3db505117b 100644 --- a/src/function/Sum.cpp +++ b/src/function/Sum.cpp @@ -106,7 +106,7 @@ typedef FunctionOfMatrix MatrixSum; PLUMED_REGISTER_ACTION(MatrixSum,"SUM_MATRIX") void Sum::registerKeywords( Keywords& keys ) { - keys.use("PERIODIC"); keys.setValueDescription("the sum"); + keys.use("PERIODIC"); keys.setValueDescription("scalar","the sum"); } void Sum::read( ActionWithArguments* action ) { diff --git a/src/funnel/FPS.cpp b/src/funnel/FPS.cpp index 3ca828b7de..0b3dca9142 100644 --- a/src/funnel/FPS.cpp +++ b/src/funnel/FPS.cpp @@ -122,8 +122,8 @@ void FUNNEL_PS::registerKeywords(Keywords& keys) { keys.add("atoms","ANCHOR","Closest protein atom to the ligand, picked to avoid pbc problems during the simulation"); keys.add("compulsory","POINTS","6 values defining x, y, and z of the 2 points used to construct the line. The order should be A_x,A_y,A_z,B_x,B_y,B_z."); keys.addFlag("SQUARED-ROOT",false,"Used to initialize the creation of the alignment variable"); - keys.addOutputComponent("lp","default","the position along the funnel line"); - keys.addOutputComponent("ld","default","the distance from the funnel line"); + keys.addOutputComponent("lp","default","scalar","the position along the funnel line"); + keys.addOutputComponent("ld","default","scalar","the distance from the funnel line"); } FUNNEL_PS::FUNNEL_PS(const ActionOptions&ao): diff --git a/src/funnel/Funnel.cpp b/src/funnel/Funnel.cpp index 7a9c83b851..0f0594050c 100644 --- a/src/funnel/Funnel.cpp +++ b/src/funnel/Funnel.cpp @@ -144,7 +144,6 @@ PLUMED_REGISTER_ACTION(Funnel,"FUNNEL") void Funnel::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.addFlag("NOSPLINE",false,"specifies that no spline interpolation is to be used when calculating the energy and forces due to the external potential"); keys.addFlag("SPARSE",false,"specifies that the external potential uses a sparse grid"); keys.addFlag("SPHERE",false, "The Funnel potential including the binding site can be spherical instead of a cone"); diff --git a/src/generic/Accumulate.cpp b/src/generic/Accumulate.cpp index a6fd3bedb4..efa093db43 100644 --- a/src/generic/Accumulate.cpp +++ b/src/generic/Accumulate.cpp @@ -62,11 +62,12 @@ PLUMED_REGISTER_ACTION(Accumulate,"ACCUMULATE") void Accumulate::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); ActionPilot::registerKeywords( keys ); - keys.use("ARG"); keys.use("UPDATE_FROM"); keys.use("UPDATE_UNTIL"); + keys.use("UPDATE_FROM"); keys.use("UPDATE_UNTIL"); + keys.addInputKeyword("compulsory","ARG","scalar/grid","the label of the argument that is being added to on each timestep"); keys.add("compulsory","STRIDE","1","the frequency with which the data should be collected and added to the quantity being averaged"); keys.add("compulsory","CLEAR","0","the frequency with which to clear all the accumulated data. The default value " "of 0 implies that all the data will be used and that the grid will never be cleared"); - keys.setValueDescription("a sum calculated from the time series of the input quantity"); + keys.setValueDescription("scalar/grid","a sum calculated from the time series of the input quantity"); } Accumulate::Accumulate( const ActionOptions& ao ): diff --git a/src/generic/Average.cpp b/src/generic/Average.cpp index 8163b3dcee..9fa22b7016 100644 --- a/src/generic/Average.cpp +++ b/src/generic/Average.cpp @@ -100,12 +100,12 @@ PLUMED_REGISTER_ACTION(Average,"AVERAGE") void Average::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); - keys.add("compulsory","ARG","the quantity that is being averaged"); + keys.addInputKeyword("compulsory","ARG","scalar/grid","the quantity that is being averaged"); keys.add("optional","LOGWEIGHTS","the logarithm of the quantity to use as the weights when calculating averages"); keys.add("compulsory","STRIDE","1","the frequency with which to store data for averaging"); keys.add("compulsory","CLEAR","0","the frequency with whihc to clear the data that is being averaged"); keys.add("optional","NORMALIZATION","keyword for old version of the code that is there to maintain back compatibility only. Adding this keyword does nothing"); - keys.setValueDescription("the value of the average"); + keys.setValueDescription("scalar/grid","the value of the average"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); keys.needsAction("ONES"); keys.needsAction("ACCUMULATE"); } diff --git a/src/generic/Collect.cpp b/src/generic/Collect.cpp index fe44c0344f..5e7221e5a9 100644 --- a/src/generic/Collect.cpp +++ b/src/generic/Collect.cpp @@ -62,12 +62,13 @@ PLUMED_REGISTER_ACTION(Collect,"COLLECT") void Collect::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); ActionPilot::registerKeywords( keys ); - keys.use("ARG"); keys.use("UPDATE_FROM"); keys.use("UPDATE_UNTIL"); + keys.use("UPDATE_FROM"); keys.use("UPDATE_UNTIL"); + keys.addInputKeyword("compulsory","ARG","scalar/vector/matrix","the label of the value whose time series is being stored for later analysis"); keys.add("compulsory","STRIDE","1","the frequency with which the data should be collected and added to the quantity being averaged"); keys.add("compulsory","CLEAR","0","the frequency with which to clear all the accumulated data. The default value " "of 0 implies that all the data will be used and that the grid will never be cleared"); keys.add("compulsory","TYPE","auto","required if you are collecting an object with rank>0. Should be vector/matrix and determines how data is stored. If rank==0 then data has to be stored as a vector"); - keys.setValueDescription("the time series for the input quantity"); + keys.setValueDescription("vector/matrix","the time series for the input quantity"); } Collect::Collect( const ActionOptions& ao ): diff --git a/src/generic/Committor.cpp b/src/generic/Committor.cpp index 20ed416c21..6944f57ec8 100644 --- a/src/generic/Committor.cpp +++ b/src/generic/Committor.cpp @@ -80,7 +80,7 @@ void Committor::registerKeywords( Keywords& keys ) { Action::registerKeywords(keys); ActionPilot::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the values which is being used to define the committor surface"); keys.add("numbered", "BASIN_LL","List of lower limits for basin #"); keys.add("numbered", "BASIN_UL","List of upper limits for basin #"); keys.reset_style("BASIN_LL","compulsory"); keys.reset_style("BASIN_UL","compulsory"); diff --git a/src/generic/Constant.cpp b/src/generic/Constant.cpp index fd1e39759f..556fe3b7e1 100644 --- a/src/generic/Constant.cpp +++ b/src/generic/Constant.cpp @@ -78,8 +78,8 @@ void Constant::registerKeywords( Keywords& keys ) { keys.add("optional","VALUES","the numbers that are in your constant value"); keys.addFlag("SCALARS",false,"treat the input list of numbers as a set of scalars"); keys.addFlag("NOLOG",false,"do not report all the read in scalars in the log"); - keys.addOutputComponent("v","SCALARS","the # value"); - keys.setValueDescription("the constant value that was read from the plumed input"); + keys.addOutputComponent("v","SCALARS","scalar","the # value"); + keys.setValueDescription("scalar/vector/matrix","the constant value that was read from the plumed input"); } Constant::Constant(const ActionOptions&ao): diff --git a/src/generic/CreateMask.cpp b/src/generic/CreateMask.cpp index 4177567ff3..ae5bcdd919 100644 --- a/src/generic/CreateMask.cpp +++ b/src/generic/CreateMask.cpp @@ -56,11 +56,12 @@ PLUMED_REGISTER_ACTION(CreateMask,"CREATE_MASK") void CreateMask::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","vector","the label of the vector that you would like to construct a mask for"); keys.add("compulsory","TYPE","the way the zeros are supposed to be set"); keys.add("compulsory","NZEROS","the number of zeros that you want to put in the mask"); keys.add("optional","SEED","the seed to use for the random number generator"); - keys.setValueDescription("a vector of zeros and ones that is used that can be used to mask some of the elements in a time series"); + keys.setValueDescription("vector","a vector of zeros and ones that is used that can be used to mask some of the elements in a time series"); } diff --git a/src/generic/DumpAtoms.cpp b/src/generic/DumpAtoms.cpp index 3db26f4a9f..2ee63cd5ba 100644 --- a/src/generic/DumpAtoms.cpp +++ b/src/generic/DumpAtoms.cpp @@ -152,7 +152,8 @@ void DumpAtoms::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionPilot::registerKeywords( keys ); ActionAtomistic::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("optional","ARG","vector","the labels of vectors that should be output in the xyz file. The number of elements in the vector should equal the number of atoms output"); keys.add("compulsory","STRIDE","1","the frequency with which the atoms should be output"); keys.add("atoms", "ATOMS", "the atom indices whose positions you would like to print out"); keys.add("compulsory", "FILE", "file on which to output coordinates; extension is automatically detected"); diff --git a/src/generic/DumpDerivatives.cpp b/src/generic/DumpDerivatives.cpp index e359bcf057..ddd91e9277 100644 --- a/src/generic/DumpDerivatives.cpp +++ b/src/generic/DumpDerivatives.cpp @@ -74,7 +74,7 @@ void DumpDerivatives::registerKeywords(Keywords& keys) { Action::registerKeywords(keys); ActionPilot::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the values whose derivatives should be output"); keys.add("compulsory","STRIDE","1","the frequency with which the derivatives should be output"); keys.add("compulsory","FILE","the name of the file on which to output the derivatives"); keys.add("compulsory","FMT","%15.10f","the format with which the derivatives should be output"); diff --git a/src/generic/DumpForces.cpp b/src/generic/DumpForces.cpp index 8fc1411f63..36c562dace 100644 --- a/src/generic/DumpForces.cpp +++ b/src/generic/DumpForces.cpp @@ -72,7 +72,7 @@ void DumpForces::registerKeywords(Keywords& keys) { Action::registerKeywords(keys); ActionPilot::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the values whose forces should be output"); keys.add("compulsory","STRIDE","1","the frequency with which the forces should be output"); keys.add("compulsory","FILE","the name of the file on which to output the forces"); keys.add("compulsory","FMT","%15.10f","the format with which the derivatives should be output"); diff --git a/src/generic/DumpPDB.cpp b/src/generic/DumpPDB.cpp index 7ab771d0ee..714b43aca1 100644 --- a/src/generic/DumpPDB.cpp +++ b/src/generic/DumpPDB.cpp @@ -67,7 +67,8 @@ PLUMED_REGISTER_ACTION(DumpPDB,"DUMPPDB") void DumpPDB::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionPilot::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("optional","ARG","vector/matrix","the values that are being output in the PDB file"); keys.add("optional","ATOMS","value containing positions of atoms that should be output"); keys.add("compulsory","STRIDE","0","the frequency with which the atoms should be output"); keys.add("compulsory","FILE","the name of the file on which to output these quantities"); diff --git a/src/generic/DumpProjections.cpp b/src/generic/DumpProjections.cpp index 87d02d7a18..d3a139fef9 100644 --- a/src/generic/DumpProjections.cpp +++ b/src/generic/DumpProjections.cpp @@ -70,7 +70,7 @@ void DumpProjections::registerKeywords(Keywords& keys) { Action::registerKeywords(keys); ActionPilot::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the values whose gradients should be outpu"); keys.add("compulsory","STRIDE","1","the frequency with which the derivatives should be output"); keys.add("compulsory","FILE","the name of the file on which to output the derivatives"); keys.add("compulsory","FMT","%15.10f","the format with which the derivatives should be output"); diff --git a/src/generic/DumpVector.cpp b/src/generic/DumpVector.cpp index 51f3b7a963..8985d09211 100644 --- a/src/generic/DumpVector.cpp +++ b/src/generic/DumpVector.cpp @@ -61,7 +61,8 @@ PLUMED_REGISTER_ACTION(DumpVector,"DUMPVECTOR") void DumpVector::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionPilot::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","vector/matrix","the labels of vectors/matrices that should be output in the file"); keys.add("compulsory","STRIDE","0","the frequency with which the grid should be output to the file."); keys.add("compulsory","FILE","density","the file on which to write the vetors"); keys.add("optional","FMT","the format that should be used to output real numbers"); diff --git a/src/generic/FitToTemplate.cpp b/src/generic/FitToTemplate.cpp index 6fae4e6998..36b22e7eed 100644 --- a/src/generic/FitToTemplate.cpp +++ b/src/generic/FitToTemplate.cpp @@ -209,6 +209,7 @@ void FitToTemplate::registerKeywords( Keywords& keys ) { keys.add("compulsory","REFERENCE","a file in pdb format containing the reference structure and the atoms involved in the CV."); keys.add("compulsory","TYPE","SIMPLE","the manner in which RMSD alignment is performed. Should be OPTIMAL or SIMPLE."); keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances"); + keys.setValueDescription("scalar","the RMSD distance"); } FitToTemplate::FitToTemplate(const ActionOptions&ao): diff --git a/src/generic/GatherReplicas.cpp b/src/generic/GatherReplicas.cpp index eaa0fe7de9..6575312f8f 100644 --- a/src/generic/GatherReplicas.cpp +++ b/src/generic/GatherReplicas.cpp @@ -54,8 +54,8 @@ PLUMED_REGISTER_ACTION(GatherReplicas,"GATHER_REPLICAS") void GatherReplicas::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); - keys.remove("ARG"); keys.add("compulsory","ARG","the argument from the various replicas that you would like to gather"); - keys.addOutputComponent("rep","default","the input arguments for each of the replicas"); + keys.addInputKeyword("compulsory","ARG","scalar/vector/matrix/grid","the argument from the various replicas that you would like to gather"); + keys.addOutputComponent("rep","default","scalar/vector/matrix/grid","the input arguments for each of the replicas"); } GatherReplicas::GatherReplicas( const ActionOptions& ao ): diff --git a/src/generic/MassChargeInput.cpp b/src/generic/MassChargeInput.cpp index 986f7533ed..6c788eb0ed 100644 --- a/src/generic/MassChargeInput.cpp +++ b/src/generic/MassChargeInput.cpp @@ -53,8 +53,8 @@ void MassChargeInput::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); keys.add("optional","FILE","input file that contains the masses and charges that should be used"); keys.add("compulsory","PDBFILE","a pdb file that contains the masses and charges of the atoms in the beta and occupancy columns"); - keys.addOutputComponent("mass","default","the masses of the atoms in the system"); - keys.addOutputComponent("charges","default","the masses of the atoms in the system"); + keys.addOutputComponent("mass","default","vector","the masses of the atoms in the system"); + keys.addOutputComponent("charges","default","vector","the masses of the atoms in the system"); keys.needsAction("CONSTANT"); } diff --git a/src/generic/Ones.cpp b/src/generic/Ones.cpp index c27c3b96ef..026d5e1fa4 100644 --- a/src/generic/Ones.cpp +++ b/src/generic/Ones.cpp @@ -45,7 +45,7 @@ PLUMED_REGISTER_ACTION(Ones,"ONES") void Ones::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); keys.add("compulsory","SIZE","the number of ones that you would like to create"); - keys.setValueDescription("a vector of ones with the required number of elements"); + keys.setValueDescription("scalar/vector","a vector of ones with the required number of elements"); keys.needsAction("CONSTANT"); } diff --git a/src/generic/PDB2Constant.cpp b/src/generic/PDB2Constant.cpp index 1d80a1014b..fd58a312b6 100644 --- a/src/generic/PDB2Constant.cpp +++ b/src/generic/PDB2Constant.cpp @@ -50,8 +50,8 @@ void PDB2Constant::registerKeywords(Keywords& keys) { keys.add("compulsory","REFERENCE","a file in pdb format containing the reference structure"); keys.add("compulsory","NUMBER","0","if there are multiple structures in the pdb file you can specify that you want the RMSD from a specific structure by specifying its place in the file here. If NUMBER=0 then the RMSD from all structures are computed"); keys.addFlag("NOARGS",false,"the arguments that are being read from the PDB file are not in the plumed input"); - keys.add("optional","ARG","read this single argument from the input rather than the atomic structure"); - keys.setValueDescription("a value that is constructed from the information in the PDB file"); + keys.addInputKeyword("optional","ARG","scalar/vector","read this single argument from the input rather than the atomic structure"); + keys.setValueDescription("scalar/vector/matrix","a value that is constructed from the information in the PDB file"); keys.needsAction("CONSTANT"); } diff --git a/src/generic/Plumed.cpp b/src/generic/Plumed.cpp index 3972d5b1e6..6eb5a63838 100644 --- a/src/generic/Plumed.cpp +++ b/src/generic/Plumed.cpp @@ -183,7 +183,7 @@ void Plumed::registerKeywords( Keywords& keys ) { keys.add("optional","LOG","log file for the guest PLUMED instance. By default the host log is used"); keys.add("optional","CHDIR","run guest in a separate directory"); keys.addFlag("NOREPLICAS",false,"run multiple replicas as isolated ones, without letting them know that the host has multiple replicas"); - keys.addOutputComponent("bias","default","the instantaneous value of the bias potential"); + keys.addOutputComponent("bias","default","scalar","the instantaneous value of the bias potential"); } Plumed::Plumed(const ActionOptions&ao): diff --git a/src/generic/Print.cpp b/src/generic/Print.cpp index 4f3ca3bfdf..603c633bdc 100644 --- a/src/generic/Print.cpp +++ b/src/generic/Print.cpp @@ -99,7 +99,7 @@ void Print::registerKeywords(Keywords& keys) { Action::registerKeywords(keys); ActionPilot::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("compulsory","ARG","scalar/vector/matrix","the labels of the values that you would like to print to the file"); keys.add("compulsory","STRIDE","1","the frequency with which the quantities of interest should be output"); keys.add("optional","FILE","the name of the file on which to output these quantities"); keys.add("optional","FMT","the format that should be used to output real numbers"); diff --git a/src/generic/PrintNDX.cpp b/src/generic/PrintNDX.cpp index afe4a25116..ce2d533fe5 100644 --- a/src/generic/PrintNDX.cpp +++ b/src/generic/PrintNDX.cpp @@ -66,7 +66,7 @@ void PrintNDX::registerKeywords(Keywords& keys) { ActionPilot::registerKeywords(keys); ActionAtomistic::registerKeywords( keys ); ActionWithArguments::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("optional","ARG","vector","the labels of vectors that should be used when printind the NDX file"); keys.add("atoms","ATOMS","the list of atoms that have the corresponding arguments"); keys.add("compulsory","STRIDE","1","the frequency with which the quantities of interest should be output"); keys.add("optional","FILE","the name of the file on which to output these quantities"); diff --git a/src/generic/Time.cpp b/src/generic/Time.cpp index 804074e93c..9f632a64e6 100644 --- a/src/generic/Time.cpp +++ b/src/generic/Time.cpp @@ -56,7 +56,7 @@ PLUMED_REGISTER_ACTION(Time,"TIME") void Time::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); - keys.setValueDescription("the time since the start of the trajectory"); + keys.setValueDescription("scalar","the time since the start of the trajectory"); } Time::Time(const ActionOptions&ao): diff --git a/src/generic/UpdateIf.cpp b/src/generic/UpdateIf.cpp index a7abb36d04..331e572364 100644 --- a/src/generic/UpdateIf.cpp +++ b/src/generic/UpdateIf.cpp @@ -100,7 +100,7 @@ void UpdateIf::registerKeywords(Keywords& keys) { Action::registerKeywords(keys); ActionPilot::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of values that should be used to make the decision on whether to update or not"); keys.add("compulsory","STRIDE","1","the frequency with which the quantities of interest should be output"); keys.addFlag("END",false,"end"); keys.add("optional","LESS_THAN","upper bound"); diff --git a/src/gridtools/ConvertToFES.cpp b/src/gridtools/ConvertToFES.cpp index f2b18bdabd..ae89db87ef 100644 --- a/src/gridtools/ConvertToFES.cpp +++ b/src/gridtools/ConvertToFES.cpp @@ -72,7 +72,7 @@ void ConvertToFES::registerKeywords( Keywords& keys ) { keys.add("compulsory","ARG","the histogram that you would like to convert into a free energy surface"); keys.add("optional","TEMP","the temperature at which you are operating"); keys.addFlag("MINTOZERO",false,"set the minimum in the free energy to be equal to zero"); - keys.setValueDescription("the free energy surface"); + keys.setValueDescription("grid","the free energy surface"); keys.needsAction("FIND_GRID_MINIMUM"); keys.needsAction("CUSTOM"); } diff --git a/src/gridtools/DumpGrid.cpp b/src/gridtools/DumpGrid.cpp index d6eedd3277..791150e4be 100644 --- a/src/gridtools/DumpGrid.cpp +++ b/src/gridtools/DumpGrid.cpp @@ -198,7 +198,8 @@ PLUMED_REGISTER_ACTION(DumpGrid,"DUMPGRID") void DumpGrid::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionPilot::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","grid","the label for the grid that you would like to output"); keys.add("optional","GRID","the grid you would like to print (can also use ARG for specifying what is being printed)"); keys.add("compulsory","STRIDE","0","the frequency with which the grid should be output to the file. Default of zero means dump at end of calculation"); keys.add("compulsory","FILE","density","the file on which to write the grid."); diff --git a/src/gridtools/EvaluateFunctionOnGrid.cpp b/src/gridtools/EvaluateFunctionOnGrid.cpp index 9add313e8f..aaf0b29a76 100644 --- a/src/gridtools/EvaluateFunctionOnGrid.cpp +++ b/src/gridtools/EvaluateFunctionOnGrid.cpp @@ -71,8 +71,8 @@ PLUMED_REGISTER_ACTION(VectorEvalGrid,"EVALUATE_FUNCTION_FROM_GRID_VECTOR") void EvaluateFunctionOnGrid::registerKeywords(Keywords& keys ) { ActionShortcut::registerKeywords( keys ); - keys.add("compulsory","GRID","the name of the grid that we are using to evaluate the function"); - keys.add("optional","ARG","the arguments that you would like to use when evaluating the function. If not specified these are determined from the names of the grid dimensions"); + keys.addInputKeyword("compulsory","GRID","grid","the name of the grid that we are using to evaluate the function"); + keys.addInputKeyword("optional","ARG","scalar/vector","the arguments that you would like to use when evaluating the function. If not specified these are determined from the names of the grid dimensions"); keys.reserve("compulsory","PERIODIC","if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO"); EvaluateGridFunction ii; ii.registerKeywords( keys ); keys.addActionNameSuffix("_SCALAR"); keys.addActionNameSuffix("_VECTOR"); diff --git a/src/gridtools/EvaluateGridFunction.cpp b/src/gridtools/EvaluateGridFunction.cpp index 47d0490bb4..729cf1ff28 100644 --- a/src/gridtools/EvaluateGridFunction.cpp +++ b/src/gridtools/EvaluateGridFunction.cpp @@ -30,7 +30,7 @@ namespace gridtools { void EvaluateGridFunction::registerKeywords( Keywords& keys ) { keys.add("compulsory","INTERPOLATION_TYPE","spline","the method to use for interpolation. Can be spline, linear, ceiling or floor."); keys.addFlag("ZERO_OUTSIDE_GRID_RANGE",false,"if we are asked to evaluate the function for a number that is outside the range of the grid set it to zero"); - keys.setValueDescription("interpolation of the input grid to get the value of the function at the input arguments"); + keys.setValueDescription("scalar","interpolation of the input grid to get the value of the function at the input arguments"); } std::vector EvaluateGridFunction::getPbc() const { diff --git a/src/gridtools/FindGridOptimum.cpp b/src/gridtools/FindGridOptimum.cpp index 516822e4d3..a2d946a40b 100644 --- a/src/gridtools/FindGridOptimum.cpp +++ b/src/gridtools/FindGridOptimum.cpp @@ -67,11 +67,12 @@ PLUMED_REGISTER_ACTION(FindGridOptimum,"FIND_GRID_MAXIMUM") PLUMED_REGISTER_ACTION(FindGridOptimum,"FIND_GRID_MINIMUM") void FindGridOptimum::registerKeywords( Keywords& keys ) { - ActionWithGrid::registerKeywords( keys ); keys.use("ARG"); + ActionWithGrid::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","grid","the label for the function on the grid that you would like to find the optimum in"); keys.addFlag("NOINTERPOL",false,"do not interpolate the function when finding the optimum"); keys.add("compulsory","CGTOL","1E-4","the tolerance for the conjugate gradient optimization"); - keys.addOutputComponent("optval","default","the value of the function at the optimum"); - keys.addOutputComponent("_opt","default","the values of the arguments of the function at the optimum can be referenced elsewhere in the input file " + keys.addOutputComponent("optval","default","scalar","the value of the function at the optimum"); + keys.addOutputComponent("_opt","default","scalar","the values of the arguments of the function at the optimum can be referenced elsewhere in the input file " "by using the names of the arguments followed by the string _opt"); } diff --git a/src/gridtools/FunctionOfGrid.h b/src/gridtools/FunctionOfGrid.h index aec8cae75d..efa417408c 100644 --- a/src/gridtools/FunctionOfGrid.h +++ b/src/gridtools/FunctionOfGrid.h @@ -58,14 +58,19 @@ class FunctionOfGrid : public ActionWithGrid { template void FunctionOfGrid::registerKeywords(Keywords& keys ) { - ActionWithGrid::registerKeywords(keys); keys.use("ARG"); std::string name = keys.getDisplayName(); + ActionWithGrid::registerKeywords(keys); std::string name = keys.getDisplayName(); std::size_t und=name.find("_GRID"); keys.setDisplayName( name.substr(0,und) ); keys.reserve("compulsory","PERIODIC","if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO"); T tfunc; tfunc.registerKeywords( keys ); if( typeid(tfunc)==typeid(function::Custom()) ) keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); if( keys.getDisplayName()=="INTEGRATE") { - keys.setValueDescription("the numerical integral of the input function over its whole domain"); + keys.setValueDescription("scalar","the numerical integral of the input function over its whole domain"); + keys.addInputKeyword("compulsory","ARG","grid","the label of the function on a grid that is being integrated"); + } else if( keys.getDisplayName()=="SUM") { + keys.setValueDescription("scalar","the sum of the value of the function over all the grid points where it has been evaluated"); + keys.addInputKeyword("compulsory","ARG","grid","the label of the function on a grid from which we are computing a sum"); } else if( keys.outputComponentExists(".#!value") ) { - keys.setValueDescription("the grid obtained by doing an element-wise application of " + keys.getOutputComponentDescription(".#!value") + " to the input grid"); + keys.setValueDescription("grid","the grid obtained by doing an element-wise application of " + keys.getOutputComponentDescription(".#!value") + " to the input grid"); + keys.addInputKeyword("compulsory","ARG","scalar/grid","the labels of the scalars and functions on a grid that we are using to compute the required function"); } } diff --git a/src/gridtools/Gradient.cpp b/src/gridtools/Gradient.cpp index 051a3bb1b8..b0a9d229dd 100644 --- a/src/gridtools/Gradient.cpp +++ b/src/gridtools/Gradient.cpp @@ -50,7 +50,7 @@ void Gradient::registerKeywords( Keywords& keys ) { keys.add("compulsory","SIGMA","the width of the function to be used for kernel density estimation"); keys.add("compulsory","KERNEL","gaussian-bin","the type of kernel function to be used in the grids"); keys.add("compulsory","ATOMS","calculate the gradient of these atoms"); - keys.setValueDescription("the desired gradient"); + keys.setValueDescription("scalar","the desired gradient"); keys.needsAction("DISTANCES"); keys.needsAction("KDE"); keys.needsAction("INTERPOLATE_GRID"); keys.needsAction("CUSTOM"); keys.needsAction("SUM_GRID"); keys.needsAction("COMBINE"); } diff --git a/src/gridtools/Histogram.cpp b/src/gridtools/Histogram.cpp index e7db8defab..b8b1d15a4f 100644 --- a/src/gridtools/Histogram.cpp +++ b/src/gridtools/Histogram.cpp @@ -204,7 +204,7 @@ PLUMED_REGISTER_ACTION(Histogram,"HISTOGRAM") void Histogram::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); keys.use("UPDATE_FROM"); keys.use("UPDATE_UNTIL"); keys.add("compulsory","NORMALIZATION","ndata","This controls how the data is normalized it can be set equal to true, false or ndata. See above for an explanation"); - keys.add("optional","ARG","the quantity that is being averaged"); + keys.addInputKeyword("optional","ARG","scalar/vector/matrix","the quantities that are being used to construct the histogram"); keys.add("optional","DATA","an alternative to the ARG keyword"); keys.add("compulsory","GRID_MIN","auto","the lower bounds for the grid"); keys.add("compulsory","GRID_MAX","auto","the upper bounds for the grid"); @@ -216,7 +216,7 @@ void Histogram::registerKeywords( Keywords& keys ) { keys.add("optional","LOGWEIGHTS","the logarithm of the quantity to use as the weights when calculating averages"); keys.add("compulsory","STRIDE","1","the frequency with which to store data for averaging"); keys.add("compulsory","CLEAR","0","the frequency with whihc to clear the data that is being averaged"); - keys.setValueDescription("the estimate of the histogram as a function of the argument that was obtained"); + keys.setValueDescription("grid","the estimate of the histogram as a function of the argument that was obtained"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); keys.needsAction("ONES"); keys.needsAction("KDE"); keys.needsAction("ACCUMULATE"); } diff --git a/src/gridtools/InterpolateGrid.cpp b/src/gridtools/InterpolateGrid.cpp index e667494c62..603da9c138 100644 --- a/src/gridtools/InterpolateGrid.cpp +++ b/src/gridtools/InterpolateGrid.cpp @@ -75,10 +75,12 @@ PLUMED_REGISTER_ACTION(InterpolateGrid,"INTERPOLATE_GRID") void InterpolateGrid::registerKeywords( Keywords& keys ) { ActionWithGrid::registerKeywords( keys ); - keys.add("optional","GRID_BIN","the number of bins for the grid"); keys.use("ARG"); + keys.add("optional","GRID_BIN","the number of bins for the grid"); + keys.addInputKeyword("compulsory","ARG","grid","the label for function on the grid that you would like to interpolate"); keys.add("optional","GRID_SPACING","the approximate grid spacing (to be used as an alternative or together with GRID_BIN)"); keys.addFlag("MIDPOINTS",false,"interpolate the values of the function at the midpoints of the grid coordinates of the input grid"); EvaluateGridFunction ii; ii.registerKeywords( keys ); + keys.setValueDescription("grid","the function evaluated onto the interpolated grid"); } InterpolateGrid::InterpolateGrid(const ActionOptions&ao): diff --git a/src/gridtools/KDE.cpp b/src/gridtools/KDE.cpp index 5303d4f2f5..90d499275d 100644 --- a/src/gridtools/KDE.cpp +++ b/src/gridtools/KDE.cpp @@ -94,7 +94,8 @@ PLUMED_REGISTER_ACTION(KDE,"KDE") PLUMED_REGISTER_ACTION(KDE,"SPHERICAL_KDE") void KDE::registerKeywords( Keywords& keys ) { - ActionWithGrid::registerKeywords( keys ); keys.use("ARG"); + ActionWithGrid::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","scalar/vector/matrix","the label for the value that should be used to construct the histogram"); keys.add("optional","HEIGHTS","this keyword takes the label of an action that calculates a vector of values. The elements of this vector " "are used as weights for the Gaussians."); keys.add("optional","VOLUMES","this keyword take the label of an action that calculates a vector of values. The elements of this vector " @@ -112,7 +113,7 @@ void KDE::registerKeywords( Keywords& keys ) { keys.add("optional","GRID_SPACING","the approximate grid spacing (to be used as an alternative or together with GRID_BIN)"); // Keywords for spherical KDE keys.add("compulsory","CONCENTRATION","the concentration parameter for Von Mises-Fisher distributions (only required for SPHERICAL_KDE)"); - keys.setValueDescription("a function on a grid that was obtained by doing a Kernel Density Estimation using the input arguments"); + keys.setValueDescription("grid","a function on a grid that was obtained by doing a Kernel Density Estimation using the input arguments"); } KDE::KDE(const ActionOptions&ao): diff --git a/src/gridtools/KLEntropy.cpp b/src/gridtools/KLEntropy.cpp index e41845373d..bea094cf68 100644 --- a/src/gridtools/KLEntropy.cpp +++ b/src/gridtools/KLEntropy.cpp @@ -48,7 +48,7 @@ void KLEntropy::registerKeywords( Keywords& keys ) { keys.add("compulsory","ARG","the grid that you wish to use in the KL entropy calculation"); keys.add("compulsory","REFERENCE","a file containing the reference density in grid format"); keys.add("compulsory","VALUE","the name of the value that should be read from the grid"); - keys.setValueDescription("the value of the KL-Entropy"); + keys.setValueDescription("scalar","the value of the KL-Entropy"); keys.needsAction("REFERENCE_GRID"); keys.needsAction("CUSTOM"); keys.needsAction("INTEGRATE_GRID"); } diff --git a/src/gridtools/MultiColvarDensity.cpp b/src/gridtools/MultiColvarDensity.cpp index c3104903fd..f9fcfff348 100644 --- a/src/gridtools/MultiColvarDensity.cpp +++ b/src/gridtools/MultiColvarDensity.cpp @@ -100,7 +100,7 @@ void MultiColvarDensity::registerKeywords( Keywords& keys ) { keys.add("optional","ATOMS","if you are calculating a atomic density you use this keyword to specify the atoms that are involved"); keys.addFlag("UNORMALIZED",false,"do not divide by the density"); keys.add("optional","NORMALIZATION","set true/false to determine how to the data is normalised"); - keys.setValueDescription("the average value of the order parameters at each point on the grid"); + keys.setValueDescription("grid","the average value of the order parameters at each point on the grid"); keys.needsAction("DISTANCES"); keys.needsAction("KDE"); keys.needsAction("ACCUMULATE"); keys.needsAction("CUSTOM"); keys.needsAction("ONES"); keys.needsAction("CUSTOM"); } diff --git a/src/gridtools/PairEntropies.cpp b/src/gridtools/PairEntropies.cpp index 59db395548..33b8ca541d 100644 --- a/src/gridtools/PairEntropies.cpp +++ b/src/gridtools/PairEntropies.cpp @@ -46,7 +46,7 @@ PLUMED_REGISTER_ACTION(PairEntropies,"PAIRENTROPIES") void PairEntropies::registerKeywords( Keywords& keys ) { RDF::registerKeywords( keys ); keys.remove("GROUP"); keys.remove("GROUPA"); keys.remove("GROUPB"); keys.add("atoms","ATOMS","the atoms that you would like to compute the entropies for"); - keys.setValueDescription("the a vector containing the KL-entropy that is computed from the radial distribution function around each of the atoms in the input"); + keys.setValueDescription("vector","the a vector containing the KL-entropy that is computed from the radial distribution function around each of the atoms in the input"); keys.needsAction("PAIRENTROPY"); keys.needsAction("INTERPOLATE_GRID"); keys.needsAction("INTEGRATE_GRID"); keys.needsAction("CUSTOM"); keys.needsAction("CONCATENATE"); diff --git a/src/gridtools/PairEntropy.cpp b/src/gridtools/PairEntropy.cpp index 26ad720034..896238efc5 100644 --- a/src/gridtools/PairEntropy.cpp +++ b/src/gridtools/PairEntropy.cpp @@ -45,7 +45,7 @@ PLUMED_REGISTER_ACTION(PairEntropy,"PAIRENTROPY") void PairEntropy::registerKeywords( Keywords& keys ) { RDF::registerKeywords( keys ); keys.needsAction("RDF"); - keys.setValueDescription("the KL-entropy that is computed from the radial distribution function"); + keys.setValueDescription("scalar","the KL-entropy that is computed from the radial distribution function"); keys.needsAction("INTERPOLATE_GRID"); keys.needsAction("INTEGRATE_GRID"); } diff --git a/src/gridtools/RDF.cpp b/src/gridtools/RDF.cpp index 1716d5cd14..251e882ed3 100644 --- a/src/gridtools/RDF.cpp +++ b/src/gridtools/RDF.cpp @@ -57,7 +57,7 @@ void RDF::registerKeywords( Keywords& keys ) { keys.add("compulsory","STRIDE","1","the frequency with which to compute the rdf and accumulate averages"); keys.add("optional","DENSITY","the reference density to use when normalizing the RDF"); keys.add("hidden","REFERENCE","this is the label of the reference objects"); - keys.setValueDescription("the radial distribution function"); + keys.setValueDescription("grid","the radial distribution function"); keys.needsAction("REFERENCE_GRID"); keys.needsAction("VOLUME"); keys.needsAction("DISTANCE_MATRIX"); keys.needsAction("CUSTOM"); keys.needsAction("KDE"); keys.needsAction("ACCUMULATE"); keys.needsAction("CONSTANT"); diff --git a/src/gridtools/ReadGridInSetup.cpp b/src/gridtools/ReadGridInSetup.cpp index 2ac2b91952..59ed00d8d7 100644 --- a/src/gridtools/ReadGridInSetup.cpp +++ b/src/gridtools/ReadGridInSetup.cpp @@ -82,7 +82,7 @@ void ReadGridInSetup::registerKeywords( Keywords& keys ) { keys.add("optional","VAR","the names to give each of the grid directions in the function. If you have up to three grid coordinates in your function you can use x, y and z to refer to them. Otherwise you must use this flag to give your variables names."); keys.add("compulsory","FILE","the name of the file that contains the reference data"); keys.add("compulsory","VALUE","the name of the value that should be read from the grid"); - keys.setValueDescription("the constant function on the grid that was specified in input"); + keys.setValueDescription("grid","the constant function on the grid that was specified in input"); } ReadGridInSetup::ReadGridInSetup(const ActionOptions&ao): diff --git a/src/isdb/CS2Backbone.cpp b/src/isdb/CS2Backbone.cpp index e91cfa1321..b9d4320dcf 100644 --- a/src/isdb/CS2Backbone.cpp +++ b/src/isdb/CS2Backbone.cpp @@ -508,19 +508,19 @@ void CS2Backbone::registerKeywords( Keywords& keys ) { keys.add("compulsory","NEIGH_FREQ","20","Period in step for neighbor list update."); keys.addFlag("CAMSHIFT",false,"Set to TRUE if you to calculate a single CamShift score."); keys.addFlag("NOEXP",false,"Set to TRUE if you don't want to have fixed components with the experimental values."); - keys.addOutputComponent("ha","default","the calculated Ha hydrogen chemical shifts"); - keys.addOutputComponent("hn","default","the calculated H hydrogen chemical shifts"); - keys.addOutputComponent("nh","default","the calculated N nitrogen chemical shifts"); - keys.addOutputComponent("ca","default","the calculated Ca carbon chemical shifts"); - keys.addOutputComponent("cb","default","the calculated Cb carbon chemical shifts"); - keys.addOutputComponent("co","default","the calculated C' carbon chemical shifts"); - keys.addOutputComponent("expha","default","the experimental Ha hydrogen chemical shifts"); - keys.addOutputComponent("exphn","default","the experimental H hydrogen chemical shifts"); - keys.addOutputComponent("expnh","default","the experimental N nitrogen chemical shifts"); - keys.addOutputComponent("expca","default","the experimental Ca carbon chemical shifts"); - keys.addOutputComponent("expcb","default","the experimental Cb carbon chemical shifts"); - keys.addOutputComponent("expco","default","the experimental C' carbon chemical shifts"); - keys.setValueDescription("the backbone chemical shifts"); + keys.addOutputComponent("ha","default","scalar","the calculated Ha hydrogen chemical shifts"); + keys.addOutputComponent("hn","default","scalar","the calculated H hydrogen chemical shifts"); + keys.addOutputComponent("nh","default","scalar","the calculated N nitrogen chemical shifts"); + keys.addOutputComponent("ca","default","scalar","the calculated Ca carbon chemical shifts"); + keys.addOutputComponent("cb","default","scalar","the calculated Cb carbon chemical shifts"); + keys.addOutputComponent("co","default","scalar","the calculated C' carbon chemical shifts"); + keys.addOutputComponent("expha","default","scalar","the experimental Ha hydrogen chemical shifts"); + keys.addOutputComponent("exphn","default","scalar","the experimental H hydrogen chemical shifts"); + keys.addOutputComponent("expnh","default","scalar","the experimental N nitrogen chemical shifts"); + keys.addOutputComponent("expca","default","scalar","the experimental Ca carbon chemical shifts"); + keys.addOutputComponent("expcb","default","scalar","the experimental Cb carbon chemical shifts"); + keys.addOutputComponent("expco","default","scalar","the experimental C' carbon chemical shifts"); + keys.setValueDescription("scalar","the backbone chemical shifts"); } CS2Backbone::CS2Backbone(const ActionOptions&ao): diff --git a/src/isdb/Caliber.cpp b/src/isdb/Caliber.cpp index 338df29e47..6794060d04 100644 --- a/src/isdb/Caliber.cpp +++ b/src/isdb/Caliber.cpp @@ -124,7 +124,6 @@ PLUMED_REGISTER_ACTION(Caliber,"CALIBER") void Caliber::registerKeywords( Keywords& keys ) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.addFlag("NOENSEMBLE",false,"don't perform any replica-averaging"); keys.add("compulsory","FILE","the name of the file containing the time-resolved values"); keys.add("compulsory","KAPPA","a force constant, this can be use to scale a constant estimated on-the-fly using AVERAGING"); @@ -132,10 +131,10 @@ void Caliber::registerKeywords( Keywords& keys ) { keys.add("compulsory","TSCALE","1.0","Apply a time scaling on the experimental time scale"); keys.add("compulsory","SCALE","1.0","Apply a constant scaling on the data provided as arguments"); keys.add("optional","REGRES_ZERO","stride for regression with zero offset"); - keys.addOutputComponent("x0","default","the instantaneous value of the center of the potential"); - keys.addOutputComponent("mean","default","the current average value of the calculated observable"); - keys.addOutputComponent("kappa","default","the current force constant"); - keys.addOutputComponent("scale","REGRES_ZERO","the current scaling constant"); + keys.addOutputComponent("x0","default","scalar","the instantaneous value of the center of the potential"); + keys.addOutputComponent("mean","default","scalar","the current average value of the calculated observable"); + keys.addOutputComponent("kappa","default","scalar","the current force constant"); + keys.addOutputComponent("scale","REGRES_ZERO","scalar","the current scaling constant"); } Caliber::Caliber(const ActionOptions&ao): diff --git a/src/isdb/EMMI.cpp b/src/isdb/EMMI.cpp index e79b63c4c7..eeaf8d60a9 100644 --- a/src/isdb/EMMI.cpp +++ b/src/isdb/EMMI.cpp @@ -389,7 +389,7 @@ void EMMI::registerKeywords( Keywords& keys ) { ActionAtomistic::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); - keys.use("ARG"); + keys.addInputKeyword("optional","ARG","scalar","the labels of the values from which the function is calculated"); keys.add("atoms","ATOMS","atoms for which we calculate the density map, typically all heavy atoms"); keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances"); keys.add("compulsory","GMM_FILE","file with the parameters of the GMM components"); @@ -420,16 +420,16 @@ void EMMI::registerKeywords( Keywords& keys ) { keys.add("optional","AVERAGING", "Averaging window for weights"); keys.addFlag("NO_AVER",false,"don't do ensemble averaging in multi-replica mode"); keys.addFlag("REWEIGHT",false,"simple REWEIGHT using the ARG as energy"); - keys.addOutputComponent("scoreb","default","Bayesian score"); - keys.addOutputComponent("acc", "NOISETYPE","MC acceptance for uncertainty"); - keys.addOutputComponent("scale", "REGRESSION","scale factor"); - keys.addOutputComponent("accscale", "REGRESSION","MC acceptance for scale regression"); - keys.addOutputComponent("enescale", "REGRESSION","MC energy for scale regression"); - keys.addOutputComponent("anneal","ANNEAL","annealing factor"); - keys.addOutputComponent("weight", "REWEIGHT", "weights of the weighted average"); - keys.addOutputComponent("biasDer", "REWEIGHT", "derivatives with respect to the bias"); - keys.addOutputComponent("sigma", "NOISETYPE", "uncertainty in the forward models and experiment"); - keys.addOutputComponent("neff", "default", "effective number of replicas"); + keys.addOutputComponent("scoreb","default","scalar","Bayesian score"); + keys.addOutputComponent("acc", "NOISETYPE","scalar","MC acceptance for uncertainty"); + keys.addOutputComponent("scale", "REGRESSION","scalar","scale factor"); + keys.addOutputComponent("accscale", "REGRESSION","scalar","MC acceptance for scale regression"); + keys.addOutputComponent("enescale", "REGRESSION","scalar","MC energy for scale regression"); + keys.addOutputComponent("anneal","ANNEAL","scalar","annealing factor"); + keys.addOutputComponent("weight", "REWEIGHT","scalar", "weights of the weighted average"); + keys.addOutputComponent("biasDer", "REWEIGHT","scalar", "derivatives with respect to the bias"); + keys.addOutputComponent("sigma", "NOISETYPE","scalar", "uncertainty in the forward models and experiment"); + keys.addOutputComponent("neff", "default","scalar", "effective number of replicas"); } EMMI::EMMI(const ActionOptions&ao): diff --git a/src/isdb/EMMIVox.cpp b/src/isdb/EMMIVox.cpp index ca84b9426f..1ea408a828 100644 --- a/src/isdb/EMMIVox.cpp +++ b/src/isdb/EMMIVox.cpp @@ -251,12 +251,12 @@ void EMMIVOX::registerKeywords( Keywords& keys ) { keys.addFlag("BFACT_READ",false,"Read Bfactor on RESTART (automatic with DBFACT>0)"); keys.addFlag("BFACT_MINIMIZE",false,"Accept only moves that decrease energy"); keys.addFlag("MARTINI",false,"Use Martini scattering factors"); - keys.addOutputComponent("scoreb","default","Bayesian score"); - keys.addOutputComponent("scale", "default","scale factor"); - keys.addOutputComponent("offset","default","offset"); - keys.addOutputComponent("accB", "default", "Bfactor MC acceptance"); - keys.addOutputComponent("kbt", "default", "temperature in energy unit"); - keys.addOutputComponent("corr", "CORRELATION", "correlation coefficient"); + keys.addOutputComponent("scoreb","default","scalar","Bayesian score"); + keys.addOutputComponent("scale", "default","scalar","scale factor"); + keys.addOutputComponent("offset","default","scalar","offset"); + keys.addOutputComponent("accB", "default","scalar", "Bfactor MC acceptance"); + keys.addOutputComponent("kbt", "default","scalar", "temperature in energy unit"); + keys.addOutputComponent("corr", "CORRELATION","scalar", "correlation coefficient"); } EMMIVOX::EMMIVOX(const ActionOptions&ao): diff --git a/src/isdb/FretEfficiency.cpp b/src/isdb/FretEfficiency.cpp index d1990695f3..5d233b6fde 100644 --- a/src/isdb/FretEfficiency.cpp +++ b/src/isdb/FretEfficiency.cpp @@ -96,7 +96,7 @@ void FretEfficiency::registerKeywords( Keywords& keys ) { Colvar::registerKeywords( keys ); keys.add("atoms","ATOMS","the pair of atom that we are calculating the distance between"); keys.add("compulsory","R0","The value of the Forster radius."); - keys.setValueDescription("the fret efficiency between the input pair of atoms"); + keys.setValueDescription("scalar","the fret efficiency between the input pair of atoms"); } FretEfficiency::FretEfficiency(const ActionOptions&ao): diff --git a/src/isdb/Jcoupling.cpp b/src/isdb/Jcoupling.cpp index 8f2ec44974..69045363e1 100644 --- a/src/isdb/Jcoupling.cpp +++ b/src/isdb/Jcoupling.cpp @@ -118,8 +118,8 @@ void JCoupling::registerKeywords(Keywords& keys) { keys.add("optional", "C", "Karplus parameter C"); keys.add("optional", "SHIFT", "Angle shift in radians"); keys.add("numbered", "COUPLING", "Add an experimental value for each coupling"); - keys.addOutputComponent("j", "default", "the calculated J-coupling"); - keys.addOutputComponent("exp", "COUPLING", "the experimental J-coupling"); + keys.addOutputComponent("j", "default","scalar", "the calculated J-coupling"); + keys.addOutputComponent("exp", "COUPLING","scalar", "the experimental J-coupling"); } JCoupling::JCoupling(const ActionOptions&ao): diff --git a/src/isdb/Metainference.cpp b/src/isdb/Metainference.cpp index 604a8de72e..7ccd93b60f 100644 --- a/src/isdb/Metainference.cpp +++ b/src/isdb/Metainference.cpp @@ -286,8 +286,7 @@ PLUMED_REGISTER_ACTION(Metainference,"METAINFERENCE") void Metainference::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); - keys.add("optional","PARARG","reference values for the experimental data, these can be provided as arguments without derivatives"); + keys.addInputKeyword("optional","PARARG","scalar","reference values for the experimental data, these can be provided as arguments without derivatives"); keys.add("optional","PARAMETERS","reference values for the experimental data"); keys.addFlag("NOENSEMBLE",false,"don't perform any replica-averaging"); keys.addFlag("REWEIGHT",false,"simple REWEIGHT using the latest ARG as energy"); @@ -323,17 +322,17 @@ void Metainference::registerKeywords(Keywords& keys) { keys.add("optional","SELECTOR","name of selector"); keys.add("optional","NSELECT","range of values for selector [0, N-1]"); keys.use("RESTART"); - keys.addOutputComponent("sigma", "default", "uncertainty parameter"); - keys.addOutputComponent("sigmaMean", "default", "uncertainty in the mean estimate"); - keys.addOutputComponent("neff", "default", "effective number of replicas"); - keys.addOutputComponent("acceptSigma", "default", "MC acceptance for sigma values"); - keys.addOutputComponent("acceptScale", "SCALEDATA", "MC acceptance for scale value"); - keys.addOutputComponent("acceptFT", "GENERIC", "MC acceptance for general metainference f tilde value"); - keys.addOutputComponent("weight", "REWEIGHT", "weights of the weighted average"); - keys.addOutputComponent("biasDer", "REWEIGHT", "derivatives with respect to the bias"); - keys.addOutputComponent("scale", "SCALEDATA", "scale parameter"); - keys.addOutputComponent("offset", "ADDOFFSET", "offset parameter"); - keys.addOutputComponent("ftilde", "GENERIC", "ensemble average estimator"); + keys.addOutputComponent("sigma", "default", "scalar","uncertainty parameter"); + keys.addOutputComponent("sigmaMean", "default", "scalar","uncertainty in the mean estimate"); + keys.addOutputComponent("neff", "default", "scalar","effective number of replicas"); + keys.addOutputComponent("acceptSigma", "default", "scalar","MC acceptance for sigma values"); + keys.addOutputComponent("acceptScale", "SCALEDATA", "scalar","MC acceptance for scale value"); + keys.addOutputComponent("acceptFT", "GENERIC", "scalar","MC acceptance for general metainference f tilde value"); + keys.addOutputComponent("weight", "REWEIGHT", "scalar","weights of the weighted average"); + keys.addOutputComponent("biasDer", "REWEIGHT", "scalar","derivatives with respect to the bias"); + keys.addOutputComponent("scale", "SCALEDATA", "scalar","scale parameter"); + keys.addOutputComponent("offset", "ADDOFFSET", "scalar","offset parameter"); + keys.addOutputComponent("ftilde", "GENERIC", "scalar","ensemble average estimator"); } Metainference::Metainference(const ActionOptions&ao): diff --git a/src/isdb/MetainferenceBase.cpp b/src/isdb/MetainferenceBase.cpp index 6e9d230827..6059b48f5c 100644 --- a/src/isdb/MetainferenceBase.cpp +++ b/src/isdb/MetainferenceBase.cpp @@ -36,7 +36,7 @@ void MetainferenceBase::registerKeywords( Keywords& keys ) { ActionAtomistic::registerKeywords(keys); ActionWithValue::registerKeywords(keys); ActionWithArguments::registerKeywords(keys); - keys.use("ARG"); + keys.addInputKeyword("optional","ARG","scalar","the labels of the values from which the function is calculated"); keys.addFlag("DOSCORE",false,"activate metainference"); keys.addFlag("NOENSEMBLE",false,"don't perform any replica-averaging"); keys.addFlag("REWEIGHT",false,"simple REWEIGHT using the ARG as energy"); @@ -72,18 +72,18 @@ void MetainferenceBase::registerKeywords( Keywords& keys ) { keys.add("optional","SELECTOR","name of selector"); keys.add("optional","NSELECT","range of values for selector [0, N-1]"); keys.use("RESTART"); - keys.addOutputComponent("score", "default", "the Metainference score"); - keys.addOutputComponent("sigma", "default", "uncertainty parameter"); - keys.addOutputComponent("sigmaMean", "default", "uncertainty in the mean estimate"); - keys.addOutputComponent("neff", "default", "effective number of replicas"); - keys.addOutputComponent("acceptSigma", "default", "MC acceptance for sigma values"); - keys.addOutputComponent("acceptScale", "SCALEDATA", "MC acceptance for scale value"); - keys.addOutputComponent("acceptFT", "GENERIC", "MC acceptance for general metainference f tilde value"); - keys.addOutputComponent("weight", "REWEIGHT", "weights of the weighted average"); - keys.addOutputComponent("biasDer", "REWEIGHT", "derivatives with respect to the bias"); - keys.addOutputComponent("scale", "SCALEDATA", "scale parameter"); - keys.addOutputComponent("offset", "ADDOFFSET", "offset parameter"); - keys.addOutputComponent("ftilde", "GENERIC", "ensemble average estimator"); + keys.addOutputComponent("score", "default", "scalar","the Metainference score"); + keys.addOutputComponent("sigma", "default", "scalar","uncertainty parameter"); + keys.addOutputComponent("sigmaMean", "default", "scalar","uncertainty in the mean estimate"); + keys.addOutputComponent("neff", "default", "scalar","effective number of replicas"); + keys.addOutputComponent("acceptSigma", "default", "scalar","MC acceptance for sigma values"); + keys.addOutputComponent("acceptScale", "SCALEDATA", "scalar","MC acceptance for scale value"); + keys.addOutputComponent("acceptFT", "GENERIC", "scalar","MC acceptance for general metainference f tilde value"); + keys.addOutputComponent("weight", "REWEIGHT", "scalar","weights of the weighted average"); + keys.addOutputComponent("biasDer", "REWEIGHT", "scalar","derivatives with respect to the bias"); + keys.addOutputComponent("scale", "SCALEDATA", "scalar","scale parameter"); + keys.addOutputComponent("offset", "ADDOFFSET", "scalar","offset parameter"); + keys.addOutputComponent("ftilde", "GENERIC", "scalar","ensemble average estimator"); } MetainferenceBase::MetainferenceBase(const ActionOptions&ao): diff --git a/src/isdb/NOE.cpp b/src/isdb/NOE.cpp index 6db09fb287..3ada31900c 100644 --- a/src/isdb/NOE.cpp +++ b/src/isdb/NOE.cpp @@ -93,8 +93,8 @@ void NOE::registerKeywords( Keywords& keys ) { keys.reset_style("GROUPA","atoms"); keys.reset_style("GROUPB","atoms"); keys.add("numbered","NOEDIST","Add an experimental value for each NOE."); - keys.addOutputComponent("noe","default","the # NOE"); - keys.addOutputComponent("exp","NOEDIST","the # NOE experimental distance"); + keys.addOutputComponent("noe","default","scalar","the # NOE"); + keys.addOutputComponent("exp","NOEDIST","scalar","the # NOE experimental distance"); } NOE::NOE(const ActionOptions&ao): diff --git a/src/isdb/PRE.cpp b/src/isdb/PRE.cpp index 98a9a0e292..895b23292c 100644 --- a/src/isdb/PRE.cpp +++ b/src/isdb/PRE.cpp @@ -103,8 +103,8 @@ void PRE::registerKeywords( Keywords& keys ) { keys.add("numbered","RTWO","The relaxation of the atom/atoms in the corresponding GROUPA of atoms. " "Keywords like RTWO1, RTWO2, RTWO3,... should be listed."); keys.add("numbered","PREINT","Add an experimental value for each PRE."); - keys.addOutputComponent("pre","default","the # PRE"); - keys.addOutputComponent("exp","PREINT","the # PRE experimental intensity"); + keys.addOutputComponent("pre","default","scalar","the # PRE"); + keys.addOutputComponent("exp","PREINT","scalar","the # PRE experimental intensity"); } PRE::PRE(const ActionOptions&ao): diff --git a/src/isdb/RDC.cpp b/src/isdb/RDC.cpp index 6c51df81e6..3460e5764b 100644 --- a/src/isdb/RDC.cpp +++ b/src/isdb/RDC.cpp @@ -231,14 +231,14 @@ void RDC::registerKeywords( Keywords& keys ) { keys.add("compulsory","SCALE","1.","Add the scaling factor to take into account concentration and other effects. "); keys.addFlag("SVD",false,"Set to TRUE if you want to back calculate using Single Value Decomposition (need GSL at compilation time)."); keys.add("numbered","COUPLING","Add an experimental value for each coupling (needed by SVD and useful for STATS)."); - keys.addOutputComponent("rdc","default","the calculated # RDC"); - keys.addOutputComponent("exp","SVD/COUPLING","the experimental # RDC"); - keys.addOutputComponent("Sxx","SVD","Tensor component"); - keys.addOutputComponent("Syy","SVD","Tensor component"); - keys.addOutputComponent("Szz","SVD","Tensor component"); - keys.addOutputComponent("Sxy","SVD","Tensor component"); - keys.addOutputComponent("Sxz","SVD","Tensor component"); - keys.addOutputComponent("Syz","SVD","Tensor component"); + keys.addOutputComponent("rdc","default","scalar","the calculated # RDC"); + keys.addOutputComponent("exp","SVD/COUPLING","scalar","the experimental # RDC"); + keys.addOutputComponent("Sxx","SVD","scalar","Tensor component"); + keys.addOutputComponent("Syy","SVD","scalar","Tensor component"); + keys.addOutputComponent("Szz","SVD","scalar","Tensor component"); + keys.addOutputComponent("Sxy","SVD","scalar","Tensor component"); + keys.addOutputComponent("Sxz","SVD","scalar","Tensor component"); + keys.addOutputComponent("Syz","SVD","scalar","Tensor component"); } RDC::RDC(const ActionOptions&ao): diff --git a/src/isdb/Rescale.cpp b/src/isdb/Rescale.cpp index 705b8a762e..750463398e 100644 --- a/src/isdb/Rescale.cpp +++ b/src/isdb/Rescale.cpp @@ -163,7 +163,6 @@ PLUMED_REGISTER_ACTION(Rescale,"RESCALE") void Rescale::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","TEMP","temperature"); keys.add("compulsory","SELECTOR", "name of the SELECTOR used for rescaling"); keys.add("compulsory","MAX_RESCALE","maximum values for rescaling"); @@ -177,9 +176,9 @@ void Rescale::registerKeywords(Keywords& keys) { keys.add("optional","MC_STEPS","number of MC steps"); keys.add("optional","MC_STRIDE","MC stride"); keys.add("optional","PACE", "Pace for adding bias, in MC stride unit"); - keys.addOutputComponent("igamma", "default","gamma parameter"); - keys.addOutputComponent("accgamma","default","MC acceptance for gamma"); - keys.addOutputComponent("wtbias", "default","well-tempered bias"); + keys.addOutputComponent("igamma", "default","scalar","gamma parameter"); + keys.addOutputComponent("accgamma","default","scalar","MC acceptance for gamma"); + keys.addOutputComponent("wtbias", "default","scalar","well-tempered bias"); } Rescale::Rescale(const ActionOptions&ao): diff --git a/src/isdb/SAXS.cpp b/src/isdb/SAXS.cpp index ef207bb92e..6ec5d5e733 100644 --- a/src/isdb/SAXS.cpp +++ b/src/isdb/SAXS.cpp @@ -468,8 +468,8 @@ void SAXS::registerKeywords(Keywords& keys) { keys.add("compulsory","N","10","Number of points in the resolution function integral"); keys.add("compulsory","SOLVATION_STRIDE","10","Number of steps between every new residues solvation estimation via LCPO (ONEBEAD only)"); keys.add("compulsory","SCALE_EXPINT","1.0","Scaling value for experimental data normalization"); - keys.addOutputComponent("q","default","The # SAXS of q"); - keys.addOutputComponent("exp","EXPINT","The # experimental intensity"); + keys.addOutputComponent("q","default","scalar","The # SAXS of q"); + keys.addOutputComponent("exp","EXPINT","scalar","The # experimental intensity"); } SAXS::SAXS(const ActionOptions&ao): diff --git a/src/isdb/Select.cpp b/src/isdb/Select.cpp index 1b933c2b43..f7afb8d0e6 100644 --- a/src/isdb/Select.cpp +++ b/src/isdb/Select.cpp @@ -80,9 +80,8 @@ PLUMED_REGISTER_ACTION(Select,"SELECT") void Select::registerKeywords(Keywords& keys) { Function::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","SELECTOR","name of the variable used to select"); - keys.setValueDescription("the value of the selected argument"); + keys.setValueDescription("scalar","the value of the selected argument"); } Select::Select(const ActionOptions&ao): diff --git a/src/isdb/Shadow.cpp b/src/isdb/Shadow.cpp index 314c4a7945..ea2f041bae 100644 --- a/src/isdb/Shadow.cpp +++ b/src/isdb/Shadow.cpp @@ -115,7 +115,7 @@ void Shadow::registerKeywords( Keywords& keys ) { keys.add("atoms","ATOMS","atoms for which we calculate the shadow RMSD"); keys.add("compulsory","UPDATE","stride for updating reference coordinates"); keys.addFlag("REFERENCE",false,"this is the reference replica"); - keys.setValueDescription("the value of the shadow RMSD"); + keys.setValueDescription("scalar","the value of the shadow RMSD"); } Shadow::Shadow(const ActionOptions&ao): diff --git a/src/landmarks/CollectFrames.cpp b/src/landmarks/CollectFrames.cpp index 2aa9ed21d6..8ef6c8a8dc 100644 --- a/src/landmarks/CollectFrames.cpp +++ b/src/landmarks/CollectFrames.cpp @@ -49,14 +49,14 @@ PLUMED_REGISTER_ACTION(CollectFrames,"COLLECT_FRAMES") void CollectFrames::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); + keys.addInputKeyword("optional","ARG","scalar/vector","the labels of the values whose time series you would like to collect for later analysis"); keys.add("compulsory","STRIDE","1","the frequency with which data should be stored for analysis. By default data is collected on every step"); keys.add("compulsory","CLEAR","0","the frequency with which data should all be deleted and restarted"); keys.add("compulsory","ALIGN","OPTIMAL","if storing atoms how would you like the alignment to be done can be SIMPLE/OPTIMAL"); - keys.add("optional","ARG","the arguments you would like to collect"); keys.add("optional","ATOMS","list of atomic positions that you would like to collect and store for later analysis"); keys.add("optional","LOGWEIGHTS","list of actions that calculates log weights that should be used to weight configurations when calculating averages"); - keys.addOutputComponent("data","default","the data that is being collected by this action"); - keys.addOutputComponent("logweights","default","the logarithms of the weights of the data points"); + keys.addOutputComponent("data","default","matrix","the data that is being collected by this action"); + keys.addOutputComponent("logweights","default","vector","the logarithms of the weights of the data points"); keys.needsAction("POSITION"); keys.needsAction("CONCATENATE"); keys.needsAction("MEAN"); keys.needsAction("CUSTOM"); keys.needsAction("CONCATENATE"); keys.needsAction("COLLECT"); keys.needsAction("TRANSPOSE"); keys.needsAction("RMSD_VECTOR"); keys.needsAction("COMBINE"); keys.needsAction("VSTACK"); keys.needsAction("CONSTANT"); diff --git a/src/landmarks/FarthestPointSampling.cpp b/src/landmarks/FarthestPointSampling.cpp index 119a982cce..602ca16ec7 100644 --- a/src/landmarks/FarthestPointSampling.cpp +++ b/src/landmarks/FarthestPointSampling.cpp @@ -55,7 +55,7 @@ void FarthestPointSampling::registerKeywords( Keywords& keys ) { matrixtools::MatrixOperationBase::registerKeywords( keys ); keys.add("compulsory","NZEROS","the number of landmark points that you want to select"); keys.add("compulsory","SEED","1234","a random number seed"); - keys.setValueDescription("a vector which has as many elements as there are rows in the input matrix of dissimilarities. NZEROS of the elements in this vector are equal to one, the rest of the elements are equal to zero. The nodes that have elements equal to one are the NZEROS points that are farthest appart according to the input dissimilarities"); + keys.setValueDescription("vector","a vector which has as many elements as there are rows in the input matrix of dissimilarities. NZEROS of the elements in this vector are equal to one, the rest of the elements are equal to zero. The nodes that have elements equal to one are the NZEROS points that are farthest appart according to the input dissimilarities"); } FarthestPointSampling::FarthestPointSampling( const ActionOptions& ao ): diff --git a/src/landmarks/LandmarkSelection.cpp b/src/landmarks/LandmarkSelection.cpp index 87214d8596..ff8cd25f12 100644 --- a/src/landmarks/LandmarkSelection.cpp +++ b/src/landmarks/LandmarkSelection.cpp @@ -74,10 +74,10 @@ void LandmarkSelection::registerKeywords( Keywords& keys ) { keys.add("optional","SEED","a random number seed"); keys.addFlag("NOVORONOI",false,"do not do a Voronoi analysis of the data to determine weights of final points"); keys.addFlag("NODISSIMILARITIES",false,"do not calculate the dissimilarities"); - keys.addOutputComponent("data","ARG","the data that is being collected by this action"); - keys.addOutputComponent("logweights","ARG","the logarithms of the weights of the data points"); - keys.addOutputComponent("rectdissims","DISSIMILARITIES","a rectangular matrix containing the distances between the landmark points and the rest of the points"); - keys.addOutputComponent("sqrdissims","DISSIMILARITIES","a square matrix containing the distances between each pair of landmark points"); + keys.addOutputComponent("data","ARG","matrix","the data that is being collected by this action"); + keys.addOutputComponent("logweights","ARG","vector","the logarithms of the weights of the data points"); + keys.addOutputComponent("rectdissims","DISSIMILARITIES","matrix","a rectangular matrix containing the distances between the landmark points and the rest of the points"); + keys.addOutputComponent("sqrdissims","DISSIMILARITIES","matrix","a square matrix containing the distances between each pair of landmark points"); keys.needsAction("LOGSUMEXP"); keys.needsAction("TRANSPOSE"); keys.needsAction("DISSIMILARITIES"); keys.needsAction("ONES"); keys.needsAction("CREATE_MASK"); keys.needsAction("FARTHEST_POINT_SAMPLING"); keys.needsAction("SELECT_WITH_MASK"); keys.needsAction("COMBINE"); keys.needsAction("VORONOI"); diff --git a/src/landmarks/LogSumExp.cpp b/src/landmarks/LogSumExp.cpp index 9423a1e7ac..836dcf9d0c 100644 --- a/src/landmarks/LogSumExp.cpp +++ b/src/landmarks/LogSumExp.cpp @@ -49,7 +49,7 @@ PLUMED_REGISTER_ACTION(LogSumExp,"LOGSUMEXP") void LogSumExp::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); keys.add("compulsory","ARG","the vector of logweights that you would like to normalise using the logsumexp trick"); - keys.setValueDescription("the logarithms of the input weights logweights that are computed with the log-sum weights formula"); + keys.setValueDescription("vector","the logarithms of the input weights logweights that are computed with the log-sum weights formula"); keys.needsAction("HIGHEST"); keys.needsAction("CUSTOM"); keys.needsAction("SUM"); } diff --git a/src/logmfd/LogMFD.cpp b/src/logmfd/LogMFD.cpp index 1ddc9b561d..9748eef0b6 100644 --- a/src/logmfd/LogMFD.cpp +++ b/src/logmfd/LogMFD.cpp @@ -461,7 +461,6 @@ PLUMED_REGISTER_ACTION(LogMFD,"LOGMFD") */ void LogMFD::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","INTERVAL", "Period of MD steps (N_m) to update fictitious dynamical variables." ); keys.add("compulsory","DELTA_T", @@ -537,12 +536,12 @@ void LogMFD::registerKeywords(Keywords& keys) { "temperature of the MD system, while TEMP may be (in principle) different from it. " "If not provided, TEMPPD is set to be the same value as TEMP." ); - keys.addOutputComponent("_fict","default", + keys.addOutputComponent("_fict","default","scalar", "For example, the fictitious collective variable for LogMFD is specified as " "ARG=dist12 and LABEL=logmfd in LOGMFD section in Plumed input file, " "the associated fictitious dynamical variable can be specified as " "PRINT ARG=dist12,logmfd.dist12_fict FILE=COLVAR"); - keys.addOutputComponent("_vfict","default", + keys.addOutputComponent("_vfict","default","scalar", "For example, the fictitious collective variable for LogMFD is specified as " "ARG=dist12 and LABEL=logmfd in LOGMFD section in Plumed input file, the " "velocity of the associated fictitious dynamical variable can be specified as " diff --git a/src/mapping/AdaptivePath.cpp b/src/mapping/AdaptivePath.cpp index 0acce615cf..b43893530e 100644 --- a/src/mapping/AdaptivePath.cpp +++ b/src/mapping/AdaptivePath.cpp @@ -104,7 +104,7 @@ void AdaptivePath::registerKeywords( Keywords& keys ) { keys.add("optional","WFILE","file on which to write out the path"); keys.add("compulsory","FMT","%f","the format to use for output files"); keys.add("compulsory","WSTRIDE","frequency with which to write out the path"); - keys.setValueDescription("the position along and from the adaptive path"); + keys.setValueDescription("scalar","the position along and from the adaptive path"); keys.needsAction("GEOMETRIC_PATH"); keys.needsAction("AVERAGE_PATH_DISPLACEMENT"); keys.needsAction("REPARAMETERIZE_PATH"); keys.needsAction("DUMPPDB"); keys.needsAction("PDB2CONSTANT"); keys.needsAction("DISPLACEMENT"); keys.needsAction("CONSTANT"); diff --git a/src/mapping/GeometricPath.cpp b/src/mapping/GeometricPath.cpp index bdd6d14acd..578ebe3ec5 100644 --- a/src/mapping/GeometricPath.cpp +++ b/src/mapping/GeometricPath.cpp @@ -50,11 +50,11 @@ class GeometricPath : public ActionWithVector { PLUMED_REGISTER_ACTION(GeometricPath,"GEOMETRIC_PATH") void GeometricPath::registerKeywords(Keywords& keys) { - ActionWithVector::registerKeywords(keys); keys.use("ARG"); + ActionWithVector::registerKeywords(keys); PathProjectionCalculator::registerKeywords(keys); - keys.add("compulsory","PROPERTY","the coordinates we are projecting these points onto"); - keys.addOutputComponent("s","default","the position on the path"); - keys.addOutputComponent("z","default","the distance from the path"); + keys.addInputKeyword("compulsory","PROPERTY","vector","the label of a value that contains the coordinates we are projecting these points onto"); + keys.addOutputComponent("s","default","scalar","the position on the path"); + keys.addOutputComponent("z","default","scalar","the distance from the path"); keys.needsAction("GEOMETRIC_PATH"); keys.needsAction("PDB2CONSTANT"); } diff --git a/src/mapping/GeometricPathShortcut.cpp b/src/mapping/GeometricPathShortcut.cpp index beecdea35c..2668fe24f7 100644 --- a/src/mapping/GeometricPathShortcut.cpp +++ b/src/mapping/GeometricPathShortcut.cpp @@ -47,8 +47,8 @@ PLUMED_REGISTER_ACTION(GeometricPathShortcut,"GPATH") void GeometricPathShortcut::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); Path::registerInputFileKeywords( keys ); keys.add("optional","PROPERTY","read in path coordinates by finding option with this label in remark of pdb frames"); - keys.addOutputComponent("s","default","the position on the path"); - keys.addOutputComponent("z","default","the distance from the path"); + keys.addOutputComponent("s","default","scalar","the position on the path"); + keys.addOutputComponent("z","default","scalar","the distance from the path"); keys.needsAction("DISPLACEMENT"); keys.needsAction("GEOMETRIC_PATH"); keys.needsAction("PDB2CONSTANT"); keys.needsAction("CONSTANT"); } diff --git a/src/mapping/PCAVars.cpp b/src/mapping/PCAVars.cpp index 8d8637670e..099bc96b9e 100644 --- a/src/mapping/PCAVars.cpp +++ b/src/mapping/PCAVars.cpp @@ -181,10 +181,10 @@ void PCAVars::registerKeywords( Keywords& keys ) { keys.add("compulsory","TYPE","OPTIMAL-FAST","the manner in which distances are calculated. More information on the different " "metrics that are available in PLUMED can be found in the section of the manual on " "\\ref dists"); - keys.add("optional","ARG","if there are arguments to be used specify them here"); + keys.addInputKeyword("optional","ARG","scalar/vector","if there are arguments to be used specify them here"); keys.addFlag("NOPBC",false,"do not use periodic boundary conditions when computing this quantity"); - keys.addOutputComponent("eig","default","the projections on the eigenvalues"); - keys.addOutputComponent("residual","default","the residual distance that is not projected on any of the eigenvalues"); + keys.addOutputComponent("eig","default","vector","the projections on the eigenvalues"); + keys.addOutputComponent("residual","default","scalar","the residual distance that is not projected on any of the eigenvalues"); keys.needsAction("RMSD"); keys.needsAction("PDB2CONSTANT"); keys.needsAction("TRANSPOSE"); keys.needsAction("EUCLIDEAN_DISTANCE"); keys.needsAction("CONCATENATE"); keys.needsAction("COMBINE"); keys.needsAction("CONSTANT"); keys.needsAction("COMBINE"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("CUSTOM"); keys.needsAction("SUM"); diff --git a/src/mapping/Path.cpp b/src/mapping/Path.cpp index aab10ade2f..0d3f23cea5 100644 --- a/src/mapping/Path.cpp +++ b/src/mapping/Path.cpp @@ -212,10 +212,10 @@ void Path::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); Path::registerInputFileKeywords( keys ); keys.add("optional","PROPERTY","the property to be used in the index. This should be in the REMARK of the reference"); keys.add("compulsory","LAMBDA","the lambda parameter is needed for smoothing, is in the units of plumed"); - keys.addOutputComponent("gspath","GPATH","the position along the path calculated using the geometric formula"); - keys.addOutputComponent("gzpath","GPATH","the distance from the path calculated using the geometric formula"); - keys.addOutputComponent("spath","default","the position along the path calculated"); - keys.addOutputComponent("zpath","default","the distance from the path calculated"); + keys.addOutputComponent("gspath","GPATH","scalar","the position along the path calculated using the geometric formula"); + keys.addOutputComponent("gzpath","GPATH","scalar","the distance from the path calculated using the geometric formula"); + keys.addOutputComponent("spath","default","scalar","the position along the path calculated"); + keys.addOutputComponent("zpath","default","scalar","the distance from the path calculated"); } void Path::registerInputFileKeywords( Keywords& keys ) { @@ -223,7 +223,7 @@ void Path::registerInputFileKeywords( Keywords& keys ) { keys.add("compulsory","TYPE","OPTIMAL-FAST","the manner in which distances are calculated. More information on the different " "metrics that are available in PLUMED can be found in the section of the manual on " "\\ref dists"); - keys.add("optional","ARG","the list of arguments you would like to use in your definition of the path"); + keys.addInputKeyword("optional","ARG","scalar","the list of arguments you would like to use in your definition of the path"); keys.add("optional","COEFFICIENTS","the coefficients of the displacements along each argument that should be used when calculating the euclidean distance"); keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances"); keys.addFlag("NOSPATH",false,"do not calculate the spath CV"); diff --git a/src/mapping/PathDisplacements.cpp b/src/mapping/PathDisplacements.cpp index a202dd8f77..f6609175c7 100644 --- a/src/mapping/PathDisplacements.cpp +++ b/src/mapping/PathDisplacements.cpp @@ -60,12 +60,12 @@ PLUMED_REGISTER_ACTION(PathDisplacements,"AVERAGE_PATH_DISPLACEMENT") void PathDisplacements::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionPilot::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); PathProjectionCalculator::registerKeywords( keys ); + ActionWithArguments::registerKeywords( keys ); PathProjectionCalculator::registerKeywords( keys ); keys.add("compulsory","STRIDE","1","the frequency with which the average displacements should be collected and added to the average displacements"); keys.add("compulsory","HALFLIFE","-1","the number of MD steps after which a previously measured path distance weighs only 50 percent in the average. This option may increase convergence by allowing to forget the memory of a bad initial guess path. The default is to set this to infinity"); keys.add("compulsory","CLEAR","0","the frequency with which to clear all the accumulated data. The default value " "of 0 implies that all the data will be used and that the grid will never be cleared"); - keys.setValueDescription("vector containing the average displacement between the trajectory and each of the landmarks that makes up the path"); + keys.setValueDescription("matrix","matrix containing the average displacement between the trajectory and each of the landmarks that makes up the path"); } PathDisplacements::PathDisplacements(const ActionOptions& ao): diff --git a/src/mapping/PathProjectionCalculator.cpp b/src/mapping/PathProjectionCalculator.cpp index fe22867246..606d319bbb 100644 --- a/src/mapping/PathProjectionCalculator.cpp +++ b/src/mapping/PathProjectionCalculator.cpp @@ -30,9 +30,10 @@ namespace PLMD { namespace mapping { void PathProjectionCalculator::registerKeywords(Keywords& keys) { + keys.addInputKeyword("compulsory","ARG","matrix","the labels of the matrix that contains the vectors of displacements from each frame in the path"); keys.add("compulsory","METRIC","the method to use for computing the displacement vectors between the reference frames"); keys.add("compulsory","METRIC_COMPONENT","if the final action in your metric contains multiple components this keyword is used to specify the component that should be used"); - keys.add("compulsory","REFERENCE","labels for actions that contain reference coordinates for each point on the path"); + keys.addInputKeyword("compulsory","REFERENCE","vector","labels for actions that contain reference coordinates for each point on the path"); } PathProjectionCalculator::PathProjectionCalculator( Action* act ): diff --git a/src/matrixtools/CovarianceMatrix.cpp b/src/matrixtools/CovarianceMatrix.cpp index 77bfc24a0a..e5ed06f705 100644 --- a/src/matrixtools/CovarianceMatrix.cpp +++ b/src/matrixtools/CovarianceMatrix.cpp @@ -48,7 +48,7 @@ void CovarianceMatrix::registerKeywords(Keywords& keys ) { keys.add("compulsory","WEIGHTS","this keyword takes the label of an action that calculates a vector of values. The elements of this vector " "are used as weights for the input data points."); keys.addFlag("UNORMALIZED",false,"do not divide by the sum of the weights"); - keys.setValueDescription("the covariance matrix"); + keys.setValueDescription("matrix","the covariance matrix"); keys.needsAction("SUM"); keys.needsAction("CUSTOM"); keys.needsAction("VSTACK"); keys.needsAction("TRANSPOSE"); keys.needsAction("ONES"); keys.needsAction("OUTER_PRODUCT"); keys.needsAction("MATRIX_PRODUCT"); } diff --git a/src/matrixtools/Determinent.cpp b/src/matrixtools/Determinent.cpp index ccea1860ab..5a2c023da8 100644 --- a/src/matrixtools/Determinent.cpp +++ b/src/matrixtools/Determinent.cpp @@ -44,8 +44,8 @@ PLUMED_REGISTER_ACTION(Determinant,"DETERMINANT") void Determinant::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords(keys); - keys.add("compulsory","ARG","The matrix that we are calculating the determinant for"); - keys.setValueDescription("the determinant of the matrix"); + keys.addInputKeyword("compulsory","ARG","matrix","The matrix that we are calculating the determinant for"); + keys.setValueDescription("scalar","the determinant of the matrix"); } Determinant::Determinant( const ActionOptions& ao): diff --git a/src/matrixtools/DiagonalizeMatrix.cpp b/src/matrixtools/DiagonalizeMatrix.cpp index 7a8cda7fef..29b6f1aff8 100644 --- a/src/matrixtools/DiagonalizeMatrix.cpp +++ b/src/matrixtools/DiagonalizeMatrix.cpp @@ -59,8 +59,8 @@ PLUMED_REGISTER_ACTION(DiagonalizeMatrix,"DIAGONALIZE") void DiagonalizeMatrix::registerKeywords( Keywords& keys ) { MatrixOperationBase::registerKeywords( keys ); keys.add("compulsory","VECTORS","all","the eigenvalues and vectors that you would like to calculate. 1=largest, 2=second largest and so on"); - keys.addOutputComponent("vals","default","the eigevalues of the input matrix"); - keys.addOutputComponent("vecs","default","the eigenvectors of the input matrix"); + keys.addOutputComponent("vals","default","scalar","the eigevalues of the input matrix"); + keys.addOutputComponent("vecs","default","vector","the eigenvectors of the input matrix"); } DiagonalizeMatrix::DiagonalizeMatrix(const ActionOptions& ao): diff --git a/src/matrixtools/InvertMatrix.cpp b/src/matrixtools/InvertMatrix.cpp index 72633d261a..71213bdffe 100644 --- a/src/matrixtools/InvertMatrix.cpp +++ b/src/matrixtools/InvertMatrix.cpp @@ -57,7 +57,7 @@ PLUMED_REGISTER_ACTION(InvertMatrix,"INVERT_MATRIX") void InvertMatrix::registerKeywords( Keywords& keys ) { MatrixOperationBase::registerKeywords( keys ); - keys.setValueDescription("the inverse of the input matrix"); + keys.setValueDescription("matrix","the inverse of the input matrix"); } InvertMatrix::InvertMatrix(const ActionOptions& ao): diff --git a/src/matrixtools/MatrixOperationBase.cpp b/src/matrixtools/MatrixOperationBase.cpp index e2b2a4d7b0..ce719eab53 100644 --- a/src/matrixtools/MatrixOperationBase.cpp +++ b/src/matrixtools/MatrixOperationBase.cpp @@ -26,7 +26,8 @@ namespace matrixtools { void MatrixOperationBase::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); - keys.use("ARG"); keys.remove("NUMERICAL_DERIVATIVES"); + keys.addInputKeyword("compulsory","ARG","matrix","the input matrix"); + keys.remove("NUMERICAL_DERIVATIVES"); keys.add("optional","MATRIX","the input matrix (can use ARG instead)"); } diff --git a/src/matrixtools/MatrixTimesMatrix.cpp b/src/matrixtools/MatrixTimesMatrix.cpp index 34dc2f0b5a..8840354dc1 100644 --- a/src/matrixtools/MatrixTimesMatrix.cpp +++ b/src/matrixtools/MatrixTimesMatrix.cpp @@ -64,9 +64,10 @@ PLUMED_REGISTER_ACTION(MatrixTimesMatrix,"MATRIX_PRODUCT") PLUMED_REGISTER_ACTION(MatrixTimesMatrix,"DISSIMILARITIES") void MatrixTimesMatrix::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); + ActionWithMatrix::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","matrix","the label of the two matrices from which the product is calculated"); keys.addFlag("SQUARED",false,"calculate the squares of the dissimilarities (this option cannot be used with MATRIX_PRODUCT)"); - keys.setValueDescription("the product of the two input matrices"); + keys.setValueDescription("matrix","the product of the two input matrices"); } MatrixTimesMatrix::MatrixTimesMatrix(const ActionOptions&ao): diff --git a/src/matrixtools/MatrixTimesVector.cpp b/src/matrixtools/MatrixTimesVector.cpp index 4725b5131c..fe8c3ed498 100644 --- a/src/matrixtools/MatrixTimesVector.cpp +++ b/src/matrixtools/MatrixTimesVector.cpp @@ -56,8 +56,9 @@ class MatrixTimesVector : public ActionWithMatrix { PLUMED_REGISTER_ACTION(MatrixTimesVector,"MATRIX_VECTOR_PRODUCT") void MatrixTimesVector::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); - keys.setValueDescription("the vector that is obtained by taking the product between the matrix and the vector that were input"); + ActionWithMatrix::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","matrix/vector/scalar","the label for the matrix and the vector/scalar that are being multiplied. Alternatively, you can provide labels for multiple matrices and a single vector or labels for a single matrix and multiple vectors. In these cases multiple matrix vector products will be computed."); + keys.setValueDescription("vector","the vector that is obtained by taking the product between the matrix and the vector that were input"); ActionWithValue::useCustomisableComponents(keys); } diff --git a/src/matrixtools/OuterProduct.cpp b/src/matrixtools/OuterProduct.cpp index 881617ae02..518927003a 100644 --- a/src/matrixtools/OuterProduct.cpp +++ b/src/matrixtools/OuterProduct.cpp @@ -55,10 +55,11 @@ class OuterProduct : public ActionWithMatrix { PLUMED_REGISTER_ACTION(OuterProduct,"OUTER_PRODUCT") void OuterProduct::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); + ActionWithMatrix::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","vector","the labels of the two vectors from which the outer product is being computed"); keys.add("compulsory","FUNC","x*y","the function of the input vectors that should be put in the elements of the outer product"); keys.addFlag("ELEMENTS_ON_DIAGONAL_ARE_ZERO",false,"set all diagonal elements to zero"); - keys.setValueDescription("a matrix containing the outer product of the two input vectors that was obtained using the function that was input"); + keys.setValueDescription("matrix","a matrix containing the outer product of the two input vectors that was obtained using the function that was input"); } OuterProduct::OuterProduct(const ActionOptions&ao): diff --git a/src/matrixtools/TransposeMatrix.cpp b/src/matrixtools/TransposeMatrix.cpp index 125bd43b31..92b23da488 100644 --- a/src/matrixtools/TransposeMatrix.cpp +++ b/src/matrixtools/TransposeMatrix.cpp @@ -55,7 +55,8 @@ PLUMED_REGISTER_ACTION(TransposeMatrix,"TRANSPOSE") void TransposeMatrix::registerKeywords( Keywords& keys ) { MatrixOperationBase::registerKeywords( keys ); - keys.setValueDescription("the transpose of the input matrix"); + keys.addInputKeyword("compulsory","ARG","vector/matrix","the label of the vector or matrix that should be transposed"); + keys.setValueDescription("vector/matrix","the transpose of the input matrix"); } TransposeMatrix::TransposeMatrix(const ActionOptions& ao): diff --git a/src/matrixtools/Voronoi.cpp b/src/matrixtools/Voronoi.cpp index a5ab13090b..a28b074c2c 100644 --- a/src/matrixtools/Voronoi.cpp +++ b/src/matrixtools/Voronoi.cpp @@ -51,8 +51,9 @@ class Voronoi : public ActionWithMatrix { PLUMED_REGISTER_ACTION(Voronoi,"VORONOI") void Voronoi::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); - keys.setValueDescription("a matrix in which element ij is equal to one if the ij component of the input matrix is lower than all the ik elements of the matrix where k is not j and zero otherwise"); + ActionWithMatrix::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","matrix","the distance/adjacency matrix that should be used to perform the voronoi analysis"); + keys.setValueDescription("matrix","a matrix in which element ij is equal to one if the ij component of the input matrix is lower than all the ik elements of the matrix where k is not j and zero otherwise"); } Voronoi::Voronoi(const ActionOptions&ao): diff --git a/src/maze/Loss.cpp b/src/maze/Loss.cpp index 76a4a16e9b..46e3814f6a 100644 --- a/src/maze/Loss.cpp +++ b/src/maze/Loss.cpp @@ -70,7 +70,7 @@ void Loss::registerKeywords(Keywords& keys) { "PARAMS", "Parameters for the loss function." ); - keys.setValueDescription("the value of the loss function"); + keys.setValueDescription("scalar","the value of the loss function"); } Loss::Loss(const ActionOptions& ao) diff --git a/src/maze/Optimizer.cpp b/src/maze/Optimizer.cpp index 73dc38ca2d..a0ba50b5b2 100644 --- a/src/maze/Optimizer.cpp +++ b/src/maze/Optimizer.cpp @@ -106,30 +106,35 @@ void Optimizer::registerKeywords(Keywords& keys) { keys.addOutputComponent( "x", "default", + "scalar", "Optimal biasing direction; x component." ); keys.addOutputComponent( "y", "default", + "scalar", "Optimal biasing direction; y component." ); keys.addOutputComponent( "z", "default", + "scalar", "Optimal biasing direction; z component." ); keys.addOutputComponent( "loss", "default", + "scalar", "Loss function value defined by the provided pairing function." ); keys.addOutputComponent( "sr", "default", + "scalar", "Sampling radius. Reduces sampling to the local proximity of the ligand " "position." ); diff --git a/src/maze/Optimizer_Bias.cpp b/src/maze/Optimizer_Bias.cpp index 7b420fd493..1500346ef7 100644 --- a/src/maze/Optimizer_Bias.cpp +++ b/src/maze/Optimizer_Bias.cpp @@ -200,8 +200,6 @@ PLUMED_REGISTER_ACTION(OptimizerBias, "MAZE_OPTIMIZER_BIAS") void OptimizerBias::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); - keys.add( "compulsory", "BIASING_RATE", @@ -228,30 +226,35 @@ void OptimizerBias::registerKeywords(Keywords& keys) { keys.addOutputComponent( "force2", "default", + "scalar", "Square of the biasing force." ); keys.addOutputComponent( "x", "default", + "scalar", "Optimal biasing direction: x component." ); keys.addOutputComponent( "y", "default", + "scalar", "Optimal biasing direction: y component." ); keys.addOutputComponent( "z", "default", + "scalar", "Optimal biasing direction: z component." ); keys.addOutputComponent( "tdist", "default", + "scalar", "Total distance traveled by biased atoms." ); } diff --git a/src/maze/Random_Acceleration_MD.cpp b/src/maze/Random_Acceleration_MD.cpp index 741fda6e95..fae8417b01 100644 --- a/src/maze/Random_Acceleration_MD.cpp +++ b/src/maze/Random_Acceleration_MD.cpp @@ -125,12 +125,14 @@ void Random_Acceleration_MD::registerKeywords(Keywords& keys) { keys.addOutputComponent( "dist", "default", + "scalar", "Distance traveled in one sampling interval." ); keys.addOutputComponent( "tdist", "default", + "scalar", "Total distance traveled by biased atoms." ); } diff --git a/src/maze/Steered_MD.cpp b/src/maze/Steered_MD.cpp index 867c354f2c..8ef42c2fa9 100644 --- a/src/maze/Steered_MD.cpp +++ b/src/maze/Steered_MD.cpp @@ -118,6 +118,7 @@ void Steered_MD::registerKeywords(Keywords& keys) { keys.addOutputComponent( "tdist", "default", + "scalar", "Total distance traveled by biased atoms." ); } diff --git a/src/membranefusion/FusionPoreExpansionP.cpp b/src/membranefusion/FusionPoreExpansionP.cpp index 303a40e356..104721340a 100644 --- a/src/membranefusion/FusionPoreExpansionP.cpp +++ b/src/membranefusion/FusionPoreExpansionP.cpp @@ -102,7 +102,7 @@ void fusionPoreExpansionP::registerKeywords(Keywords &keys) keys.add("compulsory", "R0", "normalization constant that makes 0 the initial value of the CV."); keys.add("optional", "XCYL", "X coordinate of the fixed cylinder, if not present this will be calculated."); keys.add("optional", "YCYL", "X coordinate of the fixed cylinder, if not present this will be calculated."); - keys.setValueDescription("the value of the CV"); + keys.setValueDescription("scalar","the value of the CV"); } fusionPoreExpansionP::fusionPoreExpansionP(const ActionOptions &ao) : PLUMED_COLVAR_INIT(ao) diff --git a/src/membranefusion/FusionPoreNucleationP.cpp b/src/membranefusion/FusionPoreNucleationP.cpp index a68ea0f47c..a16cbfa44a 100644 --- a/src/membranefusion/FusionPoreNucleationP.cpp +++ b/src/membranefusion/FusionPoreNucleationP.cpp @@ -106,7 +106,7 @@ void fusionPoreNucleationP::registerKeywords(Keywords &keys) keys.add("optional", "ONEOVERS2C2CUTOFF", "( default=500 ) cut off large values for the derivative of the atan2 function to avoid violate energy."); keys.add("optional", "XCYL", "X coordinate of the fixed cylinder, if not present this will be calculated."); keys.add("optional", "YCYL", "X coordinate of the fixed cylinder, if not present this will be calculated."); - keys.setValueDescription("the value of the CV"); + keys.setValueDescription("scalar","the value of the CV"); } fusionPoreNucleationP::fusionPoreNucleationP(const ActionOptions &ao) : PLUMED_COLVAR_INIT(ao) diff --git a/src/membranefusion/MemFusionP.cpp b/src/membranefusion/MemFusionP.cpp index b4351a0ae8..ce40665899 100644 --- a/src/membranefusion/MemFusionP.cpp +++ b/src/membranefusion/MemFusionP.cpp @@ -102,7 +102,7 @@ void memFusionP::registerKeywords(Keywords &keys) keys.add("optional", "ONEOVERS2C2CUTOFF", "( default=500 ) cut off large values for the derivative of the atan2 function."); keys.add("optional", "XCYL", "X coordinate of the fixed cylinder, if not present this will be calculated."); keys.add("optional", "YCYL", "Y coordinate of the fixed cylinder, if not present this will be calculated."); - keys.setValueDescription("the value of the CV"); + keys.setValueDescription("scalar","the value of the CV"); } memFusionP::memFusionP(const ActionOptions &ao) : PLUMED_COLVAR_INIT(ao) diff --git a/src/metatensor/metatensor.cpp b/src/metatensor/metatensor.cpp index b1fbbd29e8..ce43e6e643 100644 --- a/src/metatensor/metatensor.cpp +++ b/src/metatensor/metatensor.cpp @@ -959,9 +959,8 @@ void MetatensorPlumedAction::registerKeywords(Keywords& keys) { keys.add("optional", "SPECIES_TO_TYPES", "mapping from PLUMED SPECIES to metatensor's atomic types"); - keys.addOutputComponent("outputs", "default", "collective variable created by the metatensor model"); - - keys.setValueDescription("collective variable created by the metatensor model"); + keys.addOutputComponent("outputs", "default", "scalar", "collective variable created by the metatensor model"); + keys.setValueDescription("scalar/vector/matrix","collective variable created by the metatensor model"); } PLUMED_REGISTER_ACTION(MetatensorPlumedAction, "METATENSOR") diff --git a/src/multicolvar/AlphaBeta.cpp b/src/multicolvar/AlphaBeta.cpp index dce98504fe..7dd21bb4ed 100644 --- a/src/multicolvar/AlphaBeta.cpp +++ b/src/multicolvar/AlphaBeta.cpp @@ -59,7 +59,7 @@ void AlphaBeta::registerKeywords(Keywords& keys) { "same reference value is used for all torsions"); keys.add("numbered","COEFFICIENT","the coefficient for each of the torsional angles. If you use a single COEFFICIENT value the " "same reference value is used for all torsional angles"); - keys.setValueDescription("the alpha beta CV"); + keys.setValueDescription("scalar","the alpha beta CV"); keys.needsAction("CONSTANT"); keys.needsAction("TORSION"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); keys.needsAction("SUM"); } diff --git a/src/multicolvar/Angles.cpp b/src/multicolvar/Angles.cpp index d035dc28df..e0e4b1e9a1 100644 --- a/src/multicolvar/Angles.cpp +++ b/src/multicolvar/Angles.cpp @@ -109,6 +109,7 @@ void Angles::registerKeywords( Keywords& keys ) { "GROUPC are calculated. The GROUPA atoms are assumed to be the central " "atoms"); keys.add("optional","SWITCH","the switching function specifies that only those bonds that have a length that is less than a certain threshold are considered"); + keys.setValueDescription("vector","the ANGLE for each set of three atoms that were specified"); MultiColvarShortcuts::shortcutKeywords( keys ); keys.needsAction("ANGLE"); keys.needsAction("COORD_ANGLES"); } diff --git a/src/multicolvar/Dihcor.cpp b/src/multicolvar/Dihcor.cpp index bb0c4c3ee2..47d458305c 100644 --- a/src/multicolvar/Dihcor.cpp +++ b/src/multicolvar/Dihcor.cpp @@ -92,7 +92,7 @@ void Dihcor::registerKeywords( Keywords& keys ) { keys.needsAction("DIHEDRAL_CORRELATION"); keys.needsAction("SUM"); keys.add("atoms","ATOMS","the set of 8 atoms that are being used each of the dihedral correlation values"); keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances"); - keys.setValueDescription("the sum of all the dihedral correlations"); + keys.setValueDescription("scalar","the sum of all the dihedral correlations"); } Dihcor::Dihcor(const ActionOptions&ao): diff --git a/src/multicolvar/Distances.cpp b/src/multicolvar/Distances.cpp index 4975f3c963..960d8d2ab1 100644 --- a/src/multicolvar/Distances.cpp +++ b/src/multicolvar/Distances.cpp @@ -206,9 +206,10 @@ void Distances::registerKeywords(Keywords& keys) { keys.add("atoms","ORIGIN","calculate the distance of all the atoms specified using the ATOMS keyword from this point"); keys.add("numbered","LOCATION","the location at which the CV is assumed to be in space"); keys.reset_style("LOCATION","atoms"); - keys.addOutputComponent("x","COMPONENTS","the x-components of the distance vectors"); - keys.addOutputComponent("y","COMPONENTS","the y-components of the distance vectors"); - keys.addOutputComponent("z","COMPONENTS","the z-components of the distance vectors"); + keys.setValueDescription("vector","the DISTANCES between the each pair of atoms that were specified"); + keys.addOutputComponent("x","COMPONENTS","vector","the x-components of the distance vectors"); + keys.addOutputComponent("y","COMPONENTS","vector","the y-components of the distance vectors"); + keys.addOutputComponent("z","COMPONENTS","vector","the z-components of the distance vectors"); keys.needsAction("GROUP"); keys.needsAction("DISTANCE"); keys.needsAction("CENTER"); } diff --git a/src/multicolvar/InPlaneDistances.cpp b/src/multicolvar/InPlaneDistances.cpp index a05b281993..d1db1dd591 100644 --- a/src/multicolvar/InPlaneDistances.cpp +++ b/src/multicolvar/InPlaneDistances.cpp @@ -51,6 +51,7 @@ void InPlaneDistances::registerKeywords( Keywords& keys ) { keys.add("atoms","GROUP","calculate distance for each distinct set of three atoms in the group"); keys.add("atoms","VECTORSTART","The first atom position that is used to define the normal to the plane of interest"); keys.add("atoms","VECTOREND","The second atom position that is used to defin the normal to the plane of interest"); + keys.setValueDescription("vector","the INPLANEDISTANCE between each of the atoms specified using the GROUP keyword and atom A in the plane perpendicular to the vector connecting the atoms specified using VECTORSTART and VECTOREND"); MultiColvarShortcuts::shortcutKeywords( keys ); keys.needsAction("DISTANCE"); keys.needsAction("ANGLE"); } diff --git a/src/multicolvar/MFilterLess.cpp b/src/multicolvar/MFilterLess.cpp index 93ee48b28c..83f1978515 100644 --- a/src/multicolvar/MFilterLess.cpp +++ b/src/multicolvar/MFilterLess.cpp @@ -49,7 +49,7 @@ void MFilterLess::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); keys.add("compulsory","DATA","the vector you wish to transform"); keys.add("compulsory","SWITCH","the switching function that transform"); - keys.setValueDescription("a vector that has the same dimension as the input vector with elements equal to one if the corresponding component of the vector is less than a tolerance and zero otherwise"); + keys.setValueDescription("vector","a vector that has the same dimension as the input vector with elements equal to one if the corresponding component of the vector is less than a tolerance and zero otherwise"); keys.needsAction("GROUP"); keys.needsAction("LESS_THAN"); } diff --git a/src/multicolvar/MFilterMore.cpp b/src/multicolvar/MFilterMore.cpp index 045ab1910c..363a773891 100644 --- a/src/multicolvar/MFilterMore.cpp +++ b/src/multicolvar/MFilterMore.cpp @@ -51,7 +51,7 @@ void MFilterMore::registerKeywords(Keywords& keys) { keys.add("compulsory","SWITCH","the switching function that transform"); keys.addFlag("LOWMEM",false,"this flag does nothing and is present only to ensure back-compatibility"); keys.addFlag("HIGHEST",false,"this flag allows you to recover the highest of these variables."); - keys.addOutputComponent("highest","HIGHEST","the largest of the colvars"); + keys.addOutputComponent("highest","HIGHEST","scalar","the largest of the colvars"); keys.needsAction("CUSTOM"); keys.needsAction("GROUP"); keys.needsAction("MORE_THAN"); keys.needsAction("HIGHEST"); } diff --git a/src/multicolvar/MultiColvarShortcuts.cpp b/src/multicolvar/MultiColvarShortcuts.cpp index 1490cb1d8e..ac8514999d 100644 --- a/src/multicolvar/MultiColvarShortcuts.cpp +++ b/src/multicolvar/MultiColvarShortcuts.cpp @@ -31,40 +31,40 @@ void MultiColvarShortcuts::shortcutKeywords( Keywords& keys ) { keys.add("numbered","LESS_THAN","calculate the number of variables that are less than a certain target value. " "This quantity is calculated using \\f$\\sum_i \\sigma(s_i)\\f$, where \\f$\\sigma(s)\\f$ " "is a \\ref switchingfunction."); - keys.addOutputComponent("lessthan","LESS_THAN","the number of colvars that have a value less than a threshold"); + keys.addOutputComponent("lessthan","LESS_THAN","scalar","the number of colvars that have a value less than a threshold"); keys.add("numbered","MORE_THAN","calculate the number of variables that are more than a certain target value. " "This quantity is calculated using \\f$\\sum_i 1 - \\sigma(s_i)\\f$, where \\f$\\sigma(s)\\f$ " "is a \\ref switchingfunction."); - keys.addOutputComponent("morethan","MORE_THAN","the number of colvars that have a value more than a threshold"); + keys.addOutputComponent("morethan","MORE_THAN","scalar","the number of colvars that have a value more than a threshold"); keys.add("optional","ALT_MIN","calculate the minimum value. " "To make this quantity continuous the minimum is calculated using " "\\f$ \\textrm{min} = -\\frac{1}{\\beta} \\log \\sum_i \\exp\\left( -\\beta s_i \\right) \\f$ " "The value of \\f$\\beta\\f$ in this function is specified using (BETA=\\f$\\beta\\f$)."); - keys.addOutputComponent("altmin","ALT_MIN","the minimum value of the cv"); + keys.addOutputComponent("altmin","ALT_MIN","scalar","the minimum value of the cv"); keys.add("optional","MIN","calculate the minimum value. " "To make this quantity continuous the minimum is calculated using " "\\f$ \\textrm{min} = \\frac{\\beta}{ \\log \\sum_i \\exp\\left( \\frac{\\beta}{s_i} \\right) } \\f$ " "The value of \\f$\\beta\\f$ in this function is specified using (BETA=\\f$\\beta\\f$)"); - keys.addOutputComponent("min","MIN","the minimum colvar"); + keys.addOutputComponent("min","MIN","scalar","the minimum colvar"); keys.add("optional","MAX","calculate the maximum value. " "To make this quantity continuous the maximum is calculated using " "\\f$ \\textrm{max} = \\beta \\log \\sum_i \\exp\\left( \\frac{s_i}{\\beta}\\right) \\f$ " "The value of \\f$\\beta\\f$ in this function is specified using (BETA=\\f$\\beta\\f$)"); - keys.addOutputComponent("max","MAX","the maximum colvar"); + keys.addOutputComponent("max","MAX","scalar","the maximum colvar"); keys.add("numbered","BETWEEN","calculate the number of values that are within a certain range. " "These quantities are calculated using kernel density estimation as described on " "\\ref histogrambead."); - keys.addOutputComponent("between","BETWEEN","the number of colvars that have a value that lies in a particular interval"); + keys.addOutputComponent("between","BETWEEN","scalar","the number of colvars that have a value that lies in a particular interval"); keys.addFlag("HIGHEST",false,"this flag allows you to recover the highest of these variables."); - keys.addOutputComponent("highest","HIGHEST","the largest of the colvars"); + keys.addOutputComponent("highest","HIGHEST","scalar","the largest of the colvars"); keys.add("optional","HISTOGRAM","calculate a discretized histogram of the distribution of values. " "This shortcut allows you to calculates NBIN quantites like BETWEEN."); keys.addFlag("LOWEST",false,"this flag allows you to recover the lowest of these variables."); - keys.addOutputComponent("lowest","LOWEST","the smallest of the colvars"); + keys.addOutputComponent("lowest","LOWEST","scalar","the smallest of the colvars"); keys.addFlag("SUM",false,"calculate the sum of all the quantities."); - keys.addOutputComponent("sum","SUM","the sum of the colvars"); + keys.addOutputComponent("sum","SUM","scalar","the sum of the colvars"); keys.addFlag("MEAN",false,"calculate the mean of all the quantities."); - keys.addOutputComponent("mean","MEAN","the mean of the colvars"); + keys.addOutputComponent("mean","MEAN","scalar","the mean of the colvars"); keys.needsAction("SUM"); keys.needsAction("MEAN"); keys.needsAction("CUSTOM"); keys.needsAction("HIGHEST"); keys.needsAction("LOWEST"); keys.needsAction("LESS_THAN"); keys.needsAction("MORE_THAN"); keys.needsAction("BETWEEN"); } diff --git a/src/multicolvar/Planes.cpp b/src/multicolvar/Planes.cpp index e6dd5948cb..1bc6e5b027 100644 --- a/src/multicolvar/Planes.cpp +++ b/src/multicolvar/Planes.cpp @@ -56,9 +56,9 @@ void PlaneShortcut::registerKeywords( Keywords& keys ) { keys.add("numbered","LOCATION","the location at which the CV is assumed to be in space"); keys.reset_style("LOCATION","atoms"); keys.addFlag("VMEAN",false,"calculate the norm of the mean vector."); - keys.addOutputComponent("_vmean","VMEAN","the norm of the mean vector"); + keys.addOutputComponent("_vmean","VMEAN","scalar","the norm of the mean vector"); keys.addFlag("VSUM",false,"calculate the norm of the sum of all the vectors"); - keys.addOutputComponent("_vsum","VSUM","the norm of the mean vector"); + keys.addOutputComponent("_vsum","VSUM","scalar","the norm of the mean vector"); keys.needsAction("CENTER"); keys.needsAction("GROUP"); keys.needsAction("PLANE"); keys.needsAction("MEAN"); keys.needsAction("SUM"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); } diff --git a/src/multicolvar/Torsions.cpp b/src/multicolvar/Torsions.cpp index 406c89b6ff..5d3f8882a1 100644 --- a/src/multicolvar/Torsions.cpp +++ b/src/multicolvar/Torsions.cpp @@ -80,6 +80,7 @@ PLUMED_REGISTER_ACTION(Torsions,"TORSIONS") void Torsions::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); MultiColvarShortcuts::shortcutKeywords( keys ); keys.needsAction("TORSION"); + keys.setValueDescription("vector","the TORSION for each set of three atoms that were specified"); } Torsions::Torsions(const ActionOptions& ao): diff --git a/src/multicolvar/UWalls.cpp b/src/multicolvar/UWalls.cpp index fd5487d10b..68892cdf57 100644 --- a/src/multicolvar/UWalls.cpp +++ b/src/multicolvar/UWalls.cpp @@ -57,8 +57,8 @@ void UWalls::registerKeywords(Keywords& keys) { keys.add("atoms","CATOMS","all the angles between the bonds that radiate out from these central atom are computed"); keys.add("atoms","GROUP","a list of angls between pairs of bonds connecting one of the atoms specified using the CATOM command and two of the atoms specified here are computed"); keys.add("compulsory","SWITCH","the switching function specifies that only those bonds that have a length that is less than a certain threshold are considered"); - keys.addOutputComponent("bias","default","the instantaneous value of the bias potential"); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential"); + keys.addOutputComponent("bias","default","scalar","the instantaneous value of the bias potential"); + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential"); keys.needsAction("UPPER_WALLS"); } diff --git a/src/multicolvar/XYTorsions.cpp b/src/multicolvar/XYTorsions.cpp index 61de8b50d5..5ff382db5d 100644 --- a/src/multicolvar/XYTorsions.cpp +++ b/src/multicolvar/XYTorsions.cpp @@ -97,6 +97,7 @@ void XYTorsions::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); keys.add("numbered","ATOMS","the pairs of atoms that you would like to calculate the angles for"); keys.reset_style("ATOMS","atoms"); MultiColvarShortcuts::shortcutKeywords( keys ); + keys.setValueDescription("vector","the angle between the vector connecting each pair of atoms and the the positive X/Y/Z direction around the X/Y/Z axis"); keys.needsAction("FIXEDATOM"); keys.needsAction("TORSION"); } diff --git a/src/opes/ECVcustom.cpp b/src/opes/ECVcustom.cpp index 8e87f18b5c..62fd80b44d 100644 --- a/src/opes/ECVcustom.cpp +++ b/src/opes/ECVcustom.cpp @@ -87,8 +87,7 @@ PLUMED_REGISTER_ACTION(ECVcustom,"ECV_CUSTOM") void ECVcustom::registerKeywords(Keywords& keys) { ExpansionCVs::registerKeywords(keys); - keys.remove("ARG"); - keys.add("compulsory","ARG","the labels of the single ECVs. Delta U_i, in energy units"); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the single ECVs. Delta U_i, in energy units"); keys.addFlag("ADD_P0",false,"add the unbiased Boltzmann distribution to the target distribution, to make sure to sample it"); keys.addFlag("DIMENSIONLESS",false,"consider ARG as dimensionless rather than an energy, thus do not multiply it by beta"); keys.add("optional","BARRIER","a guess of the free energy barrier to be overcome (better to stay higher than lower)"); diff --git a/src/opes/ECVlinear.cpp b/src/opes/ECVlinear.cpp index 48650d607d..7375229ea0 100644 --- a/src/opes/ECVlinear.cpp +++ b/src/opes/ECVlinear.cpp @@ -97,8 +97,7 @@ PLUMED_REGISTER_ACTION(ECVlinear,"ECV_LINEAR") void ECVlinear::registerKeywords(Keywords& keys) { ExpansionCVs::registerKeywords(keys); - keys.remove("ARG"); - keys.add("compulsory","ARG","the label of the Hamiltonian difference. Delta U"); + keys.addInputKeyword("compulsory","ARG","scalar","the label of the Hamiltonian difference. Delta U"); keys.add("compulsory","LAMBDA","0","the lambda at which the underlying simulation runs"); keys.add("optional","LAMBDA_MIN","( default=0 ) the minimum of the lambda range"); keys.add("optional","LAMBDA_MAX","( default=1 ) the maximum of the lambda range"); diff --git a/src/opes/ECVmultiThermal.cpp b/src/opes/ECVmultiThermal.cpp index 9ab1ce1a49..1d7b22e2a5 100644 --- a/src/opes/ECVmultiThermal.cpp +++ b/src/opes/ECVmultiThermal.cpp @@ -103,8 +103,7 @@ PLUMED_REGISTER_ACTION(ECVmultiThermal,"ECV_MULTITHERMAL") void ECVmultiThermal::registerKeywords(Keywords& keys) { ExpansionCVs::registerKeywords(keys); - keys.remove("ARG"); - keys.add("compulsory","ARG","the label of the internal energy of the system. If volume is fixed it is calculated by the ENERGY colvar"); + keys.addInputKeyword("compulsory","ARG","scalar","the label of the internal energy of the system. If volume is fixed it is calculated by the ENERGY colvar"); keys.add("optional","TEMP_MIN","the minimum of the temperature range"); keys.add("optional","TEMP_MAX","the maximum of the temperature range"); keys.add("optional","TEMP_STEPS","the number of steps in temperature"); diff --git a/src/opes/ECVmultiThermalBaric.cpp b/src/opes/ECVmultiThermalBaric.cpp index 059fec82cc..614fea208f 100644 --- a/src/opes/ECVmultiThermalBaric.cpp +++ b/src/opes/ECVmultiThermalBaric.cpp @@ -110,8 +110,7 @@ PLUMED_REGISTER_ACTION(ECVmultiThermalBaric,"ECV_MULTITHERMAL_MULTIBARIC") void ECVmultiThermalBaric::registerKeywords(Keywords& keys) { ExpansionCVs::registerKeywords(keys); - keys.remove("ARG"); - keys.add("compulsory","ARG","the labels of the potential energy and of the volume of the system. You can calculate them with ENERGY and VOLUME respectively"); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the potential energy and of the volume of the system. You can calculate them with ENERGY and VOLUME respectively"); //temperature keys.add("optional","TEMP_MIN","the minimum of the temperature range"); keys.add("optional","TEMP_MAX","the maximum of the temperature range"); diff --git a/src/opes/ECVumbrellasFile.cpp b/src/opes/ECVumbrellasFile.cpp index 6f1342bdd4..371dc78453 100644 --- a/src/opes/ECVumbrellasFile.cpp +++ b/src/opes/ECVumbrellasFile.cpp @@ -98,7 +98,6 @@ PLUMED_REGISTER_ACTION(ECVumbrellasFile,"ECV_UMBRELLAS_FILE") void ECVumbrellasFile::registerKeywords(Keywords& keys) { ExpansionCVs::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","FILE","the name of the file containing the umbrellas"); keys.add("optional","BARRIER","a guess of the free energy barrier to be overcome (better to stay higher than lower)"); keys.addFlag("ADD_P0",false,"add the unbiased Boltzmann distribution to the target distribution, to make sure to sample it"); diff --git a/src/opes/ECVumbrellasLine.cpp b/src/opes/ECVumbrellasLine.cpp index 0ab817422f..dc9e455b8e 100644 --- a/src/opes/ECVumbrellasLine.cpp +++ b/src/opes/ECVumbrellasLine.cpp @@ -99,7 +99,6 @@ PLUMED_REGISTER_ACTION(ECVumbrellasLine,"ECV_UMBRELLAS_LINE") void ECVumbrellasLine::registerKeywords(Keywords& keys) { ExpansionCVs::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","CV_MIN","the minimum of the CV range to be explored"); keys.add("compulsory","CV_MAX","the maximum of the CV range to be explored"); keys.add("compulsory","SIGMA","sigma of the umbrella Gaussians"); diff --git a/src/opes/ExpansionCVs.cpp b/src/opes/ExpansionCVs.cpp index 4d2b3632c9..e2e9c8663a 100644 --- a/src/opes/ExpansionCVs.cpp +++ b/src/opes/ExpansionCVs.cpp @@ -30,6 +30,7 @@ void ExpansionCVs::registerKeywords(Keywords& keys) ActionWithArguments::registerKeywords(keys); ActionWithValue::useCustomisableComponents(keys); keys.add("compulsory","TEMP","-1","temperature. If not specified tries to get it from MD engine"); + keys.addInputKeyword("compulsory","ARG","scalar","the labels of the scalar values that are input to this action"); } ExpansionCVs::ExpansionCVs(const ActionOptions&ao) diff --git a/src/opes/OPESexpanded.cpp b/src/opes/OPESexpanded.cpp index afb309b20f..ab2c118bec 100644 --- a/src/opes/OPESexpanded.cpp +++ b/src/opes/OPESexpanded.cpp @@ -181,8 +181,7 @@ PLUMED_REGISTER_ACTION(OPESexpanded,"OPES_EXPANDED") void OPESexpanded::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.remove("ARG"); - keys.add("compulsory","ARG","the label of the ECVs that define the expansion. You can use an * to make sure all the output components of the ECVs are used, as in the examples above"); + keys.addInputKeyword("compulsory","ARG","scalar","the label of the ECVs that define the expansion. You can use an * to make sure all the output components of the ECVs are used, as in the examples above"); keys.add("compulsory","PACE","how often the bias is updated"); keys.add("compulsory","OBSERVATION_STEPS","100","number of unbiased initial PACE steps to collect statistics for initialization"); //DeltaFs and state files @@ -202,7 +201,7 @@ void OPESexpanded::registerKeywords(Keywords& keys) keys.use("UPDATE_UNTIL"); //output components - keys.addOutputComponent("work","CALC_WORK","total accumulated work done by the bias"); + keys.addOutputComponent("work","CALC_WORK","scalar","total accumulated work done by the bias"); } OPESexpanded::OPESexpanded(const ActionOptions&ao) diff --git a/src/opes/OPESmetad.cpp b/src/opes/OPESmetad.cpp index 2e9aa7555d..00eb8a743f 100644 --- a/src/opes/OPESmetad.cpp +++ b/src/opes/OPESmetad.cpp @@ -302,7 +302,6 @@ template void OPESmetad::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("compulsory","TEMP","-1","temperature. If not set, it is taken from MD engine, but not all MD codes provide it"); keys.add("compulsory","PACE","the frequency for kernel deposition"); std::string info_sigma("the initial widths of the kernels"); @@ -337,9 +336,9 @@ void OPESmetad::registerKeywords(Keywords& keys) keys.add("optional","STATE_WSTRIDE","number of MD steps between writing the STATE_WFILE. Default is only on CPT events (but not all MD codes set them)"); keys.addFlag("STORE_STATES",false,"append to STATE_WFILE instead of ovewriting it each time"); //miscellaneous - keys.add("optional","EXCLUDED_REGION","kernels are not deposited when the action provided here has a nonzero value, see example above"); + keys.addInputKeyword("optional","EXCLUDED_REGION","scalar","kernels are not deposited when the action provided here has a nonzero value, see example above"); if(!mode::explore) - keys.add("optional","EXTRA_BIAS","consider also these other bias potentials for the internal reweighting. This can be used e.g. for sampling a custom target distribution (see example above)"); + keys.addInputKeyword("optional","EXTRA_BIAS","scalar","consider also these other bias potentials for the internal reweighting. This can be used e.g. for sampling a custom target distribution (see example above)"); keys.addFlag("CALC_WORK",false,"calculate the total accumulated work done by the bias since last restart"); keys.addFlag("WALKERS_MPI",false,"switch on MPI version of multiple walkers"); keys.addFlag("SERIAL",false,"perform calculations in serial"); @@ -348,13 +347,13 @@ void OPESmetad::registerKeywords(Keywords& keys) keys.use("UPDATE_UNTIL"); //output components - keys.addOutputComponent("rct","default","estimate of c(t). log(exp(beta V)/beta, should become flat as the simulation converges. Do NOT use for reweighting"); - keys.addOutputComponent("zed","default","estimate of Z_n. should become flat once no new CV-space region is explored"); - keys.addOutputComponent("neff","default","effective sample size"); - keys.addOutputComponent("nker","default","total number of compressed kernels used to represent the bias"); - keys.addOutputComponent("work","CALC_WORK","total accumulated work done by the bias"); - keys.addOutputComponent("nlker","NLIST","number of kernels in the neighbor list"); - keys.addOutputComponent("nlsteps","NLIST","number of steps from last neighbor list update"); + keys.addOutputComponent("rct","default","scalar","estimate of c(t). log(exp(beta V)/beta, should become flat as the simulation converges. Do NOT use for reweighting"); + keys.addOutputComponent("zed","default","scalar","estimate of Z_n. should become flat once no new CV-space region is explored"); + keys.addOutputComponent("neff","default","scalar","effective sample size"); + keys.addOutputComponent("nker","default","scalar","total number of compressed kernels used to represent the bias"); + keys.addOutputComponent("work","CALC_WORK","scalar","total accumulated work done by the bias"); + keys.addOutputComponent("nlker","NLIST","scalar","number of kernels in the neighbor list"); + keys.addOutputComponent("nlsteps","NLIST","scalar","number of steps from last neighbor list update"); } template diff --git a/src/pamm/HBPammMatrix.cpp b/src/pamm/HBPammMatrix.cpp index d2b85ed537..e7ecf591c3 100644 --- a/src/pamm/HBPammMatrix.cpp +++ b/src/pamm/HBPammMatrix.cpp @@ -211,6 +211,7 @@ void HBPammShortcut::registerKeywords( Keywords& keys ) { keys.add("compulsory","HYDROGENS","The list of hydrogen atoms that can form part of a hydrogen bond. The atoms must be specified using a comma separated list, " "an index range or by using a \\ref GROUP"); multicolvar::MultiColvarShortcuts::shortcutKeywords( keys ); keys.needsAction("HBPAMM_MATRIX"); + keys.setValueDescription("vector","a vector specifiying the number of hydrogen bonds each of the specified atoms participates within"); } HBPammShortcut::HBPammShortcut(const ActionOptions&ao): diff --git a/src/piv/PIV.cpp b/src/piv/PIV.cpp index 849a1aad19..4e1a1c375b 100644 --- a/src/piv/PIV.cpp +++ b/src/piv/PIV.cpp @@ -261,7 +261,7 @@ void PIV::registerKeywords( Keywords& keys ) keys.add("optional","NL_STRIDE","Update neighbor lists every NL_STRIDE steps."); keys.add("optional","NL_SKIN","The maximum atom displacement tolerated for the neighbor lists update."); keys.reset_style("SWITCH","compulsory"); - keys.setValueDescription("the PIV-distance"); + keys.setValueDescription("scalar","the PIV-distance"); } PIV::PIV(const ActionOptions&ao): diff --git a/src/pytorch/PytorchModel.cpp b/src/pytorch/PytorchModel.cpp index 7a7775e759..68719163e9 100644 --- a/src/pytorch/PytorchModel.cpp +++ b/src/pytorch/PytorchModel.cpp @@ -94,7 +94,6 @@ PLUMED_REGISTER_ACTION(PytorchModel,"PYTORCH_MODEL") void PytorchModel::registerKeywords(Keywords& keys) { Function::registerKeywords(keys); - keys.use("ARG"); keys.add("optional","FILE","Filename of the PyTorch compiled model"); keys.addOutputComponent("node", "default", "Model outputs"); } diff --git a/src/refdist/Difference.cpp b/src/refdist/Difference.cpp index e58c3de4c9..dd0caf2072 100644 --- a/src/refdist/Difference.cpp +++ b/src/refdist/Difference.cpp @@ -78,7 +78,7 @@ typedef function::FunctionOfVector VectorDifference; PLUMED_REGISTER_ACTION(VectorDifference,"DIFFERENCE_VECTOR") void Difference::registerKeywords(Keywords& keys) { - keys.setValueDescription("a function that measures the difference"); + keys.setValueDescription("scalar/vector","a function that measures the difference"); } void Difference::read( ActionWithArguments* action ) { diff --git a/src/refdist/Displacement.cpp b/src/refdist/Displacement.cpp index 5db52c395a..17312199eb 100644 --- a/src/refdist/Displacement.cpp +++ b/src/refdist/Displacement.cpp @@ -52,7 +52,7 @@ void Displacement::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords(keys); keys.add("compulsory","ARG1","The point that we are calculating the distance from"); keys.add("compulsory","ARG2","The point that we are calculating the distance to"); - keys.setValueDescription("the differences between the input arguments"); + keys.setValueDescription("vector/matrix","the differences between the input arguments"); keys.needsAction("DIFFERENCE"); keys.needsAction("TRANSPOSE"); keys.needsAction("VSTACK"); } diff --git a/src/refdist/EuclideanDistance.cpp b/src/refdist/EuclideanDistance.cpp index c1a1943eb2..5f743e49fe 100644 --- a/src/refdist/EuclideanDistance.cpp +++ b/src/refdist/EuclideanDistance.cpp @@ -50,7 +50,7 @@ void EuclideanDistance::registerKeywords( Keywords& keys ) { keys.add("compulsory","ARG1","The poin that we are calculating the distance from"); keys.add("compulsory","ARG2","The point that we are calculating the distance to"); keys.addFlag("SQUARED",false,"The squared distance should be calculated"); - keys.setValueDescription("the euclidean distances between the input vectors"); + keys.setValueDescription("scalar/vector","the euclidean distances between the input vectors"); keys.needsAction("DISPLACEMENT"); keys.needsAction("CUSTOM"); keys.needsAction("TRANSPOSE"); keys.needsAction("MATRIX_PRODUCT_DIAGONAL"); } diff --git a/src/refdist/Kernel.cpp b/src/refdist/Kernel.cpp index 5176ea3c77..84565c75c9 100644 --- a/src/refdist/Kernel.cpp +++ b/src/refdist/Kernel.cpp @@ -62,7 +62,7 @@ void Kernel::registerKeywords(Keywords& keys) { keys.add("optional","REFERENCE","the file from which to read the kernel parameters"); keys.add("compulsory","NUMBER","1","if there are multiple sets of kernel parameters in the input file which set of kernel parameters would you like to read in here"); keys.addFlag("NORMALIZED",false,"would you like the kernel function to be normalized"); - keys.setValueDescription("the value of the kernel evaluated at the argument values"); + keys.setValueDescription("scalar/vector","the value of the kernel evaluated at the argument values"); keys.needsAction("CONSTANT"); keys.needsAction("CUSTOM"); keys.needsAction("NORMALIZED_EUCLIDEAN_DISTANCE"); keys.needsAction("PRODUCT"); keys.needsAction("INVERT_MATRIX"); keys.needsAction("MAHALANOBIS_DISTANCE"); keys.needsAction("DIAGONALIZE"); keys.needsAction("CONCATENATE"); keys.needsAction("DETERMINANT"); diff --git a/src/refdist/MahalanobisDistance.cpp b/src/refdist/MahalanobisDistance.cpp index 69dfe9659d..5de42b1fa7 100644 --- a/src/refdist/MahalanobisDistance.cpp +++ b/src/refdist/MahalanobisDistance.cpp @@ -52,7 +52,7 @@ void MahalanobisDistance::registerKeywords( Keywords& keys ) { keys.add("compulsory","METRIC","The inverse covariance matrix that should be used when calculating the distance"); keys.addFlag("SQUARED",false,"The squared distance should be calculated"); keys.addFlag("VON_MISSES",false,"Compute the mahalanobis distance in a way that is more sympathetic to the periodic boundary conditions"); - keys.setValueDescription("the Mahalanobis distances between the input vectors"); + keys.setValueDescription("scalar/vector","the Mahalanobis distances between the input vectors"); keys.needsAction("DISPLACEMENT"); keys.needsAction("CUSTOM"); keys.needsAction("OUTER_PRODUCT"); keys.needsAction("TRANSPOSE"); keys.needsAction("MATRIX_PRODUCT_DIAGONAL"); keys.needsAction("CONSTANT"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("MATRIX_PRODUCT"); keys.needsAction("COMBINE"); diff --git a/src/refdist/MatrixProductDiagonal.cpp b/src/refdist/MatrixProductDiagonal.cpp index 74e32fc7fd..54d022b9ff 100644 --- a/src/refdist/MatrixProductDiagonal.cpp +++ b/src/refdist/MatrixProductDiagonal.cpp @@ -47,8 +47,9 @@ class MatrixProductDiagonal : public ActionWithVector { PLUMED_REGISTER_ACTION(MatrixProductDiagonal,"MATRIX_PRODUCT_DIAGONAL") void MatrixProductDiagonal::registerKeywords( Keywords& keys ) { - ActionWithVector::registerKeywords(keys); keys.use("ARG"); - keys.setValueDescription("a vector containing the diagonal elements of the matrix that obtaned by multiplying the two input matrices together"); + ActionWithVector::registerKeywords(keys); + keys.addInputKeyword("compulsory","ARG","vector/matrix","the two vectors/matrices whose product are to be taken"); + keys.setValueDescription("scalar/vector","a vector containing the diagonal elements of the matrix that obtaned by multiplying the two input matrices together"); } MatrixProductDiagonal::MatrixProductDiagonal(const ActionOptions&ao): diff --git a/src/refdist/NormalizedEuclideanDistance.cpp b/src/refdist/NormalizedEuclideanDistance.cpp index efa96fdfec..9b6c536d21 100644 --- a/src/refdist/NormalizedEuclideanDistance.cpp +++ b/src/refdist/NormalizedEuclideanDistance.cpp @@ -51,7 +51,7 @@ void NormalizedEuclideanDistance::registerKeywords( Keywords& keys ) { keys.add("compulsory","ARG2","The point that we are calculating the distance to"); keys.add("compulsory","METRIC","The inverse covariance matrix that should be used when calculating the distance"); keys.addFlag("SQUARED",false,"The squared distance should be calculated"); - keys.setValueDescription("the normalized euclidean distances between the input vectors"); + keys.setValueDescription("scalar/vector","the normalized euclidean distances between the input vectors"); keys.needsAction("DISPLACEMENT"); keys.needsAction("CUSTOM"); keys.needsAction("OUTER_PRODUCT"); keys.needsAction("TRANSPOSE"); keys.needsAction("MATRIX_PRODUCT_DIAGONAL"); keys.needsAction("ONES"); } diff --git a/src/s2cm/S2ContactModel.cpp b/src/s2cm/S2ContactModel.cpp index 0fbb3f5f0e..8cea3e5f27 100644 --- a/src/s2cm/S2ContactModel.cpp +++ b/src/s2cm/S2ContactModel.cpp @@ -96,7 +96,7 @@ void S2ContactModel::registerKeywords( Keywords& keys ) { keys.add("compulsory","OFFSET_C","the offset, c in the equation"); keys.add("compulsory","N_I"," n_i in the equation"); keys.add("optional","R_SHIFT","shift all distances by given amount"); - keys.setValueDescription("the value of the CV"); + keys.setValueDescription("scalar","the value of the CV"); } S2ContactModel::S2ContactModel(const ActionOptions&ao): diff --git a/src/sasa/sasa_HASEL.cpp b/src/sasa/sasa_HASEL.cpp index 0373ec5ce1..5f1970cb3f 100644 --- a/src/sasa/sasa_HASEL.cpp +++ b/src/sasa/sasa_HASEL.cpp @@ -171,7 +171,7 @@ void SASA_HASEL::registerKeywords(Keywords& keys) { keys.add("compulsory", "NL_STRIDE", "The frequency with which the neighbor list for the calculation of SASA is updated."); keys.add("optional","DELTAGFILE","a file containing the free energy of transfer values for backbone and sidechains atoms. Necessary only if TYPE = TRANSFER. A Python script for the computation of free energy of transfer values to describe the effect of osmolyte concentration, temperature and pressure is freely available at https://github.com/andrea-arsiccio/DeltaG-calculation. The script automatically outputs a DeltaG.dat file compatible with this SASA module. If TYPE = TRANSFER and no DELTAGFILE is provided, the free energy values are those describing the effect of temperature, and are computed using the temperature value passed by the MD engine"); keys.add("optional","APPROACH","either approach 2 or 3. Necessary only if TYPE = TRANSFER and no DELTAGFILE is provided. If TYPE = TRANSFER and no DELTAGFILE is provided, the free energy values are those describing the effect of temperature, and the program must know if approach 2 or 3 (as described in Arsiccio and Shea, Protein Cold Denaturation in Implicit Solvent Simulations: A Transfer Free Energy Approach, J. Phys. Chem. B, 2021) needs to be used to compute them"); - keys.setValueDescription("the solvent accessible surface area (SASA) of the molecule"); + keys.setValueDescription("scalar","the solvent accessible surface area (SASA) of the molecule"); } diff --git a/src/sasa/sasa_LCPO.cpp b/src/sasa/sasa_LCPO.cpp index 094592f12e..3ec3049862 100755 --- a/src/sasa/sasa_LCPO.cpp +++ b/src/sasa/sasa_LCPO.cpp @@ -169,7 +169,7 @@ void SASA_LCPO::registerKeywords(Keywords& keys) { keys.add("compulsory", "NL_STRIDE", "The frequency with which the neighbor list is updated."); keys.add("optional","DELTAGFILE","a file containing the free energy values for backbone and sidechains. Necessary only if TYPE = TRANSFER. A Python script for the computation of free energy of transfer values to describe the effect of osmolyte concentration, temperature and pressure is freely available at https://github.com/andrea-arsiccio/DeltaG-calculation. The script automatically outputs a DeltaG.dat file compatible with this SASA module. If TYPE = TRANSFER and no DELTAGFILE is provided, the free energy values are those describing the effect of temperature, and are computed using the temperature value passed by the MD engine"); keys.add("optional","APPROACH","either approach 2 or 3. Necessary only if TYPE = TRANSFER and no DELTAGFILE is provided. If TYPE = TRANSFER and no DELTAGFILE is provided, the free energy values are those describing the effect of temperature, and the program must know if approach 2 or 3 (as described in Arsiccio and Shea, Protein Cold Denaturation in Implicit Solvent Simulations: A Transfer Free Energy Approach, J. Phys. Chem. B, 2021) needs to be used to compute them"); - keys.setValueDescription("the solvent accessible surface area (SASA) of the molecule"); + keys.setValueDescription("scalar","the solvent accessible surface area (SASA) of the molecule"); } diff --git a/src/secondarystructure/AlphaRMSD.cpp b/src/secondarystructure/AlphaRMSD.cpp index b0286a967d..c87c4f1926 100644 --- a/src/secondarystructure/AlphaRMSD.cpp +++ b/src/secondarystructure/AlphaRMSD.cpp @@ -95,6 +95,7 @@ PLUMED_REGISTER_ACTION(AlphaRMSD,"ALPHARMSD") void AlphaRMSD::registerKeywords( Keywords& keys ) { SecondaryStructureRMSD::registerKeywords( keys ); + keys.setValueDescription("scalar/vector","if LESS_THAN is present the RMSD distance between each residue and the ideal alpha helix. If LESS_THAN is not present the number of residue segments where the structure is similar to an alpha helix"); keys.remove("ATOMS"); keys.remove("SEGMENT"); keys.remove("BONDLENGTH"); keys.remove("CUTOFF_ATOMS"); keys.remove("NO_ACTION_LOG"); keys.remove("STRANDS_CUTOFF"); keys.remove("STRUCTURE"); } diff --git a/src/secondarystructure/AntibetaRMSD.cpp b/src/secondarystructure/AntibetaRMSD.cpp index 3ed1d4d0ef..8e60eb0462 100644 --- a/src/secondarystructure/AntibetaRMSD.cpp +++ b/src/secondarystructure/AntibetaRMSD.cpp @@ -96,6 +96,7 @@ PLUMED_REGISTER_ACTION(AntibetaRMSD,"ANTIBETARMSD") void AntibetaRMSD::registerKeywords( Keywords& keys ) { SecondaryStructureRMSD::registerKeywords( keys ); + keys.setValueDescription("scalar/vector","if LESS_THAN is present the RMSD distance between each residue and the ideal antiparallel beta sheet. If LESS_THAN is not present the number of residue segments where the structure is similar to an anti parallel beta sheet"); keys.remove("ATOMS"); keys.remove("SEGMENT"); keys.remove("BONDLENGTH"); keys.remove("NO_ACTION_LOG"); keys.remove("CUTOFF_ATOMS"); keys.remove("STRUCTURE"); keys.add("compulsory","STYLE","all","Antiparallel beta sheets can either form in a single chain or from a pair of chains. If STYLE=all all " diff --git a/src/secondarystructure/ParabetaRMSD.cpp b/src/secondarystructure/ParabetaRMSD.cpp index cb2a35a786..7d9a5b52e3 100644 --- a/src/secondarystructure/ParabetaRMSD.cpp +++ b/src/secondarystructure/ParabetaRMSD.cpp @@ -97,6 +97,7 @@ PLUMED_REGISTER_ACTION(ParabetaRMSD,"PARABETARMSD") void ParabetaRMSD::registerKeywords( Keywords& keys ) { SecondaryStructureRMSD::registerKeywords( keys ); + keys.setValueDescription("scalar/vector","if LESS_THAN is present the RMSD distance between each residue and the ideal parallel beta sheet. If LESS_THAN is not present the number of residue segments where the structure is similar to a parallel beta sheet"); keys.remove("ATOMS"); keys.remove("SEGMENT"); keys.remove("BONDLENGTH"); keys.remove("NO_ACTION_LOG"); keys.remove("CUTOFF_ATOMS"); keys.remove("STRUCTURE"); keys.add("compulsory","STYLE","all","Parallel beta sheets can either form in a single chain or from a pair of chains. If STYLE=all all " diff --git a/src/secondarystructure/SecondaryStructureRMSD.cpp b/src/secondarystructure/SecondaryStructureRMSD.cpp index 5265cf2a27..5cbbd81624 100644 --- a/src/secondarystructure/SecondaryStructureRMSD.cpp +++ b/src/secondarystructure/SecondaryStructureRMSD.cpp @@ -88,8 +88,9 @@ void SecondaryStructureRMSD::registerKeywords( Keywords& keys ) { keys.add("compulsory","NN","8","The n parameter of the switching function"); keys.add("compulsory","MM","12","The m parameter of the switching function"); keys.add("hidden","NO_ACTION_LOG","suppresses printing from action on the log"); - keys.addOutputComponent("struct","default","the vectors containing the rmsd distances between the residues and each of the reference structures"); - keys.addOutputComponent("lessthan","default","the number blocks of residues that have an RMSD from the secondary structure that is less than the threshold"); + keys.setValueDescription("vector","a vector containing the rmsd distance between each of the residue segments and the reference structure"); + keys.addOutputComponent("struct","default","vector","the vectors containing the rmsd distances between the residues and each of the reference structures"); + keys.addOutputComponent("lessthan","default","scalar","the number blocks of residues that have an RMSD from the secondary structure that is less than the threshold"); keys.needsAction("SECONDARY_STRUCTURE_RMSD"); keys.needsAction("LESS_THAN"); keys.needsAction("SUM"); } diff --git a/src/sizeshape/mahadist.cpp b/src/sizeshape/mahadist.cpp index 67ac27914f..40d96d83ff 100644 --- a/src/sizeshape/mahadist.cpp +++ b/src/sizeshape/mahadist.cpp @@ -93,7 +93,7 @@ void position_maha_dist::registerKeywords( Keywords& keys ) { keys.add("compulsory", "REFERENCE", "Reference structure."); keys.add("atoms","GROUP","The group of atoms being used"); keys.addFlag("SQUARED",false,"Returns the square of distance."); - keys.setValueDescription("the Mahalanobis distance between the instantaneous configuration and a given reference distribution in size-and-shape space"); + keys.setValueDescription("scalar","the Mahalanobis distance between the instantaneous configuration and a given reference distribution in size-and-shape space"); } // constructor function diff --git a/src/sizeshape/pos_proj.cpp b/src/sizeshape/pos_proj.cpp index 2aa0ae44cf..55089bd3a6 100644 --- a/src/sizeshape/pos_proj.cpp +++ b/src/sizeshape/pos_proj.cpp @@ -106,7 +106,7 @@ void position_linear_proj::registerKeywords( Keywords& keys ) { keys.add("atoms","GROUP","Group of atoms being used"); keys.add("compulsory", "COEFFS", "Vector of linear coefficients."); keys.addFlag("SERIAL",false,"Perform the calculation in serial, for debug purposes only."); - keys.setValueDescription("the linear projection"); + keys.setValueDescription("scalar","the linear projection"); } // constructor function diff --git a/src/sprint/Sprint.cpp b/src/sprint/Sprint.cpp index 89d01e5f1b..3ba8096c3b 100644 --- a/src/sprint/Sprint.cpp +++ b/src/sprint/Sprint.cpp @@ -96,7 +96,7 @@ void Sprint::registerKeywords(Keywords& keys) { keys.add("numbered","SWITCH","specify the switching function to use between two sets of indistinguishable atoms"); keys.needsAction("CONTACT_MATRIX"); keys.needsAction("DIAGONALIZE"); keys.needsAction("CUSTOM"); keys.needsAction("SELECT_COMPONENTS"); keys.needsAction("SORT"); keys.needsAction("COMBINE"); - keys.addOutputComponent("coord","default","the sprint coordinates"); + keys.addOutputComponent("coord","default","scalar","the sprint coordinates"); } Sprint::Sprint(const ActionOptions& ao): diff --git a/src/symfunc/AngularTetra.cpp b/src/symfunc/AngularTetra.cpp index d326b7ccc7..35fcd1dea6 100644 --- a/src/symfunc/AngularTetra.cpp +++ b/src/symfunc/AngularTetra.cpp @@ -48,6 +48,7 @@ void AngularTetra::registerKeywords( Keywords& keys ) { CoordinationNumbers::shortcutKeywords( keys ); keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances"); keys.add("compulsory","CUTOFF","-1","ignore distances that have a value larger than this cutoff"); + keys.setValueDescription("vector","the value of the angular tetehedrality parameter for each of the input atoms"); keys.remove("NN"); keys.remove("MM"); keys.remove("D_0"); keys.remove("R_0"); keys.remove("SWITCH"); keys.needsAction("DISTANCE_MATRIX"); keys.needsAction("NEIGHBORS"); keys.needsAction("GSYMFUNC_THREEBODY"); keys.needsAction("CUSTOM"); diff --git a/src/symfunc/CoordShellVectorFunction.cpp b/src/symfunc/CoordShellVectorFunction.cpp index 8c0d92ef6c..e8029af0b6 100644 --- a/src/symfunc/CoordShellVectorFunction.cpp +++ b/src/symfunc/CoordShellVectorFunction.cpp @@ -152,6 +152,7 @@ void CoordShellVectorFunction::registerKeywords( Keywords& keys ) { keys.add("compulsory","PSI","0.0","The Euler rotational angle psi"); keys.add("compulsory","ALPHA","3.0","The alpha parameter of the angular function that is used for FCCUBIC"); keys.addFlag("LOWMEM",false,"this flag does nothing and is present only to ensure back-compatibility"); + keys.setValueDescription("vector","the symmetry function for each of the specified atoms"); keys.needsAction("CONTACT_MATRIX"); keys.needsAction("FCCUBIC_FUNC"); keys.needsAction("CUSTOM"); keys.needsAction("ONES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); } diff --git a/src/symfunc/CoordinationNumbers.cpp b/src/symfunc/CoordinationNumbers.cpp index 39271e71e2..9e54c9ef08 100644 --- a/src/symfunc/CoordinationNumbers.cpp +++ b/src/symfunc/CoordinationNumbers.cpp @@ -145,8 +145,9 @@ void CoordinationNumbers::registerKeywords( Keywords& keys ) { keys.add("compulsory","R_POWER","the power to which you want to raise the distance"); keys.addFlag("LOWMEM",false,"this flag does nothing and is present only to ensure back-compatibility"); keys.add("optional","MOMENTS","the list of moments that you would like to calculate"); - keys.addOutputComponent("moment","MOMENTS","the moments of the distribution"); + keys.addOutputComponent("moment","MOMENTS","scalar","the moments of the distribution"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("ONES"); keys.needsAction("MOMENTS"); + keys.setValueDescription("vector","the coordination numbers of the specified atoms"); } CoordinationNumbers::CoordinationNumbers(const ActionOptions& ao): diff --git a/src/symfunc/CylindricalHarmonic.cpp b/src/symfunc/CylindricalHarmonic.cpp index 727f4cbcc6..737dd9e058 100644 --- a/src/symfunc/CylindricalHarmonic.cpp +++ b/src/symfunc/CylindricalHarmonic.cpp @@ -67,8 +67,8 @@ PLUMED_REGISTER_ACTION(MatrixCyHarm,"CYLINDRICAL_HARMONIC_MATRIX") void CylindricalHarmonic::registerKeywords( Keywords& keys ) { keys.add("compulsory","DEGREE","the value of the n parameter in the equation above"); - keys.addOutputComponent("rm","default","the real part of the cylindrical harmonic"); - keys.addOutputComponent("im","default","the imaginary part of the cylindrical harmonic"); + keys.addOutputComponent("rm","default","matrix","the real part of the cylindrical harmonic"); + keys.addOutputComponent("im","default","matrix","the imaginary part of the cylindrical harmonic"); } void CylindricalHarmonic::read( ActionWithArguments* action ) { diff --git a/src/symfunc/Fccubic.cpp b/src/symfunc/Fccubic.cpp index b680e62a8d..a3c2b08993 100644 --- a/src/symfunc/Fccubic.cpp +++ b/src/symfunc/Fccubic.cpp @@ -105,7 +105,7 @@ PLUMED_REGISTER_ACTION(MatrixFccubic,"FCCUBIC_FUNC_MATRIX") void Fccubic::registerKeywords( Keywords& keys ) { keys.add("compulsory","ALPHA","3.0","The alpha parameter of the angular function"); - keys.setValueDescription("a function that measures the similarity with an fcc environment"); + keys.setValueDescription("matrix","a function that measures the similarity with an fcc environment"); } void Fccubic::read( ActionWithArguments* action ) { diff --git a/src/symfunc/HexaticParameter.cpp b/src/symfunc/HexaticParameter.cpp index 904e4d4d8f..32716b1202 100644 --- a/src/symfunc/HexaticParameter.cpp +++ b/src/symfunc/HexaticParameter.cpp @@ -58,10 +58,11 @@ PLUMED_REGISTER_ACTION(HexacticParameter,"HEXACTIC_PARAMETER") void HexacticParameter::registerKeywords( Keywords& keys ) { CoordinationNumbers::shortcutKeywords( keys ); keys.add("compulsory","PLANE","the plane to use when calculating the value of the order parameter should be xy, xz or yz"); + keys.setValueDescription("matrix","the value of the cylindrical harmonic for each bond vector specified"); keys.addFlag("VMEAN",false,"calculate the norm of the mean vector."); - keys.addOutputComponent("_vmean","VMEAN","the norm of the mean vector"); + keys.addOutputComponent("_vmean","VMEAN","scalar","the norm of the mean vector"); keys.addFlag("VSUM",false,"calculate the norm of the sum of all the vectors"); - keys.addOutputComponent("_vsum","VSUM","the norm of the mean vector"); + keys.addOutputComponent("_vsum","VSUM","scalar","the norm of the mean vector"); keys.needsAction("CYLINDRICAL_HARMONIC_MATRIX"); keys.needsAction("ONES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("CUSTOM"); keys.needsAction("MEAN"); keys.needsAction("SUM"); keys.needsAction("COMBINE"); diff --git a/src/symfunc/LocalAverage.cpp b/src/symfunc/LocalAverage.cpp index 6c52ff3f4e..f97ad199d7 100644 --- a/src/symfunc/LocalAverage.cpp +++ b/src/symfunc/LocalAverage.cpp @@ -100,6 +100,7 @@ void LocalAverage::registerKeywords( Keywords& keys ) { CoordinationNumbers::shortcutKeywords( keys ); keys.needsAction("ONES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("VSTACK"); keys.needsAction("CUSTOM"); keys.needsAction("OUTER_PRODUCT"); + keys.setValueDescription("vector","the values of the local averages"); } LocalAverage::LocalAverage(const ActionOptions&ao): diff --git a/src/symfunc/LocalCrystalinity.cpp b/src/symfunc/LocalCrystalinity.cpp index a06d7b6433..e910481c24 100644 --- a/src/symfunc/LocalCrystalinity.cpp +++ b/src/symfunc/LocalCrystalinity.cpp @@ -54,6 +54,7 @@ PLUMED_REGISTER_ACTION(LocalCrystallinity,"LOCAL_CRYSTALINITY") void LocalCrystallinity::registerKeywords( Keywords& keys ) { CoordinationNumbers::shortcutKeywords( keys ); keys.add("numbered","GVECTOR","the coefficients of the linear combinations to compute for the CV"); + keys.setValueDescription("vector","the value of the local crystalinity for each of the input atoms"); keys.needsAction("ONES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); } diff --git a/src/symfunc/LocalSteinhardt.cpp b/src/symfunc/LocalSteinhardt.cpp index 06e1800eb3..643f07871d 100644 --- a/src/symfunc/LocalSteinhardt.cpp +++ b/src/symfunc/LocalSteinhardt.cpp @@ -292,6 +292,7 @@ void LocalSteinhardt::registerKeywords( Keywords& keys ) { "The following provides information on the \\ref switchingfunction that are available. " "When this keyword is present you no longer need the NN, MM, D_0 and R_0 keywords."); keys.addFlag("LOWMEM",false,"this flag does nothing and is present only to ensure back-compatibility"); + keys.setValueDescription("vector","the values of the local steinhardt parameters for the input atoms"); multicolvar::MultiColvarShortcuts::shortcutKeywords( keys ); keys.needsAction("CONTACT_MATRIX"); keys.needsAction("MATRIX_PRODUCT"); keys.needsAction("GROUP"); keys.needsAction("ONES"); keys.needsAction("OUTER_PRODUCT"); keys.needsAction("VSTACK"); diff --git a/src/symfunc/RadialTetra.cpp b/src/symfunc/RadialTetra.cpp index 8b7b386474..01798963a9 100644 --- a/src/symfunc/RadialTetra.cpp +++ b/src/symfunc/RadialTetra.cpp @@ -51,6 +51,7 @@ void RadialTetra::registerKeywords( Keywords& keys ) { CoordinationNumbers::shortcutKeywords( keys ); keys.addFlag("NOPBC",false,"ignore the periodic boundary conditions when calculating distances"); keys.add("compulsory","CUTOFF","-1","ignore distances that have a value larger than this cutoff"); + keys.setValueDescription("vector","the value of the radial tetrahedrality parameter for each of the input atoms"); keys.remove("NN"); keys.remove("MM"); keys.remove("D_0"); keys.remove("R_0"); keys.remove("SWITCH"); keys.needsAction("DISTANCE_MATRIX"); keys.needsAction("NEIGHBORS"); keys.needsAction("CUSTOM"); keys.needsAction("ONES"); diff --git a/src/symfunc/SMAC.cpp b/src/symfunc/SMAC.cpp index f988afffb5..1fd6632a12 100644 --- a/src/symfunc/SMAC.cpp +++ b/src/symfunc/SMAC.cpp @@ -58,6 +58,7 @@ void SMAC::registerKeywords(Keywords& keys) { keys.add("numbered","KERNEL","The kernels used in the function of the angle"); keys.add("optional","SWITCH_COORD","This keyword is used to define the coordination switching function."); keys.reset_style("KERNEL","optional"); + keys.setValueDescription("vector","the value of the smac parameter for each of the input molecules"); multicolvar::MultiColvarShortcuts::shortcutKeywords( keys ); keys.needsAction("VSTACK"); keys.needsAction("TRANSPOSE"); keys.needsAction("CONTACT_MATRIX"); keys.needsAction("TORSIONS_MATRIX"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); diff --git a/src/symfunc/SphericalHarmonic.cpp b/src/symfunc/SphericalHarmonic.cpp index 019ca7a12e..8e1c60ed7a 100644 --- a/src/symfunc/SphericalHarmonic.cpp +++ b/src/symfunc/SphericalHarmonic.cpp @@ -72,8 +72,8 @@ PLUMED_REGISTER_ACTION(MatrixSpHarm,"SPHERICAL_HARMONIC_MATRIX") void SphericalHarmonic::registerKeywords( Keywords& keys ) { keys.add("compulsory","L","the value of the angular momentum"); - keys.addOutputComponent("rm","default","the real parts of the spherical harmonic values with the m value given"); - keys.addOutputComponent("im","default","the real parts of the spherical harmonic values with the m value given"); + keys.addOutputComponent("rm","default","matrix","the real parts of the spherical harmonic values with the m value given"); + keys.addOutputComponent("im","default","matrix","the real parts of the spherical harmonic values with the m value given"); } unsigned SphericalHarmonic::factorial( const unsigned& n ) const { diff --git a/src/symfunc/Steinhardt.cpp b/src/symfunc/Steinhardt.cpp index 3366a0f634..85b36c5abd 100644 --- a/src/symfunc/Steinhardt.cpp +++ b/src/symfunc/Steinhardt.cpp @@ -281,11 +281,12 @@ void Steinhardt::registerKeywords( Keywords& keys ) { CoordinationNumbers::shortcutKeywords( keys ); keys.addFlag("LOWMEM",false,"this flag does nothing and is present only to ensure back-compatibility"); keys.addFlag("VMEAN",false,"calculate the norm of the mean vector."); - keys.addOutputComponent("_vmean","VMEAN","the norm of the mean vector"); + keys.addOutputComponent("_vmean","VMEAN","scalar","the norm of the mean vector"); keys.addFlag("VSUM",false,"calculate the norm of the sum of all the vectors"); - keys.addOutputComponent("_vsum","VSUM","the norm of the mean vector"); + keys.addOutputComponent("_vsum","VSUM","scalar","the norm of the mean vector"); keys.needsAction("GROUP"); keys.needsAction("CONTACT_MATRIX"); keys.needsAction("SPHERICAL_HARMONIC"); keys.needsAction("ONES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); keys.needsAction("COMBINE"); keys.needsAction("CUSTOM"); keys.needsAction("MEAN"); keys.needsAction("SUM"); + keys.setValueDescription("vector","the norms of the vectors of spherical harmonic coefficients"); } Steinhardt::Steinhardt( const ActionOptions& ao): diff --git a/src/symfunc/ThreeBodyGFunctions.cpp b/src/symfunc/ThreeBodyGFunctions.cpp index 9f6b3f52a0..2517513f11 100644 --- a/src/symfunc/ThreeBodyGFunctions.cpp +++ b/src/symfunc/ThreeBodyGFunctions.cpp @@ -51,8 +51,9 @@ class ThreeBodyGFunctions : public ActionWithVector { PLUMED_REGISTER_ACTION(ThreeBodyGFunctions,"GSYMFUNC_THREEBODY") void ThreeBodyGFunctions::registerKeywords( Keywords& keys ) { - ActionWithVector::registerKeywords( keys ); keys.use("ARG"); - keys.add("compulsory","WEIGHT","the matrix that contains the weights that should be used for each connection"); + ActionWithVector::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","matrix","three matrices containing the bond vectors of interest"); + keys.addInputKeyword("compulsory","WEIGHT","matrix","the matrix that contains the weights that should be used for each connection"); keys.add("numbered","FUNCTION","the parameters of the function you would like to compute"); ActionWithValue::useCustomisableComponents( keys ); } diff --git a/src/tools/Keywords.cpp b/src/tools/Keywords.cpp index 1b68bf4cb4..ca9af95d6e 100644 --- a/src/tools/Keywords.cpp +++ b/src/tools/Keywords.cpp @@ -197,8 +197,18 @@ void Keywords::add( const std::string & t, const std::string & k, const std::str keys.push_back(k); } +void Keywords::addInputKeyword( const std::string & t, const std::string & k, const std::string & ttt, const std::string & d ) { + if( exists(k) ) { remove(k); argument_types[k] = ttt; } else { argument_types.insert( std::pair(k,ttt) ); } + add( t, k, d ); +} + +void Keywords::addInputKeyword( const std::string & t, const std::string & k, const std::string & ttt, const std::string& def, const std::string & d ) { + if( exists(k) ) { remove(k); argument_types[k] = ttt; } else { argument_types.insert( std::pair(k,ttt) ); } + add( t, k, def, d ); +} + void Keywords::add( const std::string & t, const std::string & k, const std::string & def, const std::string & d ) { - plumed_assert( !exists(k) && !reserved(k) && (t=="compulsory" || t=="hidden" )); // An optional keyword can't have a default + plumed_massert( !exists(k) && !reserved(k) && (t=="compulsory" || t=="hidden" ), "failing on keyword " + k ); // An optional keyword can't have a default types.insert( std::pair(k, KeyType(t)) ); documentation.insert( std::pair(k,"( default=" + def + " ) " + d) ); allowmultiple.insert( std::pair(k,false) ); @@ -595,6 +605,10 @@ void Keywords::setComponentsIntroduction( const std::string& instr ) { } void Keywords::addOutputComponent( const std::string& name, const std::string& key, const std::string& descr ) { + addOutputComponent( name, key, "scalar", descr ); +} + +void Keywords::addOutputComponent( const std::string& name, const std::string& key, const std::string& type, const std::string& descr ) { plumed_assert( !outputComponentExists(name) ); plumed_massert( name!=".#!value", name + " is reserved for storing description of value" ); plumed_massert( name.find("-")==std::string::npos,"dash is reseved character in component names" ); @@ -612,6 +626,7 @@ void Keywords::addOutputComponent( const std::string& name, const std::string& k ckey.insert( std::pair(name,key) ); cdocs.insert( std::pair(name,descr) ); + ctypes.insert( std::pair(name,type) ); cnames.push_back(name); } @@ -625,12 +640,13 @@ void Keywords::removeOutputComponent( const std::string& name ) { cdocs.erase(name); } -void Keywords::setValueDescription( const std::string& descr ) { +void Keywords::setValueDescription( const std::string& type, const std::string& descr ) { if( !outputComponentExists(".#!value") ) { ckey.insert( std::pair(".#!value","default") ); cdocs.insert( std::pair(".#!value",descr) ); + ctypes.insert( std::pair(".#!value",type) ); cnames.push_back(".#!value"); - } else cdocs[".#!value"] = descr; + } else { cdocs[".#!value"] = descr; ctypes[".#!value"] = type; } } bool Keywords::outputComponentExists( const std::string& name ) const { @@ -650,10 +666,54 @@ bool Keywords::outputComponentExists( const std::string& name ) const { return false; } +bool Keywords::componentHasCorrectType( const std::string& name, const std::size_t& rank, const bool& hasderiv ) const { + if( cstring.find("customize")!=std::string::npos ) return true; + + std::string sname; + std::size_t num=name.find_first_of("-"); + std::size_t num2=name.find_last_of("_"); + if( num2!=std::string::npos ) sname=name.substr(num2); + else if( num!=std::string::npos ) sname=name.substr(0,num); + else sname=name; + + if( thisactname=="CENTER" && ctypes.find(sname)->second=="atom" ) return true; + + if( rank==0 ) { + return (ctypes.find(sname)->second.find("scalar")!=std::string::npos); + } else if( hasderiv ) { + return (ctypes.find(sname)->second.find("grid")!=std::string::npos); + } else if( rank==1 ) { + return (ctypes.find(sname)->second.find("vector")!=std::string::npos); + } else if( rank==2 ) { + return (ctypes.find(sname)->second.find("matrix")!=std::string::npos); + } + return false; +} + +bool Keywords::checkArgumentType( const std::size_t& rank, const bool& hasderiv ) const { + for(auto const& x : argument_types ) { + if( rank==0 && x.second.find("scalar")!=std::string::npos ) return true; + if( hasderiv && x.second.find("grid")!=std::string::npos ) return true; + if( rank==1 && x.second.find("vector")!=std::string::npos ) return true; + if( rank==2 && x.second.find("matrix")!=std::string::npos ) return true; + } + plumed_merror("WARNING: type for input argument has not been specified"); + return false; +} + +std::string Keywords::getArgumentType( const std::string& name ) const { + if( argument_types.find(name)==argument_types.end() ) return ""; + return argument_types.find(name)->second; +} + std::string Keywords::getOutputComponentFlag( const std::string& name ) const { return ckey.find(name)->second; } +std::string Keywords::getOutputComponentType( const std::string& name ) const { + return ctypes.find(name)->second; +} + std::string Keywords::getOutputComponentDescription( const std::string& name ) const { std::string checkname = name; std::size_t hyp=name.find_first_of("-"); if( hyp!=std::string::npos ) checkname = name.substr(0,hyp); diff --git a/src/tools/Keywords.h b/src/tools/Keywords.h index 16c0cc60fd..efce8b38a0 100644 --- a/src/tools/Keywords.h +++ b/src/tools/Keywords.h @@ -76,6 +76,8 @@ class Keywords { std::map allowmultiple; /// The documentation for the keywords std::map documentation; +/// The type for the arguments in this action + std::map argument_types; /// The default values for the flags (are they on or of) std::map booldefs; /// The default values (if there are default values) for compulsory keywords @@ -90,6 +92,8 @@ class Keywords { std::map ckey; /// The documentation for a particular component std::map cdocs; +/// The type of a particular component + std::map ctypes; /// The list of actions that are needed by this action std::vector neededActions; /// List of suffixes that can be used with this action @@ -168,15 +172,29 @@ class Keywords { /// Set the text that introduces how the components for this action are introduced void setComponentsIntroduction( const std::string& instr ); /// Add the description of the value - void setValueDescription( const std::string& descr ); + void setValueDescription( const std::string& type, const std::string& descr ); /// Add a potential component which can be output by this particular action + [[deprecated("Use addOutputComponent with four argument and specify valid types for value from scalar/vector/matrix/grid")]] void addOutputComponent( const std::string& name, const std::string& key, const std::string& descr ); +/// Add a potential component which can be output by this particular action + void addOutputComponent( const std::string& name, const std::string& key, const std::string& type, const std::string& descr ); /// Remove a component that can be output by this particular action void removeOutputComponent( const std::string& name ); /// Has a component with this name been added? bool outputComponentExists( const std::string& name ) const ; +/// Check that type for component has been documented correctly + bool componentHasCorrectType( const std::string& name, const std::size_t& rank, const bool& hasderiv ) const ; +/// Create the documentation for a keyword that reads arguments + void addInputKeyword( const std::string & t, const std::string & k, const std::string & ttt, const std::string & d ); + void addInputKeyword( const std::string & t, const std::string & k, const std::string & ttt, const std::string& def, const std::string & d ); +/// Check the documentation of the argument types + bool checkArgumentType( const std::size_t& rank, const bool& hasderiv ) const ; +/// Get the valid types that can be used as argument for this keyword + std::string getArgumentType( const std::string& name ) const ; /// Get the flag that forces this component to be calculated std::string getOutputComponentFlag( const std::string& name ) const ; +/// Get the type for this output component + std::string getOutputComponentType( const std::string& name ) const ; /// Get the description of this component std::string getOutputComponentDescription( const std::string& name ) const ; /// Get the full list of output components diff --git a/src/valtools/Concatenate.cpp b/src/valtools/Concatenate.cpp index 8235762fdc..6bdae1fe06 100644 --- a/src/valtools/Concatenate.cpp +++ b/src/valtools/Concatenate.cpp @@ -57,9 +57,10 @@ class Concatenate : PLUMED_REGISTER_ACTION(Concatenate,"CONCATENATE") void Concatenate::registerKeywords( Keywords& keys ) { - Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); - keys.add("numbered","MATRIX","specify the matrices that you wish to join together into a single matrix"); keys.reset_style("MATRIX","compulsory"); - keys.setValueDescription("the concatenated vector/matrix that was constructed from the input values"); + Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("optional","ARG","scalar/vector","the values that should be concatenated together to form the output vector"); + keys.addInputKeyword("numbered","MATRIX","scalar/matrix","specify the matrices that you wish to join together into a single matrix"); keys.reset_style("MATRIX","compulsory"); + keys.setValueDescription("vector/matrix","the concatenated vector/matrix that was constructed from the input values"); } Concatenate::Concatenate(const ActionOptions& ao): diff --git a/src/valtools/Flatten.cpp b/src/valtools/Flatten.cpp index d1c9f488d4..07f9680d4f 100644 --- a/src/valtools/Flatten.cpp +++ b/src/valtools/Flatten.cpp @@ -55,8 +55,9 @@ PLUMED_REGISTER_ACTION(Flatten,"FLATTEN") void Flatten::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); - keys.setValueDescription("a vector containing all the elements of the input matrix"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","matrix","the label for the matrix that you would like to flatten to a vector"); + keys.setValueDescription("vector","a vector containing all the elements of the input matrix"); } Flatten::Flatten(const ActionOptions& ao): diff --git a/src/valtools/SelectComponents.cpp b/src/valtools/SelectComponents.cpp index a421ea4ae0..6a17f2353a 100644 --- a/src/valtools/SelectComponents.cpp +++ b/src/valtools/SelectComponents.cpp @@ -48,10 +48,10 @@ PLUMED_REGISTER_ACTION(SelectComponents,"SELECT_COMPONENTS") void SelectComponents::registerKeywords( Keywords& keys ) { ActionShortcut::registerKeywords( keys ); - keys.add("compulsory","ARG","the argument we are using to build the shortcut"); + keys.addInputKeyword("compulsory","ARG","vector/matrix","the value from which we are selecting components"); keys.add("compulsory","COMPONENTS","the components in the input value that you woul like to build a new vector from"); keys.needsAction("FLATTEN"); keys.needsAction("CONSTANT"); keys.needsAction("SELECT_WITH_MASK"); - keys.setValueDescription("a vector containing the selected components"); + keys.setValueDescription("vector","a vector containing the selected components"); } SelectComponents::SelectComponents(const ActionOptions& ao): diff --git a/src/valtools/SelectWithMask.cpp b/src/valtools/SelectWithMask.cpp index ac480f15b7..83791be848 100644 --- a/src/valtools/SelectWithMask.cpp +++ b/src/valtools/SelectWithMask.cpp @@ -62,11 +62,12 @@ PLUMED_REGISTER_ACTION(SelectWithMask,"SELECT_WITH_MASK") void SelectWithMask::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.use("ARG"); - keys.add("optional","ROW_MASK","an array with ones in the rows of the matrix that you want to discard"); - keys.add("optional","COLUMN_MASK","an array with ones in the columns of the matrix that you want to discard"); - keys.add("compulsory","MASK","an array with ones in the components that you want to discard"); - keys.setValueDescription("a vector/matrix of values that is obtained using a mask to select elements of interest"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","scalar/vector/matrix","the label for the value upon which you are going to apply the mask"); + keys.addInputKeyword("optional","ROW_MASK","vector","an array with ones in the rows of the matrix that you want to discard"); + keys.addInputKeyword("optional","COLUMN_MASK","vector","an array with ones in the columns of the matrix that you want to discard"); + keys.addInputKeyword("compulsory","MASK","vector/matrix","an array with ones in the components that you want to discard"); + keys.setValueDescription("vector/matrix","a vector/matrix of values that is obtained using a mask to select elements of interest"); } SelectWithMask::SelectWithMask(const ActionOptions& ao): diff --git a/src/valtools/VStack.cpp b/src/valtools/VStack.cpp index 209e817e93..39c09556c7 100644 --- a/src/valtools/VStack.cpp +++ b/src/valtools/VStack.cpp @@ -60,8 +60,9 @@ class VStack : public ActionWithMatrix { PLUMED_REGISTER_ACTION(VStack,"VSTACK") void VStack::registerKeywords( Keywords& keys ) { - ActionWithMatrix::registerKeywords( keys ); keys.use("ARG"); - keys.setValueDescription("a matrix that contains the input vectors in its columns"); + ActionWithMatrix::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","scalar/vector","the values that you would like to stack together to construct the output matrix"); + keys.setValueDescription("matrix","a matrix that contains the input vectors in its columns"); } VStack::VStack(const ActionOptions& ao): diff --git a/src/vatom/ArgsToVatom.cpp b/src/vatom/ArgsToVatom.cpp index da8147730e..8b0087bd02 100644 --- a/src/vatom/ArgsToVatom.cpp +++ b/src/vatom/ArgsToVatom.cpp @@ -61,20 +61,20 @@ PLUMED_REGISTER_ACTION(ArgsToVatom,"ARGS2VATOM") void ArgsToVatom::registerKeywords( Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); ActionWithArguments::registerKeywords( keys ); - keys.add("compulsory","XPOS","the x position of the atom"); - keys.add("compulsory","YPOS","the y position of the atom"); - keys.add("compulsory","ZPOS","the z position of the atom"); - keys.add("compulsory","MASS","the mass of the atom"); - keys.add("compulsory","CHARGE","the charge of the atom"); - keys.add("hidden","XBKP","x position to use in case PBC not set when using PHASES"); - keys.add("hidden","YBKP","y position to use in case PBC not set when using PHASES"); - keys.add("hidden","ZBKP","z position to use in case PBC not set when using PHASES"); + keys.addInputKeyword("compulsory","XPOS","scalar","the value to use for the x position of the atom"); + keys.addInputKeyword("compulsory","YPOS","scalar","the value to use for the y position of the atom"); + keys.addInputKeyword("compulsory","ZPOS","scalar","the value to use for the z position of the atom"); + keys.addInputKeyword("compulsory","MASS","scalar","the value to use for the mass of the atom"); + keys.addInputKeyword("compulsory","CHARGE","scalar","the value to use for the charge of the atom"); + keys.addInputKeyword("hidden","XBKP","scalar","x position to use in case PBC not set when using PHASES"); + keys.addInputKeyword("hidden","YBKP","scalar","y position to use in case PBC not set when using PHASES"); + keys.addInputKeyword("hidden","ZBKP","scalar","z position to use in case PBC not set when using PHASES"); keys.addFlag("FRACTIONAL",false,"the input arguments are calculated in fractional coordinates so you need to multiply by the cell"); - keys.addOutputComponent("x","default","the x coordinate of the virtual atom"); - keys.addOutputComponent("y","default","the y coordinate of the virtual atom"); - keys.addOutputComponent("z","default","the z coordinate of the virtual atom"); - keys.addOutputComponent("mass","default","the mass of the virtual atom"); - keys.addOutputComponent("charge","default","the charge of the virtual atom"); + keys.addOutputComponent("x","default","scalar","the x coordinate of the virtual atom"); + keys.addOutputComponent("y","default","scalar","the y coordinate of the virtual atom"); + keys.addOutputComponent("z","default","scalar","the z coordinate of the virtual atom"); + keys.addOutputComponent("mass","default","scalar","the mass of the virtual atom"); + keys.addOutputComponent("charge","default","scalar","the charge of the virtual atom"); } ArgsToVatom::ArgsToVatom(const ActionOptions& ao): diff --git a/src/vatom/CenterShortcut.cpp b/src/vatom/CenterShortcut.cpp index 169fe5048d..013e878567 100644 --- a/src/vatom/CenterShortcut.cpp +++ b/src/vatom/CenterShortcut.cpp @@ -45,7 +45,7 @@ void CenterShortcut::registerKeywords( Keywords& keys ) { keys.addFlag("SAFE_PHASES",false,"use trignomentric phases when computing position of center but also compute the center in ths usual way and use this when the pbc are not set. " "There are two reasons for using this option (1) you are doing something that you know is really weird or (2) you are an idiot"); keys.addFlag("MASS",false,"calculate the center of mass"); keys.addActionNameSuffix("_FAST"); - keys.setValueDescription("the position of the center of mass"); + keys.setValueDescription("atom","the position of the center of mass"); keys.needsAction("MASS"); keys.needsAction("SUM"); keys.needsAction("CHARGE"); keys.needsAction("CONSTANT"); keys.needsAction("CUSTOM"); keys.needsAction("POSITION"); keys.needsAction("ARGS2VATOM"); } diff --git a/src/ves/Optimizer.cpp b/src/ves/Optimizer.cpp index a34c62fa26..0a2f91f4a6 100644 --- a/src/ves/Optimizer.cpp +++ b/src/ves/Optimizer.cpp @@ -849,10 +849,10 @@ void Optimizer::registerKeywords( Keywords& keys ) { keys.use("UPDATE_FROM"); keys.use("UPDATE_UNTIL"); // Components that are always active - keys.addOutputComponent("gradrms","MONITOR_INSTANTANEOUS_GRADIENT","the root mean square value of the coefficient gradient. For multiple biases this component is labeled using the number of the bias as gradrms-#."); - keys.addOutputComponent("gradmax","MONITOR_INSTANTANEOUS_GRADIENT","the largest absolute value of the coefficient gradient. For multiple biases this component is labeled using the number of the bias as gradmax-#."); + keys.addOutputComponent("gradrms","MONITOR_INSTANTANEOUS_GRADIENT","scalar","the root mean square value of the coefficient gradient. For multiple biases this component is labeled using the number of the bias as gradrms-#."); + keys.addOutputComponent("gradmax","MONITOR_INSTANTANEOUS_GRADIENT","scalar","the largest absolute value of the coefficient gradient. For multiple biases this component is labeled using the number of the bias as gradmax-#."); // keys.addOutputComponent("gradmaxidx","default","the index of the maximum absolute value of the gradient"); - keys.setValueDescription("a scalar"); + keys.setValueDescription("scalar","a scalar"); } @@ -876,7 +876,7 @@ void Optimizer::useFixedStepSizeKeywords(Keywords& keys) { void Optimizer::useDynamicStepSizeKeywords(Keywords& keys) { keys.use("INITIAL_STEPSIZE"); - keys.addOutputComponent("stepsize","default","the current value of step size used to update the coefficients. For multiple biases this component is labeled using the number of the bias as stepsize-#."); + keys.addOutputComponent("stepsize","default","scalar","the current value of step size used to update the coefficients. For multiple biases this component is labeled using the number of the bias as stepsize-#."); } @@ -894,8 +894,8 @@ void Optimizer::useRestartKeywords(Keywords& keys) { void Optimizer::useMonitorAverageGradientKeywords(Keywords& keys) { keys.use("MONITOR_AVERAGE_GRADIENT"); keys.use("MONITOR_AVERAGES_GRADIENT_EXP_DECAY"); - keys.addOutputComponent("avergradrms","MONITOR_AVERAGE_GRADIENT","the root mean square value of the averaged coefficient gradient. For multiple biases this component is labeled using the number of the bias as gradrms-#."); - keys.addOutputComponent("avergradmax","MONITOR_AVERAGE_GRADIENT","the largest absolute value of the averaged coefficient gradient. For multiple biases this component is labeled using the number of the bias as gradmax-#."); + keys.addOutputComponent("avergradrms","MONITOR_AVERAGE_GRADIENT","scalar","the root mean square value of the averaged coefficient gradient. For multiple biases this component is labeled using the number of the bias as gradrms-#."); + keys.addOutputComponent("avergradmax","MONITOR_AVERAGE_GRADIENT","scalar","the largest absolute value of the averaged coefficient gradient. For multiple biases this component is labeled using the number of the bias as gradmax-#."); } diff --git a/src/ves/VesBias.cpp b/src/ves/VesBias.cpp index dfa8b7eb0b..4acf57f41d 100644 --- a/src/ves/VesBias.cpp +++ b/src/ves/VesBias.cpp @@ -304,7 +304,7 @@ void VesBias::useProjectionArgKeywords(Keywords& keys) { void VesBias::useReweightFactorKeywords(Keywords& keys) { keys.use("CALC_REWEIGHT_FACTOR"); - keys.addOutputComponent("rct","CALC_REWEIGHT_FACTOR","the reweight factor c(t)."); + keys.addOutputComponent("rct","CALC_REWEIGHT_FACTOR","scalar","the reweight factor c(t)."); } diff --git a/src/ves/VesDeltaF.cpp b/src/ves/VesDeltaF.cpp index b5b19be940..d878d27854 100644 --- a/src/ves/VesDeltaF.cpp +++ b/src/ves/VesDeltaF.cpp @@ -180,7 +180,6 @@ PLUMED_REGISTER_ACTION(VesDeltaF,"VES_DELTA_F") void VesDeltaF::registerKeywords(Keywords& keys) { Bias::registerKeywords(keys); - keys.use("ARG"); keys.add("optional","TEMP","temperature is compulsory, but it can be sometimes fetched from the MD engine"); //local free energies keys.add("numbered","FILE_F","names of files containing local free energies and derivatives. " @@ -210,8 +209,8 @@ void VesDeltaF::registerKeywords(Keywords& keys) { keys.use("RESTART"); //output components - keys.addOutputComponent("rct","default","the reweighting factor c(t)"); - keys.addOutputComponent("work","default","the work done by the bias in one AV_STRIDE"); + keys.addOutputComponent("rct","default","scalar","the reweighting factor c(t)"); + keys.addOutputComponent("work","default","scalar","the work done by the bias in one AV_STRIDE"); } VesDeltaF::VesDeltaF(const ActionOptions&ao) diff --git a/src/ves/VesLinearExpansion.cpp b/src/ves/VesLinearExpansion.cpp index 2d237ad6f0..8f1ce7f2c1 100644 --- a/src/ves/VesLinearExpansion.cpp +++ b/src/ves/VesLinearExpansion.cpp @@ -328,9 +328,8 @@ void VesLinearExpansion::registerKeywords( Keywords& keys ) { VesBias::useGridBinKeywords(keys); VesBias::useProjectionArgKeywords(keys); // - keys.use("ARG"); keys.add("compulsory","BASIS_FUNCTIONS","the label of the one dimensional basis functions that should be used."); - keys.addOutputComponent("force2","default","the instantaneous value of the squared force due to this bias potential."); + keys.addOutputComponent("force2","default","scalar","the instantaneous value of the squared force due to this bias potential."); } VesLinearExpansion::VesLinearExpansion(const ActionOptions&ao): diff --git a/src/volumes/ActionVolume.cpp b/src/volumes/ActionVolume.cpp index 9d2e955edf..5c9b336579 100644 --- a/src/volumes/ActionVolume.cpp +++ b/src/volumes/ActionVolume.cpp @@ -32,7 +32,7 @@ void ActionVolume::registerKeywords( Keywords& keys ) { keys.add("compulsory","SIGMA","the width of the function to be used for kernel density estimation"); keys.add("compulsory","KERNEL","gaussian","the type of kernel function to be used"); keys.addFlag("OUTSIDE",false,"calculate quantities for colvars that are on atoms outside the region of interest"); - keys.setValueDescription("vector of numbers between 0 and 1 that measure the degree to which each atom is within the volume of interest"); + keys.setValueDescription("scalar/vector","vector of numbers between 0 and 1 that measure the degree to which each atom is within the volume of interest"); } ActionVolume::ActionVolume(const ActionOptions&ao): diff --git a/src/volumes/Density.cpp b/src/volumes/Density.cpp index bb6da9248b..4de900c503 100644 --- a/src/volumes/Density.cpp +++ b/src/volumes/Density.cpp @@ -48,7 +48,7 @@ PLUMED_REGISTER_ACTION(Density,"DENSITY") void Density::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); keys.add("compulsory","SPECIES","the atoms in the group"); - keys.setValueDescription("indices for the specified group of atoms"); + keys.setValueDescription("atoms","indices for the specified group of atoms"); keys.needsAction("ONES"); keys.needsAction("GROUP"); } diff --git a/src/volumes/VolumeShortcut.h b/src/volumes/VolumeShortcut.h index 2bf207d7e8..1ad9801052 100644 --- a/src/volumes/VolumeShortcut.h +++ b/src/volumes/VolumeShortcut.h @@ -44,17 +44,18 @@ void VolumeShortcut::registerKeywords( Keywords& keys ) { keys.add("hidden","IS_SHORTCUT","hidden keyword to tell if actions are shortcuts so that example generator can provide expansions of shortcuts"); keys.add("optional","DATA","the label of an action that calculates multicolvars. Weighted sums based on the location of the colvars calculated by this action will be calcualted"); keys.add("optional","LESS_THAN","calcualte the number of colvars that are inside the region of interest and that are less than a certain threshold"); - keys.addOutputComponent("lessthan","LESS_THAN","the number of cvs in the region of interest that are less than a certain threshold"); + keys.addOutputComponent("lessthan","LESS_THAN","scalar","the number of cvs in the region of interest that are less than a certain threshold"); keys.add("optional","MORE_THAN","calcualte the number of colvars that are inside the region of interest and that are greater that a certain threshold"); - keys.addOutputComponent("morethan","MORE_THAN","the number of cvs in the region of interest that are more than a certain threshold"); + keys.addOutputComponent("morethan","MORE_THAN","scalar","the number of cvs in the region of interest that are more than a certain threshold"); keys.add("optional","BETWEEN","calculate the number of colvars that are inside the region of interest and that have a CV value that is between a particular set of bounds"); - keys.addOutputComponent("between","BETWEEN","the number of cvs in the region of interest that are within a certain range"); + keys.addOutputComponent("between","BETWEEN","scalar","the number of cvs in the region of interest that are within a certain range"); keys.addFlag("SUM",false,"calculate the sum of all the quantities."); - keys.addOutputComponent("sum","SUM","the sum of all the colvars weighted by the function that determines if we are in the region"); + keys.addOutputComponent("sum","SUM","scalar","the sum of all the colvars weighted by the function that determines if we are in the region"); keys.addFlag("MEAN",false,"calculate the average value of the colvar inside the region of interest"); - keys.addOutputComponent("mean","MEAN","the average values of the colvar in the region of interest"); + keys.addOutputComponent("mean","MEAN","scalar","the average values of the colvar in the region of interest"); keys.addActionNameSuffix("_CALC"); keys.needsAction("LESS_THAN"); keys.needsAction("MORE_THAN"); keys.needsAction("GROUP"); keys.needsAction("BETWEEN"); keys.needsAction("SUM"); keys.needsAction("MEAN"); keys.needsAction("CUSTOM"); + keys.setValueDescription("scalar","sum of values of input CVs in regin of interest"); } template diff --git a/src/wham/Wham.cpp b/src/wham/Wham.cpp index 9ec43b7e50..62396f450b 100644 --- a/src/wham/Wham.cpp +++ b/src/wham/Wham.cpp @@ -96,13 +96,13 @@ PLUMED_REGISTER_ACTION(Wham,"WHAM") void Wham::registerKeywords(Keywords& keys ) { Action::registerKeywords( keys ); ActionWithValue::registerKeywords( keys ); - ActionWithArguments::registerKeywords( keys ); keys.remove("ARG"); - keys.add("compulsory","ARG","the stored values for the bias"); + ActionWithArguments::registerKeywords( keys ); + keys.addInputKeyword("compulsory","ARG","scalar/vector/matrix","the stored values for the bias"); keys.add("compulsory","MAXITER","1000","maximum number of iterations for WHAM algorithm"); keys.add("compulsory","WHAMTOL","1e-10","threshold for convergence of WHAM algorithm"); keys.add("optional","TEMP","the system temperature. This is not required if your MD code passes this quantity to PLUMED"); keys.remove("NUMERICAL_DERIVATIVES"); - keys.setValueDescription("the vector of WHAM weights to use for reweighting the elements in a time series"); + keys.setValueDescription("vector","the vector of WHAM weights to use for reweighting the elements in a time series"); } Wham::Wham(const ActionOptions&ao): diff --git a/src/wham/WhamHistogram.cpp b/src/wham/WhamHistogram.cpp index 4cbc8c0266..ad1e0ef6cb 100644 --- a/src/wham/WhamHistogram.cpp +++ b/src/wham/WhamHistogram.cpp @@ -92,7 +92,7 @@ void WhamHistogram::registerKeywords( Keywords& keys ) { keys.add("compulsory","GRID_MAX","the maximum to use for the grid"); keys.add("compulsory","GRID_BIN","the number of bins to use for the grid"); keys.add("optional","BANDWIDTH","the bandwidth for kernel density estimation"); - keys.setValueDescription("the histogram that was generated using the WHAM weights"); + keys.setValueDescription("grid","the histogram that was generated using the WHAM weights"); keys.needsAction("GATHER_REPLICAS"); keys.needsAction("CONCATENATE"); keys.needsAction("COLLECT"); keys.needsAction("WHAM"); keys.needsAction("KDE"); } diff --git a/src/wham/WhamWeights.cpp b/src/wham/WhamWeights.cpp index 2a179246a7..716524fdcc 100644 --- a/src/wham/WhamWeights.cpp +++ b/src/wham/WhamWeights.cpp @@ -81,7 +81,7 @@ void WhamWeights::registerKeywords( Keywords& keys ) { keys.add("compulsory","STRIDE","1","the frequency with which the bias should be stored to perform WHAM"); keys.add("compulsory","FILE","the file on which to output the WHAM weights"); keys.add("optional","FMT","the format to use for the real numbers in the output file"); - keys.setValueDescription("the weights that were calculated using WHAM"); + keys.setValueDescription("vector","the weights that were calculated using WHAM"); keys.needsAction("GATHER_REPLICAS"); keys.needsAction("CONCATENATE"); keys.needsAction("COLLECT"); keys.needsAction("WHAM"); keys.needsAction("DUMPVECTOR"); } From d59f49c8b8b274d2c0973d84436150b7262a8088 Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Thu, 3 Oct 2024 13:45:43 +0100 Subject: [PATCH 05/46] Added default values for keywords to json syntax file --- src/cltools/GenJson.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cltools/GenJson.cpp b/src/cltools/GenJson.cpp index a7d599bab1..604ceda785 100644 --- a/src/cltools/GenJson.cpp +++ b/src/cltools/GenJson.cpp @@ -115,14 +115,16 @@ int GenJson::main(FILE* in, FILE*out,Communicator& pc) { std::cout<<" \"displayname\" : \""<0 ) std::cout<<" \""<0 ) std::cout<<" \""< Date: Thu, 3 Oct 2024 14:58:55 +0100 Subject: [PATCH 06/46] Modified json syntax file generation so default value of keyword and flag that tells if the keyword is reusable are both output to json file --- src/cltools/GenJson.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cltools/GenJson.cpp b/src/cltools/GenJson.cpp index 604ceda785..b605bccef2 100644 --- a/src/cltools/GenJson.cpp +++ b/src/cltools/GenJson.cpp @@ -124,7 +124,7 @@ int GenJson::main(FILE* in, FILE*out,Communicator& pc) { if( mydescrip.find("\\")!=std::string::npos ) error("found invalid backslash character documentation for keyword " + keys.getKeyword(j) + " in action " + action_names[i] ); std::string argtype = keys.getArgumentType( keys.getKeyword(j) ); if( argtype.length()>0 ) std::cout<<" \""<0 ) std::cout<<" \""<0 ) std::cout<<" \""< Date: Thu, 3 Oct 2024 20:55:36 +0200 Subject: [PATCH 07/46] Reuse result from getenv In theory, calling getenv a second time could return NULL after previously returning non-NULL, which would be undefined behavior when passed to strcmp. Re-using the non-NULL value is slightly safer, and keeps clang's static analyzer happier. --- src/wrapper/Plumed.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wrapper/Plumed.h b/src/wrapper/Plumed.h index 3ea2bc9c75..bf133661cb 100644 --- a/src/wrapper/Plumed.h +++ b/src/wrapper/Plumed.h @@ -4015,6 +4015,8 @@ void plumed_retrieve_functions(plumed_plumedmain_function_holder* functions, plu void* p; char* debug; int dlopenmode; + /* possible value of PLUMED_LOAD_NAMESPACE environment variable */ + char *load_namespace; g.create=__PLUMED_WRAPPER_CXX_NULLPTR; g.cmd=__PLUMED_WRAPPER_CXX_NULLPTR; g.finalize=__PLUMED_WRAPPER_CXX_NULLPTR; @@ -4045,7 +4047,8 @@ void plumed_retrieve_functions(plumed_plumedmain_function_holder* functions, plu __PLUMED_FPRINTF(stderr,"+++ PLUMED_KERNEL=\"%s\" +++\n",path); if(debug) __PLUMED_FPRINTF(stderr,"+++ Loading with mode RTLD_NOW"); dlopenmode=RTLD_NOW; - if(__PLUMED_GETENV("PLUMED_LOAD_NAMESPACE") && !__PLUMED_WRAPPER_STD strcmp(__PLUMED_GETENV("PLUMED_LOAD_NAMESPACE"),"GLOBAL")) { + load_namespace = __PLUMED_GETENV("PLUMED_LOAD_NAMESPACE"); + if(load_namespace && !__PLUMED_WRAPPER_STD strcmp(load_namespace,"GLOBAL")) { dlopenmode=dlopenmode|RTLD_GLOBAL; if(debug) __PLUMED_FPRINTF(stderr,"|RTLD_GLOBAL"); } else { @@ -4151,6 +4154,8 @@ plumed plumed_create(void) { plumed p; /* pointer to implementation */ plumed_implementation* pimpl; + /* possible value of PLUMED_LOAD_DLCLOSE environment variable */ + char *load_dlclose; /* allocate space for implementation object. this is free-ed in plumed_finalize(). */ pimpl=plumed_malloc_pimpl(); /* store pointers in pimpl */ @@ -4161,7 +4166,8 @@ plumed plumed_create(void) { #endif /* note if handle should not be dlclosed */ pimpl->dlclose=1; - if(__PLUMED_GETENV("PLUMED_LOAD_DLCLOSE") && !__PLUMED_WRAPPER_STD strcmp(__PLUMED_GETENV("PLUMED_LOAD_DLCLOSE"),"no")) pimpl->dlclose=0; + load_dlclose = __PLUMED_GETENV("PLUMED_LOAD_DLCLOSE"); + if(load_dlclose && !__PLUMED_WRAPPER_STD strcmp(load_dlclose,"no")) pimpl->dlclose=0; /* in case of failure, return */ /* the resulting object should be plumed_finalized, though you cannot use plumed_cmd */ if(!pimpl->functions.create) { From 4fb5dc46b2a069e5e70db19c75d59117da96e593 Mon Sep 17 00:00:00 2001 From: Guillaume Fraux Date: Mon, 7 Oct 2024 15:58:32 +0200 Subject: [PATCH 08/46] Handler field name is `section`, not `watch` --- src/tools/Tools.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tools/Tools.h b/src/tools/Tools.h index 26e9d9eae9..c97127b22d 100644 --- a/src/tools/Tools.h +++ b/src/tools/Tools.h @@ -368,7 +368,7 @@ class Tools { section=handler.section; key=std::move(handler.key); } - handler.watch=nullptr; + handler.section=nullptr; return *this; } /// Destructor @@ -517,4 +517,3 @@ std::vector Tools::unique2raw(const std::vector Date: Mon, 7 Oct 2024 16:10:06 +0100 Subject: [PATCH 09/46] Fixed issue with saving input lines from ActionShortcut to fix problem in nest --- src/core/ActionShortcut.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ActionShortcut.cpp b/src/core/ActionShortcut.cpp index 377e37ce49..0adc3ea980 100644 --- a/src/core/ActionShortcut.cpp +++ b/src/core/ActionShortcut.cpp @@ -177,8 +177,8 @@ void ActionShortcut::addToSavedInputLines( const std::string& line ) { std::string num; Tools::convert( ninstances[j], num ); if( ninstances[j]>0 ) reducedline += num + " further " + numberedkeys[j] + "n keywords, "; } - } - savedInputLines.push_back( reducedline ); + savedInputLines.push_back( reducedline ); + } else savedInputLines.push_back( line ); } else savedInputLines.push_back( line ); } From 73304a2ebbbeffc825911be23387dbd1ceac859e Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:22:51 +0200 Subject: [PATCH 10/46] setting up a way for calling pycv wit the python module --- plugins/pycv/.gitignore | 3 ++- plugins/pycv/CMakeLists.txt | 21 +++++++++++++++++++++ plugins/pycv/PlumedPythonEmbeddedModule.cpp | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 plugins/pycv/CMakeLists.txt diff --git a/plugins/pycv/.gitignore b/plugins/pycv/.gitignore index 7df00fe885..ff5992fcf8 100644 --- a/plugins/pycv/.gitignore +++ b/plugins/pycv/.gitignore @@ -1,4 +1,5 @@ /Makefile.conf *.o *.so -env +/env/ +/build*/ diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt new file mode 100644 index 0000000000..f4b551e61f --- /dev/null +++ b/plugins/pycv/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.20) +project(PYCV VERSION 0.1.0 LANGUAGES CXX) +set (CMAKE_CXX_STANDARD 17) + +find_package(Python COMPONENTS Interpreter Development) +find_package(pybind11 CONFIG) +message(STATUS "pybind11 found: ${pybind11_VERSION}") + +exec_program(plumed +ARGS info --include-dir +OUTPUT_VARIABLE PLUMED_INCLUDE_DIR +) +message(STATUS "Plumed include dir: ${PLUMED_INCLUDE_DIR}") + +pybind11_add_module(plumedCommunications PlumedPythonEmbeddedModule.cpp) +add_library(PythonCVInterface SHARED ActionWithPython.cpp PythonCVInterface.cpp PythonFunction.cpp) +target_link_libraries(PythonCVInterface PUBLIC pybind11::embed plumedKernel) +target_link_libraries(plumedCommunications PUBLIC plumedKernel PythonCVInterface) + +target_include_directories(PythonCVInterface PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) +target_include_directories(plumedCommunications PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) \ No newline at end of file diff --git a/plugins/pycv/PlumedPythonEmbeddedModule.cpp b/plugins/pycv/PlumedPythonEmbeddedModule.cpp index 60ed89aca9..c0b2f5feb7 100644 --- a/plugins/pycv/PlumedPythonEmbeddedModule.cpp +++ b/plugins/pycv/PlumedPythonEmbeddedModule.cpp @@ -35,7 +35,7 @@ namespace py=pybind11; //NB: the action methods are written two times due to the diamond inheritance -PYBIND11_EMBEDDED_MODULE(plumedCommunications, m) { +PYBIND11_MODULE(plumedCommunications, m) { /*******************************default submodule****************************/ py::module_ defaults = m.def_submodule("defaults", "Submodule with the default definitions"); defaults.attr("COMPONENT") = py::dict(py::arg("period")=py::none(),py::arg("derivative")=true); From 3754faf4318b343ef4136770a30c2ef6a7c71650 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:49:51 +0200 Subject: [PATCH 11/46] Now pycv works with pip --- plugins/pycv/CMakeLists.txt | 34 ++++++++++++++++----- plugins/pycv/pyproject.toml | 60 +++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 plugins/pycv/pyproject.toml diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index f4b551e61f..a644a0ab5a 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 3.20) -project(PYCV VERSION 0.1.0 LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15...3.27) +project( + ${SKBUILD_PROJECT_NAME} + VERSION ${SKBUILD_PROJECT_VERSION} + LANGUAGES CXX) set (CMAKE_CXX_STANDARD 17) -find_package(Python COMPONENTS Interpreter Development) -find_package(pybind11 CONFIG) +find_package(Python REQUIRED COMPONENTS Interpreter Development) +find_package(pybind11 CONFIG REQUIRED) message(STATUS "pybind11 found: ${pybind11_VERSION}") exec_program(plumed @@ -12,10 +15,25 @@ OUTPUT_VARIABLE PLUMED_INCLUDE_DIR ) message(STATUS "Plumed include dir: ${PLUMED_INCLUDE_DIR}") -pybind11_add_module(plumedCommunications PlumedPythonEmbeddedModule.cpp) +python_add_library(_core MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) +target_link_libraries(_core PRIVATE pybind11::headers) +target_link_libraries(_core PUBLIC plumedKernel) + +# This is passing in the version as a define just as an example +target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION}) + +# The install directory is the output (wheel) directory +install(TARGETS _core DESTINATION plumedCommunications) + +#the pycv library add_library(PythonCVInterface SHARED ActionWithPython.cpp PythonCVInterface.cpp PythonFunction.cpp) -target_link_libraries(PythonCVInterface PUBLIC pybind11::embed plumedKernel) -target_link_libraries(plumedCommunications PUBLIC plumedKernel PythonCVInterface) +target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) +target_link_libraries(PythonCVInterface PUBLIC plumedKernel) + +target_link_libraries(_core PUBLIC PythonCVInterface) target_include_directories(PythonCVInterface PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) -target_include_directories(plumedCommunications PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) \ No newline at end of file +target_include_directories(_core PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) + +#TBD +#install(TARGETS PythonCVInterface DESTINATION ) diff --git a/plugins/pycv/pyproject.toml b/plugins/pycv/pyproject.toml new file mode 100644 index 0000000000..45c7185f7c --- /dev/null +++ b/plugins/pycv/pyproject.toml @@ -0,0 +1,60 @@ +[build-system] +requires = ["scikit-build-core>=0.10", "pybind11"] +build-backend = "scikit_build_core.build" + + +[project] +name = "pyCV" +version = "0.0.1" +description="PyCV as a package for PLUMED" +readme = "README.md" +authors = [ + { name = "My Name", email = "me@email.com" }, +] +requires-python = ">=3.9" +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] + +[project.optional-dependencies] +test = ["pytest", "plumed"] + + +[tool.scikit-build] +wheel.expand-macos-universal-tags = true +minimum-version = "build-system.requires" + + +[tool.pytest.ini_options] +minversion = "8.0" +addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] +xfail_strict = true +log_cli_level = "INFO" +filterwarnings = [ + "error", + "ignore::pytest.PytestCacheWarning", +] +testpaths = ["tests"] + + +[tool.cibuildwheel] +build-frontend = "build[uv]" +test-command = "pytest {project}/tests" +test-extras = ["test"] + +[tool.cibuildwheel.pyodide] +build-frontend = {name = "build", args = ["--exports", "whole_archive"]} + + + +[tool.ruff.lint.per-file-ignores] +"tests/**" = ["T20"] \ No newline at end of file From d15ab273a24652a96ce8a411434b11d8fffae01a Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:38:21 +0200 Subject: [PATCH 12/46] now the action is included within the wheel --- plugins/pycv/.gitignore | 2 ++ plugins/pycv/CMakeLists.txt | 20 +++++++++++--------- plugins/pycv/pyproject.toml | 16 +++++----------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/plugins/pycv/.gitignore b/plugins/pycv/.gitignore index ff5992fcf8..fe6a462721 100644 --- a/plugins/pycv/.gitignore +++ b/plugins/pycv/.gitignore @@ -3,3 +3,5 @@ *.so /env/ /build*/ +/dist*/ +*.whl \ No newline at end of file diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index a644a0ab5a..ea6722be80 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -15,25 +15,27 @@ OUTPUT_VARIABLE PLUMED_INCLUDE_DIR ) message(STATUS "Plumed include dir: ${PLUMED_INCLUDE_DIR}") -python_add_library(_core MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) -target_link_libraries(_core PRIVATE pybind11::headers) -target_link_libraries(_core PUBLIC plumedKernel) +pybind11_add_module(plumedCommunications PlumedPythonEmbeddedModule.cpp) +#python_add_library(plumedCommunications MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) +# target_link_libraries(plumedCommunications PRIVATE pybind11::headers) +target_link_libraries(plumedCommunications PUBLIC plumedKernel) # This is passing in the version as a define just as an example -target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION}) +target_compile_definitions(plumedCommunications PRIVATE VERSION_INFO=${PROJECT_VERSION}) # The install directory is the output (wheel) directory -install(TARGETS _core DESTINATION plumedCommunications) +install(TARGETS plumedCommunications DESTINATION .) #the pycv library +#TODO: removhe the "lib" prefix add_library(PythonCVInterface SHARED ActionWithPython.cpp PythonCVInterface.cpp PythonFunction.cpp) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel) -target_link_libraries(_core PUBLIC PythonCVInterface) +target_link_libraries(plumedCommunications PUBLIC PythonCVInterface) target_include_directories(PythonCVInterface PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) -target_include_directories(_core PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) +target_include_directories(plumedCommunications PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) -#TBD -#install(TARGETS PythonCVInterface DESTINATION ) + +install(TARGETS PythonCVInterface DESTINATION .) diff --git a/plugins/pycv/pyproject.toml b/plugins/pycv/pyproject.toml index 45c7185f7c..28b3f196eb 100644 --- a/plugins/pycv/pyproject.toml +++ b/plugins/pycv/pyproject.toml @@ -6,18 +6,17 @@ build-backend = "scikit_build_core.build" [project] name = "pyCV" version = "0.0.1" -description="PyCV as a package for PLUMED" +description="PyCV support module for plumed" readme = "README.md" authors = [ - { name = "My Name", email = "me@email.com" }, + { name = "Toni Giorgino", email = "toni.giorgino@gmail.com" }, + { name = "Daniele Rapetti", email = "daniele.rapetti@sissa.it" }, ] requires-python = ">=3.9" classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -43,18 +42,13 @@ filterwarnings = [ "error", "ignore::pytest.PytestCacheWarning", ] -testpaths = ["tests"] +testpaths = ["pythontests"] [tool.cibuildwheel] build-frontend = "build[uv]" -test-command = "pytest {project}/tests" +test-command = "pytest {project}/pythontests" test-extras = ["test"] [tool.cibuildwheel.pyodide] build-frontend = {name = "build", args = ["--exports", "whole_archive"]} - - - -[tool.ruff.lint.per-file-ignores] -"tests/**" = ["T20"] \ No newline at end of file From e99df2f375152fd322cffee81bbaded8c52f73e7 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:40:39 +0200 Subject: [PATCH 13/46] now pycv looks more like a package --- plugins/pycv/CMakeLists.txt | 8 +-- plugins/pycv/Makefile | 53 ------------------ plugins/pycv/compileConfiguration.sh | 54 ------------------- plugins/pycv/{ => src}/ActionWithPython.cpp | 0 plugins/pycv/{ => src}/ActionWithPython.h | 0 .../{ => src}/PlumedPythonEmbeddedModule.cpp | 0 plugins/pycv/{ => src}/PythonCVInterface.cpp | 0 plugins/pycv/{ => src}/PythonCVInterface.h | 0 plugins/pycv/{ => src}/PythonFunction.cpp | 0 plugins/pycv/{ => src}/PythonFunction.h | 0 plugins/pycv/standaloneCompile.sh | 16 ------ 11 files changed, 4 insertions(+), 127 deletions(-) delete mode 100644 plugins/pycv/Makefile delete mode 100644 plugins/pycv/compileConfiguration.sh rename plugins/pycv/{ => src}/ActionWithPython.cpp (100%) rename plugins/pycv/{ => src}/ActionWithPython.h (100%) rename plugins/pycv/{ => src}/PlumedPythonEmbeddedModule.cpp (100%) rename plugins/pycv/{ => src}/PythonCVInterface.cpp (100%) rename plugins/pycv/{ => src}/PythonCVInterface.h (100%) rename plugins/pycv/{ => src}/PythonFunction.cpp (100%) rename plugins/pycv/{ => src}/PythonFunction.h (100%) delete mode 100755 plugins/pycv/standaloneCompile.sh diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index ea6722be80..2746bcc82c 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -15,7 +15,7 @@ OUTPUT_VARIABLE PLUMED_INCLUDE_DIR ) message(STATUS "Plumed include dir: ${PLUMED_INCLUDE_DIR}") -pybind11_add_module(plumedCommunications PlumedPythonEmbeddedModule.cpp) +pybind11_add_module(plumedCommunications src/PlumedPythonEmbeddedModule.cpp) #python_add_library(plumedCommunications MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) # target_link_libraries(plumedCommunications PRIVATE pybind11::headers) target_link_libraries(plumedCommunications PUBLIC plumedKernel) @@ -28,14 +28,14 @@ install(TARGETS plumedCommunications DESTINATION .) #the pycv library #TODO: removhe the "lib" prefix -add_library(PythonCVInterface SHARED ActionWithPython.cpp PythonCVInterface.cpp PythonFunction.cpp) +add_library(PythonCVInterface SHARED src/ActionWithPython.cpp src/PythonCVInterface.cpp src/PythonFunction.cpp) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel) target_link_libraries(plumedCommunications PUBLIC PythonCVInterface) -target_include_directories(PythonCVInterface PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) -target_include_directories(plumedCommunications PUBLIC ${PLUMED_INCLUDE_DIR}/plumed) +target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) +target_include_directories(plumedCommunications PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) install(TARGETS PythonCVInterface DESTINATION .) diff --git a/plugins/pycv/Makefile b/plugins/pycv/Makefile deleted file mode 100644 index 9e9ee703cf..0000000000 --- a/plugins/pycv/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# include the machine dependent configuration -ifneq ($(MAKECMDGOALS),clean) - -include ../../Makefile.conf - ifndef canPyCV - include ./Makefile.conf - endif -endif - -.PHONY: clean check all -#Dependency tracking based on https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr -#this assumes gcc -DEPDIR := .deps -DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.d -PYBIND11FLAG = -ADDCPPFLAGS:=$(python_cf_embedded) $(pybind11_cflags) $(ADDCPPFLAGS) -ADDCLDFLAGS:=$(ADDCLDFLAGS) $(python_ld_embedded) -OBJS = ActionWithPython.o PythonCVInterface.o PythonFunction.o PlumedPythonEmbeddedModule.o - -ifeq ($(SOEXT),dylib) - SONAME_OPTION:=-Wl,-install_name -else - SONAME_OPTION:=-Wl,-soname -endif - -all: PythonCVInterface.$(SOEXT) - -#-fvisibility=hidden is needed for pybind11 (to not conflict with different pybind11 versions) -#I think I enforced this nearly everywhere I set up a flag for the compiler -ActionWithPython.o PythonCVInterface.o PythonFunction.o PlumedPythonEmbeddedModule.o: PYBIND11FLAG= -fvisibility=hidden - -%.o: %.cpp $(DEPDIR)/%.d | $(DEPDIR) - @echo Compiling object $@ - @$(CXX) -c $(DEPFLAGS) $(CPPFLAGS) $(PYBIND11FLAG) $(ADDCPPFLAGS) $(CXXFLAGS) $< -o $@ - - -$(DEPDIR): ; @mkdir -p $@ - -DEPFILES := $(OBJS:%.o=$(DEPDIR)/%.d) -$(DEPFILES): -include $(wildcard $(DEPFILES)) - -#-Wl,--no-as-needed forces the python library to be linked, without this in a WSL does not work -#TODO: seems that $PLUMED_KERNEL is not needed, check -PythonCVInterface.$(SOEXT): $(OBJS) - @echo Linking $@ - $(LDSHARED) $(SONAME_OPTION),"$(notdir $@)" $(DYNAMIC_LIBS) $(PLUMED_KERNEL) $(ADDCLDFLAGS) $^ -o $@ - -clean: - rm -f $(OBJS) PythonCVInterface.$(SOEXT) - -check: all - $(MAKE) -C regtest testclean - $(MAKE) -C regtest checkfail diff --git a/plugins/pycv/compileConfiguration.sh b/plugins/pycv/compileConfiguration.sh deleted file mode 100644 index e9eac1fdbe..0000000000 --- a/plugins/pycv/compileConfiguration.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/env bash - -#formatted with shfmt https://github.com/mvdan/sh/releases -#checked with shellcheck -# shellcheck disable=SC2034 # The unused variables will be used in sourcer files - -#please source this file - -#for some reason, on the WSL I need to compile with -# `export PYCV_EXTRA_LDFLAGS="-Wl,--no-as-needed"` -#-Wl,--no-as-needed forces the python library to be linked -#I do not undestand why, since -as-needed should be disabled by default - -plumed_program_name=${plumed_program_name:-plumed} - -#check if during config time the settings for compiling PyCV where got -plumed_canPyCV=$( - ${plumed_program_name} --no-mpi config makefile_conf | grep canPyCV | sed -e s/^canPyCV=// -) - -if [[ $plumed_canPyCV = yes ]]; then - pybind11_cflags=$(plumed --no-mpi config makefile_conf | grep pybind11_cflags | sed -e s/^pybind11_cflags=//) - python_cf_embedded=$(plumed --no-mpi config makefile_conf | grep python_cf_embedded | sed -e s/^python_cf_embedded=//) - python_ld_embedded=$(plumed --no-mpi config makefile_conf | grep python_ld_embedded | sed -e s/^python_ld_embedded=//) -else - #assign a default value to python bin and plumed - python_bin=${python_bin:-python} - #python3-config may be any python3.* version, this should avoid contamination from other environments - #and use pythonX.Y-config, as suggested in the manual - pyver=$($python_bin -c "import sysconfig;print(sysconfig.get_config_var('VERSION'))") - python_config=python${pyver}-config - - # Note that in conda libpython3xx is not found in the path returned by ldflags. IMHO it is a bug. - # The workaround is to -L appropriately. Will be fixed here. - conda_fixup=${CONDA_PREFIX+-L$CONDA_PREFIX/lib} - if [ -n "$conda_fixup" ]; then - echo "CONDA_PREFIX is set. Assuming conda and enabling a workaround for missing -L in ${python_config} --ldflags --embed" - fi - - if ! ${python_config} --embed >/dev/null 2>/dev/null; then - #TODO: verify that this does not give problems with conda - echo "PyCV needs python to be built to be embedable" - echo "(compiling python with --enable-shared should be enough)" - exit 1 - fi - if ! ${python_bin} -m pybind11 --includes >/dev/null; then - #python will automatically say that there is non pybind11 - exit 1 - fi - #-fvisibility=hidden is needed to correct the warnings for the visibility of some pybind11 functionalities - pybind11_cflags="$(${python_bin} -m pybind11 --includes) -fvisibility=hidden" - python_cf_embedded=$(${python_config} --cflags --embed) - python_ld_embedded=$(${python_config} --ldflags --embed) -fi diff --git a/plugins/pycv/ActionWithPython.cpp b/plugins/pycv/src/ActionWithPython.cpp similarity index 100% rename from plugins/pycv/ActionWithPython.cpp rename to plugins/pycv/src/ActionWithPython.cpp diff --git a/plugins/pycv/ActionWithPython.h b/plugins/pycv/src/ActionWithPython.h similarity index 100% rename from plugins/pycv/ActionWithPython.h rename to plugins/pycv/src/ActionWithPython.h diff --git a/plugins/pycv/PlumedPythonEmbeddedModule.cpp b/plugins/pycv/src/PlumedPythonEmbeddedModule.cpp similarity index 100% rename from plugins/pycv/PlumedPythonEmbeddedModule.cpp rename to plugins/pycv/src/PlumedPythonEmbeddedModule.cpp diff --git a/plugins/pycv/PythonCVInterface.cpp b/plugins/pycv/src/PythonCVInterface.cpp similarity index 100% rename from plugins/pycv/PythonCVInterface.cpp rename to plugins/pycv/src/PythonCVInterface.cpp diff --git a/plugins/pycv/PythonCVInterface.h b/plugins/pycv/src/PythonCVInterface.h similarity index 100% rename from plugins/pycv/PythonCVInterface.h rename to plugins/pycv/src/PythonCVInterface.h diff --git a/plugins/pycv/PythonFunction.cpp b/plugins/pycv/src/PythonFunction.cpp similarity index 100% rename from plugins/pycv/PythonFunction.cpp rename to plugins/pycv/src/PythonFunction.cpp diff --git a/plugins/pycv/PythonFunction.h b/plugins/pycv/src/PythonFunction.h similarity index 100% rename from plugins/pycv/PythonFunction.h rename to plugins/pycv/src/PythonFunction.h diff --git a/plugins/pycv/standaloneCompile.sh b/plugins/pycv/standaloneCompile.sh deleted file mode 100755 index e5ce28ec29..0000000000 --- a/plugins/pycv/standaloneCompile.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env bash - -#formatted with shfmt https://github.com/mvdan/sh/releases -#checked with shellcheck -# the SC2154 warnings are variables present in the sourced file - -source compileConfiguration.sh - - -export PLUMED_MKLIB_CFLAGS="${python_cf_embedded} ${pybind11_cflags}" -export PLUMED_MKLIB_LDFLAGS="${PYCV_EXTRA_LDFLAGS} ${python_ld_embedded} ${conda_fixup}" - -echo "PLUMED_MKLIB_CFLAGS=$PLUMED_MKLIB_CFLAGS" -echo "PLUMED_MKLIB_LDFLAGS=$PLUMED_MKLIB_LDFLAGS" - -${plumed_program_name} mklib PythonCVInterface.cpp ActionWithPython.cpp PythonFunction.cpp PlumedPythonEmbeddedModule.cpp From 0484d68794c572f731ce5ddbdf72f5a9283ad428 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:49:11 +0200 Subject: [PATCH 14/46] Reordering the installation procedure --- plugins/pycv/CMakeLists.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index 2746bcc82c..a7fb27a3d8 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -15,27 +15,27 @@ OUTPUT_VARIABLE PLUMED_INCLUDE_DIR ) message(STATUS "Plumed include dir: ${PLUMED_INCLUDE_DIR}") -pybind11_add_module(plumedCommunications src/PlumedPythonEmbeddedModule.cpp) -#python_add_library(plumedCommunications MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) -# target_link_libraries(plumedCommunications PRIVATE pybind11::headers) -target_link_libraries(plumedCommunications PUBLIC plumedKernel) - -# This is passing in the version as a define just as an example -target_compile_definitions(plumedCommunications PRIVATE VERSION_INFO=${PROJECT_VERSION}) - -# The install directory is the output (wheel) directory -install(TARGETS plumedCommunications DESTINATION .) - -#the pycv library +################################################################################ +################################the pycv library################################ +################################################################################ #TODO: removhe the "lib" prefix add_library(PythonCVInterface SHARED src/ActionWithPython.cpp src/PythonCVInterface.cpp src/PythonFunction.cpp) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel) +target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) -target_link_libraries(plumedCommunications PUBLIC PythonCVInterface) +install(TARGETS PythonCVInterface DESTINATION .) -target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) -target_include_directories(plumedCommunications PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) +################################################################################ +############################The pvCV companion module########################### +################################################################################ +pybind11_add_module(plumedCommunications src/PlumedPythonEmbeddedModule.cpp) +#python_add_library(plumedCommunications MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) +# target_link_libraries(plumedCommunications PRIVATE pybind11::headers) +target_link_libraries(plumedCommunications PUBLIC plumedKernel) +target_link_libraries(plumedCommunications PUBLIC PythonCVInterface) +target_include_directories(plumedCommunications PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) -install(TARGETS PythonCVInterface DESTINATION .) +# The install directory is the output (wheel) directory +install(TARGETS plumedCommunications DESTINATION .) From 2fa0fa3664e164ca4e07e7aedcc31c0988531ac7 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:08:32 +0200 Subject: [PATCH 15/46] added a sort of "FIND PLUMED" that does not work --- plugins/pycv/CMakeLists.txt | 43 ++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index a7fb27a3d8..baa1324a87 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -13,15 +13,51 @@ exec_program(plumed ARGS info --include-dir OUTPUT_VARIABLE PLUMED_INCLUDE_DIR ) -message(STATUS "Plumed include dir: ${PLUMED_INCLUDE_DIR}") +exec_program(plumed +ARGS info --configuration +OUTPUT_VARIABLE PLUMED_CONFIG +) +set(PLUMED_CXX_FLAGS "") +set(PLUMED_CPP_FLAGS "") +set(PLUMED_DYNAMIC_LIBS "") + +string(REPLACE "\n" ";" ProcessFile_LINES "${PLUMED_CONFIG}") +foreach(_line ${ProcessFile_LINES}) + # message(STATUS "Found PLUMED :${_line}") + if (${_line} MATCHES "CXXFLAGS=.*") + set(PLUMED_CXX_FLAGS ${_line}) + string(REPLACE "CXXFLAGS= *" "" PLUMED_CXX_FLAGS ${PLUMED_CXX_FLAGS}) + message(STATUS "Found PLUMED CXX_FLAGS: \"${PLUMED_CXX_FLAGS}\"") + # string(REPLACE " " ";" PLUMED_CXX_FLAGS ${PLUMED_CXX_FLAGS}) + endif() + if (${_line} MATCHES "CPPFLAGS=.*") + set(PLUMED_CPP_FLAGS ${_line}) + string(REPLACE "CPPFLAGS= *" "" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) + message(STATUS "Found PLUMED CPP_FLAGS: \"${PLUMED_CPP_FLAGS}\"") + # string(REPLACE " " ";" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) + endif() + if (${_line} MATCHES "DYNAMIC_LIBS=.*") + set(PLUMED_DYNAMIC_LIBS ${_line}) + string(REPLACE "DYNAMIC_LIBS= *" "" PLUMED_DYNAMIC_LIBS ${PLUMED_DYNAMIC_LIBS}) + message(STATUS "Found PLUMED DYNAMIC_LIBS: \"${PLUMED_DYNAMIC_LIBS}\"") + # string(REPLACE " " ";" PLUMED_DYNAMIC_LIBS ${PLUMED_DYNAMIC_LIBS}) + endif() + +endforeach() + +message(STATUS "Plumed include dir: ${PLUMED_INCLUDE_DIR}") +set(CMAke__extra) ################################################################################ ################################the pycv library################################ ################################################################################ #TODO: removhe the "lib" prefix add_library(PythonCVInterface SHARED src/ActionWithPython.cpp src/PythonCVInterface.cpp src/PythonFunction.cpp) +#public, so they trickle down to the python module +target_compile_definitions(PythonCVInterface PUBLIC ${PLUMED_CPP_FLAGS}) +target_compile_options(PythonCVInterface PUBLIC ${PLUMED_CXX_FLAGS}) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) -target_link_libraries(PythonCVInterface PUBLIC plumedKernel) +target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) install(TARGETS PythonCVInterface DESTINATION .) @@ -33,7 +69,8 @@ install(TARGETS PythonCVInterface DESTINATION .) pybind11_add_module(plumedCommunications src/PlumedPythonEmbeddedModule.cpp) #python_add_library(plumedCommunications MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) # target_link_libraries(plumedCommunications PRIVATE pybind11::headers) -target_link_libraries(plumedCommunications PUBLIC plumedKernel) +#target_compile_definitions(plumedCommunications PUBLIC ${PLUMED_CPP_FLAGS}) +target_link_libraries(plumedCommunications PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) target_link_libraries(plumedCommunications PUBLIC PythonCVInterface) target_include_directories(plumedCommunications PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) From f64b088f3e4d49d8c5b00a8bdf6f64c6102891a6 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:41:21 +0200 Subject: [PATCH 16/46] some cleaning --- plugins/pycv/.gitignore | 2 +- plugins/pycv/CMakeLists.txt | 36 +++++++++++++++++++-------- plugins/pycv/prepareMakeForDevelop.sh | 27 -------------------- plugins/pycv/pyproject.toml | 7 +++++- plugins/pycv/pythontests/.gitignore | 4 +++ 5 files changed, 37 insertions(+), 39 deletions(-) delete mode 100755 plugins/pycv/prepareMakeForDevelop.sh create mode 100644 plugins/pycv/pythontests/.gitignore diff --git a/plugins/pycv/.gitignore b/plugins/pycv/.gitignore index fe6a462721..9b90bc2d91 100644 --- a/plugins/pycv/.gitignore +++ b/plugins/pycv/.gitignore @@ -1,7 +1,7 @@ /Makefile.conf *.o *.so -/env/ +/env*/ /build*/ /dist*/ *.whl \ No newline at end of file diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index baa1324a87..8e8fd5701e 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -27,21 +27,35 @@ foreach(_line ${ProcessFile_LINES}) # message(STATUS "Found PLUMED :${_line}") if (${_line} MATCHES "CXXFLAGS=.*") set(PLUMED_CXX_FLAGS ${_line}) - string(REPLACE "CXXFLAGS= *" "" PLUMED_CXX_FLAGS ${PLUMED_CXX_FLAGS}) - message(STATUS "Found PLUMED CXX_FLAGS: \"${PLUMED_CXX_FLAGS}\"") - # string(REPLACE " " ";" PLUMED_CXX_FLAGS ${PLUMED_CXX_FLAGS}) + string(REGEX REPLACE "CXXFLAGS= *" "" PLUMED_CXX_FLAGS ${PLUMED_CXX_FLAGS}) + string(REPLACE " " ";" PLUMED_CXX_FLAGS ${PLUMED_CXX_FLAGS}) + # message(STATUS "Found PLUMED CXX_FLAGS: \"${PLUMED_CXX_FLAGS}\"") + message(STATUS "Found PLUMED CXX_FLAGS: ") + foreach (_flag ${PLUMED_CXX_FLAGS}) + message(STATUS " \"${_flag}\"") + endforeach() endif() if (${_line} MATCHES "CPPFLAGS=.*") set(PLUMED_CPP_FLAGS ${_line}) - string(REPLACE "CPPFLAGS= *" "" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) - message(STATUS "Found PLUMED CPP_FLAGS: \"${PLUMED_CPP_FLAGS}\"") - # string(REPLACE " " ";" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) + string(REGEX REPLACE "CPPFLAGS= *" "" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) + string(REPLACE "\\" "" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) + string(REPLACE "-D" ";" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) + # message(STATUS "Found PLUMED CPP_FLAGS: \"${PLUMED_CPP_FLAGS}\"") + message(STATUS "Found PLUMED CPP_FLAGS:") + foreach(_flag ${PLUMED_CPP_FLAGS}) + message(STATUS " \"${_flag}\"") + endforeach() + endif() if (${_line} MATCHES "DYNAMIC_LIBS=.*") set(PLUMED_DYNAMIC_LIBS ${_line}) - string(REPLACE "DYNAMIC_LIBS= *" "" PLUMED_DYNAMIC_LIBS ${PLUMED_DYNAMIC_LIBS}) - message(STATUS "Found PLUMED DYNAMIC_LIBS: \"${PLUMED_DYNAMIC_LIBS}\"") - # string(REPLACE " " ";" PLUMED_DYNAMIC_LIBS ${PLUMED_DYNAMIC_LIBS}) + string(REGEX REPLACE "DYNAMIC_LIBS= *" "" PLUMED_DYNAMIC_LIBS ${PLUMED_DYNAMIC_LIBS}) + string(REPLACE " " ";" PLUMED_DYNAMIC_LIBS ${PLUMED_DYNAMIC_LIBS}) + # message(STATUS "Found PLUMED DYNAMIC_LIBS: \"${PLUMED_DYNAMIC_LIBS}\"") + message(STATUS "Found PLUMED DYNAMIC_LIBS:") + foreach(_flag ${PLUMED_DYNAMIC_LIBS}) + message(STATUS " \"${_flag}\"") + endforeach() endif() endforeach() @@ -51,10 +65,12 @@ set(CMAke__extra) ################################################################################ ################################the pycv library################################ ################################################################################ -#TODO: removhe the "lib" prefix +#TODO: remove the "lib" prefix add_library(PythonCVInterface SHARED src/ActionWithPython.cpp src/PythonCVInterface.cpp src/PythonFunction.cpp) #public, so they trickle down to the python module target_compile_definitions(PythonCVInterface PUBLIC ${PLUMED_CPP_FLAGS}) +get_target_property(COMPILE_DEFINITIONS PythonCVInterface COMPILE_DEFINITIONS) +message(STATUS "COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS}") target_compile_options(PythonCVInterface PUBLIC ${PLUMED_CXX_FLAGS}) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) diff --git a/plugins/pycv/prepareMakeForDevelop.sh b/plugins/pycv/prepareMakeForDevelop.sh deleted file mode 100755 index 375851c5a9..0000000000 --- a/plugins/pycv/prepareMakeForDevelop.sh +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env bash - -#formatted with shfmt https://github.com/mvdan/sh/releases -#checked with shellcheck -# the SC2154 warnings are variables present in the sourced file - -source compileConfiguration.sh - - -if [[ -z $PLUMED_KERNEL ]]; then - echo "$(basename $0) can work only if \"PLUMED_KERNEL\" is defined" - echo "either via module load or sourceme.sh, or manually exported" - exit 1 -fi - -plumed_include=$(${plumed_program_name} --no-mpi info --include-dir) -{ - ${plumed_program_name} --no-mpi config makefile_conf - echo "PLUMED_KERNEL=${PLUMED_KERNEL}" - if [[ ! $plumed_canPyCV = yes ]]; then - echo "pybind11_cflags=$pybind11_cflags" - echo "python_cf_embedded=$python_cf_embedded" - echo "python_ld_embedded=$python_ld_embedded" - fi - echo "ADDCPPFLAGS=-I${plumed_include}/plumed" - echo "ADDCLDFLAGS=${PYCV_EXTRA_LDFLAGS} ${conda_fixup}" -} > Makefile.conf diff --git a/plugins/pycv/pyproject.toml b/plugins/pycv/pyproject.toml index 28b3f196eb..45f0e95f6e 100644 --- a/plugins/pycv/pyproject.toml +++ b/plugins/pycv/pyproject.toml @@ -1,10 +1,15 @@ [build-system] -requires = ["scikit-build-core>=0.10", "pybind11"] +requires = ["scikit-build-core>=0.10", "pybind11>=2.10.3,<=2.11.1", "numpy"] build-backend = "scikit_build_core.build" [project] name = "pyCV" +dependencies = [ + "plumed", + "numpy", + "pybind11>=2.10.3,<=2.11.1" +] version = "0.0.1" description="PyCV support module for plumed" readme = "README.md" diff --git a/plugins/pycv/pythontests/.gitignore b/plugins/pycv/pythontests/.gitignore new file mode 100644 index 0000000000..e378414052 --- /dev/null +++ b/plugins/pycv/pythontests/.gitignore @@ -0,0 +1,4 @@ +bck* +*.out +logfile +*.log From 9112fa103a9d5e0746d69054fe85537009b2693f Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 14 Oct 2024 12:49:37 +0200 Subject: [PATCH 17/46] reorganized the code to try to work --- plugins/pycv/CMakeLists.txt | 4 +- plugins/pycv/pyproject.toml | 6 +- plugins/pycv/pythontests/mypycv.py | 19 +++++ plugins/pycv/pythontests/test_run.py | 106 +++++++++++++++++++++++++++ plugins/pycv/pythontests/traj.xyz | 24 ++++++ plugins/pycv/src/pycv/__init__.py | 10 +++ 6 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 plugins/pycv/pythontests/mypycv.py create mode 100644 plugins/pycv/pythontests/test_run.py create mode 100644 plugins/pycv/pythontests/traj.xyz create mode 100644 plugins/pycv/src/pycv/__init__.py diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index 8e8fd5701e..ba2905f225 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -75,8 +75,10 @@ target_compile_options(PythonCVInterface PUBLIC ${PLUMED_CXX_FLAGS}) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) +#this removes the "lib" prefix +set_target_properties(PythonCVInterface PROPERTIES PREFIX "") -install(TARGETS PythonCVInterface DESTINATION .) +install(TARGETS PythonCVInterface DESTINATION pycv) ################################################################################ ############################The pvCV companion module########################### diff --git a/plugins/pycv/pyproject.toml b/plugins/pycv/pyproject.toml index 45f0e95f6e..ac06ea8c2a 100644 --- a/plugins/pycv/pyproject.toml +++ b/plugins/pycv/pyproject.toml @@ -4,9 +4,8 @@ build-backend = "scikit_build_core.build" [project] -name = "pyCV" +name = "pycv" dependencies = [ - "plumed", "numpy", "pybind11>=2.10.3,<=2.11.1" ] @@ -32,6 +31,8 @@ classifiers = [ [project.optional-dependencies] test = ["pytest", "plumed"] +[project.scripts] +pycv = "pycv:main" [tool.scikit-build] wheel.expand-macos-universal-tags = true @@ -57,3 +58,4 @@ test-extras = ["test"] [tool.cibuildwheel.pyodide] build-frontend = {name = "build", args = ["--exports", "whole_archive"]} + diff --git a/plugins/pycv/pythontests/mypycv.py b/plugins/pycv/pythontests/mypycv.py new file mode 100644 index 0000000000..13b71e3a52 --- /dev/null +++ b/plugins/pycv/pythontests/mypycv.py @@ -0,0 +1,19 @@ +import plumedCommunications as PLMD +import numpy +from sys import stderr as log +# log = open("pydist.log", "w") + +print("Imported my pydist+.", file=log) + + +def plumedInitio(action: PLMD.PythonCVInterface): + # return {"Value": {"period": [None,0,0]}} + # return {"Value": {"period": None}} + return {"Value": {"period": ["0",0.3]}} +plumedInit={"Value": {"period": None},"NOPBC":False, + "ATOMS":"1,2"} + +def plumedCalculate(action: PLMD.PythonCVInterface): + ret = [action.nat] + print ("Hello from plumedCalculate") + return ret diff --git a/plugins/pycv/pythontests/test_run.py b/plugins/pycv/pythontests/test_run.py new file mode 100644 index 0000000000..113ca06cd1 --- /dev/null +++ b/plugins/pycv/pythontests/test_run.py @@ -0,0 +1,106 @@ +import unittest +import numpy as np +from plumed import Plumed + +import os +from contextlib import contextmanager + +@contextmanager +def cd(newdir): + prevdir = os.getcwd() + os.chdir(newdir) + try: + yield + finally: + os.chdir(prevdir) + +def read_xyz(filename): + xyz = open(filename) + n_atoms = int(xyz.readline()) + title = xyz.readline() + trajectory =[] + while True : + atom_type= np.zeros(n_atoms).astype(str) + coordinates = np.zeros([n_atoms,3]) + for i in range(0,n_atoms) : + line = xyz.readline() + atom,x,y,z = line.split() + atom_type[i]=atom + coordinates[i,:]=np.array([x,y,z],dtype=np.float64) + trajectory.append( coordinates ) + nextline = xyz.readline() + if( nextline=="" ) : break + c_atoms = int(nextline) + if( c_atoms!=n_atoms ) : break + title = xyz.readline() + xyz.close() + return trajectory + +def create_plumed_var( plmd, name, command ): + plmd.cmd("readInputLine", name + ": " + command ) + shape = np.zeros( 1, dtype=np.int_ ) + plmd.cmd("getDataRank " + name, shape ) + data = np.zeros((1)) + plmd.cmd("setMemoryForData " + name, data ) + return data + +class Test(unittest.TestCase): + def runtest(self): + from pycv import getLib + os.system('rm -f bck.*') + # Output to four decimal places only + np.set_printoptions(precision=4) + # Read trajectory + traj = read_xyz("traj.xyz") + num_frames = len(traj) + num_atoms = traj[0].shape[0] + + # Create arrays for stuff + box=np.diag(12.41642*np.ones(3,dtype=np.float64)) + virial=np.zeros((3,3),dtype=np.float64) + masses=np.ones(num_atoms,dtype=np.float64) + forces=np.random.rand(num_atoms,3) + charges=np.zeros(num_atoms,dtype=np.float64) + + # Create PLUMED object and read input + plmd = Plumed() + + # not really needed, used to check https://github.com/plumed/plumed2/issues/916 + plumed_version = np.zeros(1, dtype=np.intc) + plmd.cmd( "getApiVersion", plumed_version) + + plmd.cmd("setMDEngine","python") + plmd.cmd("setTimestep", 1.) + plmd.cmd("setKbT", 1.) + plmd.cmd("setNatoms",num_atoms) + plmd.cmd("setLogFile","test.log") + plmd.cmd("init") + # plmd.cmd("readInputLine","LOAD FILE=./libPythonCVInterface.so") + plmd.cmd("readInputLine",f"LOAD FILE={getLib()}") + cvPy = create_plumed_var( plmd, "cvPy", "PYCVINTERFACE IMPORT=mypycv") + plmd.cmd("readInputLine","PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + + # Now analyze the trajectory + for step in range(0,num_frames) : + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n" ) + plmd.cmd("setStep",step ) + plmd.cmd("setBox",box ) + plmd.cmd("setMasses", masses ) + plmd.cmd("setCharges", charges ) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces ) + plmd.cmd("setVirial", virial ) + plmd.cmd("calc") + + self.assertEqual(cvPy,2) + + + def test(self): + + self.runtest() + +if __name__ == "__main__": + unittest.main() + diff --git a/plugins/pycv/pythontests/traj.xyz b/plugins/pycv/pythontests/traj.xyz new file mode 100644 index 0000000000..c0e66cf2b2 --- /dev/null +++ b/plugins/pycv/pythontests/traj.xyz @@ -0,0 +1,24 @@ +4 +100 100 100 +X 5 0 0 +X 0 0 0 +X 0 5 0 +X 5 5 0 +4 +100 100 100 +X 5 0 0 +X 0 0 0 +X 0 5 0 +X 0 5 5 +4 +100 100 100 +X 5 0 0 +X 0 0 0 +X 0 5 0 +X -5 5 0 +4 +100 100 100 +X 5 0 0 +X 0 0 0 +X 0 5 0 +X 0 5 -5 diff --git a/plugins/pycv/src/pycv/__init__.py b/plugins/pycv/src/pycv/__init__.py new file mode 100644 index 0000000000..2fb1625192 --- /dev/null +++ b/plugins/pycv/src/pycv/__init__.py @@ -0,0 +1,10 @@ +import inspect + +def getLib(): + import pycv + path_of_this = inspect.getfile(pycv) + path_of_lib=path_of_this[:path_of_this.rfind("/")] + return path_of_lib+"/PythonCVInterface.so" +def main(): + print(getLib()) + return 0 \ No newline at end of file From 389e11a96daaef46fdec34d63c748615c2155767 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:06:51 +0200 Subject: [PATCH 18/46] bettwen naming --- plugins/pycv/pythontests/test_run.py | 6 +++--- plugins/pycv/src/pycv/__init__.py | 15 ++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/pycv/pythontests/test_run.py b/plugins/pycv/pythontests/test_run.py index 113ca06cd1..91a68bcb20 100644 --- a/plugins/pycv/pythontests/test_run.py +++ b/plugins/pycv/pythontests/test_run.py @@ -46,7 +46,7 @@ def create_plumed_var( plmd, name, command ): class Test(unittest.TestCase): def runtest(self): - from pycv import getLib + from pycv import getPythonCVInterface os.system('rm -f bck.*') # Output to four decimal places only np.set_printoptions(precision=4) @@ -75,8 +75,8 @@ def runtest(self): plmd.cmd("setNatoms",num_atoms) plmd.cmd("setLogFile","test.log") plmd.cmd("init") - # plmd.cmd("readInputLine","LOAD FILE=./libPythonCVInterface.so") - plmd.cmd("readInputLine",f"LOAD FILE={getLib()}") + # plmd.cmd("readInputLine","LOAD FILE=./PythonCVInterface.so") + plmd.cmd("readInputLine",f"LOAD FILE={getPythonCVInterface()}") cvPy = create_plumed_var( plmd, "cvPy", "PYCVINTERFACE IMPORT=mypycv") plmd.cmd("readInputLine","PRINT FILE=colvar.out ARG=*") # Open an output file diff --git a/plugins/pycv/src/pycv/__init__.py b/plugins/pycv/src/pycv/__init__.py index 2fb1625192..91a0ad75d9 100644 --- a/plugins/pycv/src/pycv/__init__.py +++ b/plugins/pycv/src/pycv/__init__.py @@ -1,10 +1,15 @@ import inspect +# checked and formatted with ruff 0.6.9 -def getLib(): + +def getPythonCVInterface(): import pycv + path_of_this = inspect.getfile(pycv) - path_of_lib=path_of_this[:path_of_this.rfind("/")] - return path_of_lib+"/PythonCVInterface.so" + path_of_lib = path_of_this[: path_of_this.rfind("/")] + return path_of_lib + "/PythonCVInterface.so" + + def main(): - print(getLib()) - return 0 \ No newline at end of file + print(getPythonCVInterface()) + return 0 From a4875958ea8c16574880cccc32a405b72da26ef1 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:16:30 +0200 Subject: [PATCH 19/46] setting up a second run option, adding an helper --- plugins/pycv/src/pycv/__init__.py | 12 +++++++++++- plugins/pycv/src/pycv/__main__.py | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 plugins/pycv/src/pycv/__main__.py diff --git a/plugins/pycv/src/pycv/__init__.py b/plugins/pycv/src/pycv/__init__.py index 91a0ad75d9..8f2d79fec3 100644 --- a/plugins/pycv/src/pycv/__init__.py +++ b/plugins/pycv/src/pycv/__init__.py @@ -1,8 +1,8 @@ -import inspect # checked and formatted with ruff 0.6.9 def getPythonCVInterface(): + import inspect import pycv path_of_this = inspect.getfile(pycv) @@ -11,5 +11,15 @@ def getPythonCVInterface(): def main(): + from argparse import ArgumentParser + + parser = ArgumentParser( + prog="pyCV", + description="""shows the path for the pycv shared object. + + Just run this with no arguments to see the path. + """, + ) + _ = parser.parse_args() print(getPythonCVInterface()) return 0 diff --git a/plugins/pycv/src/pycv/__main__.py b/plugins/pycv/src/pycv/__main__.py new file mode 100644 index 0000000000..770c223002 --- /dev/null +++ b/plugins/pycv/src/pycv/__main__.py @@ -0,0 +1,6 @@ +if __name__ == "__main__": + import sys + + from . import main + + sys.exit(main()) From 4b81b97660f2e59e22a9c6b6ee072e3c285c7197 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:08:44 +0200 Subject: [PATCH 20/46] removed the self-import gor getting the path of pycv --- plugins/pycv/src/pycv/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/pycv/src/pycv/__init__.py b/plugins/pycv/src/pycv/__init__.py index 8f2d79fec3..ee2bdd414a 100644 --- a/plugins/pycv/src/pycv/__init__.py +++ b/plugins/pycv/src/pycv/__init__.py @@ -2,10 +2,15 @@ def getPythonCVInterface(): - import inspect - import pycv + """returns the location of the pycv shared object""" + # older version + # import inspect + # import pycv - path_of_this = inspect.getfile(pycv) + # path_of_this = inspect.getfile(pycv) + import importlib.util + + path_of_this = importlib.util.find_spec("pycv").origin path_of_lib = path_of_this[: path_of_this.rfind("/")] return path_of_lib + "/PythonCVInterface.so" From 938228d882d90e944897639a6294d3c7b9626b17 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:38:16 +0200 Subject: [PATCH 21/46] adding an example --- plugins/pycv/src/pycv/__init__.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/pycv/src/pycv/__init__.py b/plugins/pycv/src/pycv/__init__.py index ee2bdd414a..7cae10a7dd 100644 --- a/plugins/pycv/src/pycv/__init__.py +++ b/plugins/pycv/src/pycv/__init__.py @@ -25,6 +25,22 @@ def main(): Just run this with no arguments to see the path. """, ) - _ = parser.parse_args() + parser.add_argument( + "-p", + "--plumed", + help="print on screen an example plumed.dat", + action="store_true", + ) + args = parser.parse_args() + + if args.plumed: + print( + f"""LOAD FILE={getPythonCVInterface()} +cvPy:PYCVINTERFACE IMPORT=mypycv +fPy: PYFUNCTION IMPORT=mypycvfunc ARG=cvPy +PRINT FILE=colvar.out ARG=*""" + ) + return 0 + print(getPythonCVInterface()) return 0 From f2374044e7fa51f1bb734f87b9df644692786929 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:05:18 +0200 Subject: [PATCH 22/46] Better CMakefiles --- plugins/pycv/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index ba2905f225..a9d9c75d80 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -72,6 +72,7 @@ target_compile_definitions(PythonCVInterface PUBLIC ${PLUMED_CPP_FLAGS}) get_target_property(COMPILE_DEFINITIONS PythonCVInterface COMPILE_DEFINITIONS) message(STATUS "COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS}") target_compile_options(PythonCVInterface PUBLIC ${PLUMED_CXX_FLAGS}) +target_compile_options(PythonCVInterface PRIVATE -fvisibility=hidden) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) @@ -86,8 +87,7 @@ install(TARGETS PythonCVInterface DESTINATION pycv) pybind11_add_module(plumedCommunications src/PlumedPythonEmbeddedModule.cpp) #python_add_library(plumedCommunications MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) -# target_link_libraries(plumedCommunications PRIVATE pybind11::headers) -#target_compile_definitions(plumedCommunications PUBLIC ${PLUMED_CPP_FLAGS}) + target_link_libraries(plumedCommunications PRIVATE pybind11::headers) target_link_libraries(plumedCommunications PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) target_link_libraries(plumedCommunications PUBLIC PythonCVInterface) target_include_directories(plumedCommunications PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) From c5062fcae8ce795117724aea0ae3e52740671688 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Wed, 16 Oct 2024 08:40:31 +0200 Subject: [PATCH 23/46] moving to a more "external" include fashion --- plugins/pycv/CMakeLists.txt | 4 ++-- plugins/pycv/src/ActionWithPython.cpp | 4 ++-- plugins/pycv/src/ActionWithPython.h | 2 +- plugins/pycv/src/PlumedPythonEmbeddedModule.cpp | 4 ++-- plugins/pycv/src/PythonCVInterface.cpp | 8 ++++---- plugins/pycv/src/PythonCVInterface.h | 2 +- plugins/pycv/src/PythonFunction.cpp | 4 ++-- plugins/pycv/src/PythonFunction.h | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index a9d9c75d80..ee84d1efe3 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -75,7 +75,7 @@ target_compile_options(PythonCVInterface PUBLIC ${PLUMED_CXX_FLAGS}) target_compile_options(PythonCVInterface PRIVATE -fvisibility=hidden) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) -target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) +target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}) #this removes the "lib" prefix set_target_properties(PythonCVInterface PROPERTIES PREFIX "") @@ -90,7 +90,7 @@ pybind11_add_module(plumedCommunications src/PlumedPythonEmbeddedModule.cpp) target_link_libraries(plumedCommunications PRIVATE pybind11::headers) target_link_libraries(plumedCommunications PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) target_link_libraries(plumedCommunications PUBLIC PythonCVInterface) -target_include_directories(plumedCommunications PUBLIC src ${PLUMED_INCLUDE_DIR}/plumed) +target_include_directories(plumedCommunications PUBLIC src ${PLUMED_INCLUDE_DIR}) # The install directory is the output (wheel) directory install(TARGETS plumedCommunications DESTINATION .) diff --git a/plugins/pycv/src/ActionWithPython.cpp b/plugins/pycv/src/ActionWithPython.cpp index 6886dc1123..49bf3434f0 100644 --- a/plugins/pycv/src/ActionWithPython.cpp +++ b/plugins/pycv/src/ActionWithPython.cpp @@ -17,8 +17,8 @@ along with plumed. If not, see . #include "ActionWithPython.h" -#include "core/ActionWithValue.h" -#include "tools/DLLoader.h" +#include "plumed/core/ActionWithValue.h" +#include "plumed/tools/DLLoader.h" #include // everything needed for embedding #include diff --git a/plugins/pycv/src/ActionWithPython.h b/plugins/pycv/src/ActionWithPython.h index a941eb4bae..81ea0fccb1 100644 --- a/plugins/pycv/src/ActionWithPython.h +++ b/plugins/pycv/src/ActionWithPython.h @@ -20,7 +20,7 @@ along with plumed. If not, see . #include #include -#include "core/Action.h" +#include "plumed/core/Action.h" #include // everything needed for embedding diff --git a/plugins/pycv/src/PlumedPythonEmbeddedModule.cpp b/plugins/pycv/src/PlumedPythonEmbeddedModule.cpp index c0b2f5feb7..f991e49f75 100644 --- a/plugins/pycv/src/PlumedPythonEmbeddedModule.cpp +++ b/plugins/pycv/src/PlumedPythonEmbeddedModule.cpp @@ -21,8 +21,8 @@ along with plumed. If not, see . #include #include -#include "tools/Vector.h" -#include "tools/NeighborList.h" +#include "plumed/tools/Vector.h" +#include "plumed/tools/NeighborList.h" #include "PythonCVInterface.h" #include "PythonFunction.h" diff --git a/plugins/pycv/src/PythonCVInterface.cpp b/plugins/pycv/src/PythonCVInterface.cpp index 374c370ea1..08fb1fe9ef 100644 --- a/plugins/pycv/src/PythonCVInterface.cpp +++ b/plugins/pycv/src/PythonCVInterface.cpp @@ -16,10 +16,10 @@ along with plumed. If not, see . +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "PythonCVInterface.h" -#include "core/ActionRegister.h" -#include "core/PlumedMain.h" -#include "tools/NeighborList.h" -#include "tools/Pbc.h" +#include "plumed/core/ActionRegister.h" +#include "plumed/core/PlumedMain.h" +#include "plumed/tools/NeighborList.h" +#include "plumed/tools/Pbc.h" #include // everything needed for embedding #include diff --git a/plugins/pycv/src/PythonCVInterface.h b/plugins/pycv/src/PythonCVInterface.h index b5971029c1..23bd60f69f 100644 --- a/plugins/pycv/src/PythonCVInterface.h +++ b/plugins/pycv/src/PythonCVInterface.h @@ -18,7 +18,7 @@ along with plumed. If not, see . #define __PLUMED_pycv_PythonCVInterface_h #include "ActionWithPython.h" -#include "colvar/Colvar.h" +#include "plumed/colvar/Colvar.h" namespace PLMD { diff --git a/plugins/pycv/src/PythonFunction.cpp b/plugins/pycv/src/PythonFunction.cpp index a0aa837f3f..23d007063e 100644 --- a/plugins/pycv/src/PythonFunction.cpp +++ b/plugins/pycv/src/PythonFunction.cpp @@ -16,8 +16,8 @@ along with plumed. If not, see . +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "PythonFunction.h" -#include "core/ActionRegister.h" -#include "core/PlumedMain.h" // cite +#include "plumed/core/ActionRegister.h" +#include "plumed/core/PlumedMain.h" // cite #include // everything needed for embedding #include diff --git a/plugins/pycv/src/PythonFunction.h b/plugins/pycv/src/PythonFunction.h index 1f1059b46d..aa55aaf766 100644 --- a/plugins/pycv/src/PythonFunction.h +++ b/plugins/pycv/src/PythonFunction.h @@ -17,7 +17,7 @@ along with plumed. If not, see . #ifndef __PLUMED_pycv_PythonFunction_h #define __PLUMED_pycv_PythonFunction_h #include "ActionWithPython.h" -#include "function/Function.h" +#include "plumed/function/Function.h" #include namespace PLMD { From 32041bea60e113e87c9278eb93d10212d7c8c74b Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:35:00 +0200 Subject: [PATCH 24/46] Now pycv seems to work again --- plugins/pycv/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index ee84d1efe3..07509b0727 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -72,7 +72,10 @@ target_compile_definitions(PythonCVInterface PUBLIC ${PLUMED_CPP_FLAGS}) get_target_property(COMPILE_DEFINITIONS PythonCVInterface COMPILE_DEFINITIONS) message(STATUS "COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS}") target_compile_options(PythonCVInterface PUBLIC ${PLUMED_CXX_FLAGS}) -target_compile_options(PythonCVInterface PRIVATE -fvisibility=hidden) +# uncommenting this brings problems since some symbols here are needed by the python module +# even if it should be the correct setting +# https://gcc.gnu.org/wiki/Visibility could be a starting point +# target_compile_options(PythonCVInterface PRIVATE -fvisibility=hidden) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}) From b9d1e0a7519f0df23cf899bb88bc5d3910ad6a23 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:55:10 +0200 Subject: [PATCH 25/46] A more "canonical" CMake --- plugins/pycv/CMakeLists.txt | 96 +++++++++++++------------------------ 1 file changed, 33 insertions(+), 63 deletions(-) diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index 07509b0727..2fa30d623d 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -5,80 +5,53 @@ project( LANGUAGES CXX) set (CMAKE_CXX_STANDARD 17) +#Finding necessary packages find_package(Python REQUIRED COMPONENTS Interpreter Development) find_package(pybind11 CONFIG REQUIRED) -message(STATUS "pybind11 found: ${pybind11_VERSION}") +find_package(PkgConfig REQUIRED) +pkg_check_modules(plumed REQUIRED plumedInternals) -exec_program(plumed -ARGS info --include-dir -OUTPUT_VARIABLE PLUMED_INCLUDE_DIR -) +#Finding optionals things +if("-D__PLUMED_HAS_MPI=1" IN_LIST plumed_CFLAGS) + find_package(MPI REQUIRED) +endif() +if(MPI_CXX_FOUND) + list(APPEND extraLibs MPI::MPI_CXX) +endif() -exec_program(plumed -ARGS info --configuration -OUTPUT_VARIABLE PLUMED_CONFIG -) -set(PLUMED_CXX_FLAGS "") -set(PLUMED_CPP_FLAGS "") -set(PLUMED_DYNAMIC_LIBS "") +if("-fopenmp" IN_LIST plumed_STATIC_LDFLAGS_OTHER) + find_package(OpenMP REQUIRED) +endif() +if(OpenMP_CXX_FOUND ) + list(APPEND extraLibs OpenMP::OpenMP_CXX) +endif() -string(REPLACE "\n" ";" ProcessFile_LINES "${PLUMED_CONFIG}") -foreach(_line ${ProcessFile_LINES}) - # message(STATUS "Found PLUMED :${_line}") - if (${_line} MATCHES "CXXFLAGS=.*") - set(PLUMED_CXX_FLAGS ${_line}) - string(REGEX REPLACE "CXXFLAGS= *" "" PLUMED_CXX_FLAGS ${PLUMED_CXX_FLAGS}) - string(REPLACE " " ";" PLUMED_CXX_FLAGS ${PLUMED_CXX_FLAGS}) - # message(STATUS "Found PLUMED CXX_FLAGS: \"${PLUMED_CXX_FLAGS}\"") - message(STATUS "Found PLUMED CXX_FLAGS: ") - foreach (_flag ${PLUMED_CXX_FLAGS}) - message(STATUS " \"${_flag}\"") - endforeach() - endif() - if (${_line} MATCHES "CPPFLAGS=.*") - set(PLUMED_CPP_FLAGS ${_line}) - string(REGEX REPLACE "CPPFLAGS= *" "" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) - string(REPLACE "\\" "" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) - string(REPLACE "-D" ";" PLUMED_CPP_FLAGS ${PLUMED_CPP_FLAGS}) - # message(STATUS "Found PLUMED CPP_FLAGS: \"${PLUMED_CPP_FLAGS}\"") - message(STATUS "Found PLUMED CPP_FLAGS:") - foreach(_flag ${PLUMED_CPP_FLAGS}) - message(STATUS " \"${_flag}\"") - endforeach() - - endif() - if (${_line} MATCHES "DYNAMIC_LIBS=.*") - set(PLUMED_DYNAMIC_LIBS ${_line}) - string(REGEX REPLACE "DYNAMIC_LIBS= *" "" PLUMED_DYNAMIC_LIBS ${PLUMED_DYNAMIC_LIBS}) - string(REPLACE " " ";" PLUMED_DYNAMIC_LIBS ${PLUMED_DYNAMIC_LIBS}) - # message(STATUS "Found PLUMED DYNAMIC_LIBS: \"${PLUMED_DYNAMIC_LIBS}\"") - message(STATUS "Found PLUMED DYNAMIC_LIBS:") - foreach(_flag ${PLUMED_DYNAMIC_LIBS}) - message(STATUS " \"${_flag}\"") - endforeach() - endif() - -endforeach() +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag(-fno-gnu-unique USE_NO_GNU_UNIQUE) +if(USE_NO_GNU_UNIQUE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-gnu-unique") +endif() + +# plumed_STATIC_LDFLAGS_OTHER:INTERNAL=-rdynamic;-Wl,-Bsymbolic;-fopenmp +#-rdynamic is automatically set by cmake, as -fPIC -message(STATUS "Plumed include dir: ${PLUMED_INCLUDE_DIR}") -set(CMAke__extra) ################################################################################ ################################the pycv library################################ ################################################################################ -#TODO: remove the "lib" prefix + add_library(PythonCVInterface SHARED src/ActionWithPython.cpp src/PythonCVInterface.cpp src/PythonFunction.cpp) #public, so they trickle down to the python module -target_compile_definitions(PythonCVInterface PUBLIC ${PLUMED_CPP_FLAGS}) -get_target_property(COMPILE_DEFINITIONS PythonCVInterface COMPILE_DEFINITIONS) -message(STATUS "COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS}") +target_compile_definitions(PythonCVInterface PUBLIC ${plumed_CFLAGS}) target_compile_options(PythonCVInterface PUBLIC ${PLUMED_CXX_FLAGS}) -# uncommenting this brings problems since some symbols here are needed by the python module -# even if it should be the correct setting +target_include_directories(PythonCVInterface PUBLIC src ${plumed_INCLUDEDIR}) +####################################################################### +# uncommenting this brings problems since some symbols here are needed +# by the python module even if it should be the correct setting... # https://gcc.gnu.org/wiki/Visibility could be a starting point +####################################################################### # target_compile_options(PythonCVInterface PRIVATE -fvisibility=hidden) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) -target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) -target_include_directories(PythonCVInterface PUBLIC src ${PLUMED_INCLUDE_DIR}) +target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${extraLibs}) #this removes the "lib" prefix set_target_properties(PythonCVInterface PROPERTIES PREFIX "") @@ -89,11 +62,8 @@ install(TARGETS PythonCVInterface DESTINATION pycv) ################################################################################ pybind11_add_module(plumedCommunications src/PlumedPythonEmbeddedModule.cpp) -#python_add_library(plumedCommunications MODULE PlumedPythonEmbeddedModule.cpp WITH_SOABI) - target_link_libraries(plumedCommunications PRIVATE pybind11::headers) -target_link_libraries(plumedCommunications PUBLIC plumedKernel ${PLUMED_DYNAMIC_LIBS}) +target_link_libraries(plumedCommunications PRIVATE pybind11::headers) target_link_libraries(plumedCommunications PUBLIC PythonCVInterface) -target_include_directories(plumedCommunications PUBLIC src ${PLUMED_INCLUDE_DIR}) # The install directory is the output (wheel) directory install(TARGETS plumedCommunications DESTINATION .) From 9dc5e48e38fa352c2501c39fc1078c9cad697b5f Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:18:12 +0200 Subject: [PATCH 26/46] now it shoudl work with plumed from pkg-config or not installed (just needs the plumed executable in the path) --- plugins/pycv/CMakeLists.txt | 48 ++++++++++--------- plugins/pycv/FindPlumed.cmake | 87 +++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 21 deletions(-) create mode 100644 plugins/pycv/FindPlumed.cmake diff --git a/plugins/pycv/CMakeLists.txt b/plugins/pycv/CMakeLists.txt index 2fa30d623d..e3f6f69a2b 100644 --- a/plugins/pycv/CMakeLists.txt +++ b/plugins/pycv/CMakeLists.txt @@ -3,27 +3,32 @@ project( ${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION} LANGUAGES CXX) -set (CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 17) -#Finding necessary packages +message( + STATUS + "Everithing should work fine if you are in the same environment in which you have compiled plumed" +) +# FinPlumed is here: +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") +# Finding necessary packages find_package(Python REQUIRED COMPONENTS Interpreter Development) find_package(pybind11 CONFIG REQUIRED) -find_package(PkgConfig REQUIRED) -pkg_check_modules(plumed REQUIRED plumedInternals) +find_package(Plumed REQUIRED) -#Finding optionals things -if("-D__PLUMED_HAS_MPI=1" IN_LIST plumed_CFLAGS) - find_package(MPI REQUIRED) +# Finding optionals things +if(Plumed_HAS_MPI) + find_package(MPI REQUIRED) endif() if(MPI_CXX_FOUND) - list(APPEND extraLibs MPI::MPI_CXX) + list(APPEND extraLibs MPI::MPI_CXX) endif() -if("-fopenmp" IN_LIST plumed_STATIC_LDFLAGS_OTHER) - find_package(OpenMP REQUIRED) +if(Plumed_HAS_OPENMP) + find_package(OpenMP REQUIRED) endif() -if(OpenMP_CXX_FOUND ) - list(APPEND extraLibs OpenMP::OpenMP_CXX) +if(OpenMP_CXX_FOUND) + list(APPEND extraLibs OpenMP::OpenMP_CXX) endif() include(CheckCXXCompilerFlag) @@ -33,18 +38,19 @@ if(USE_NO_GNU_UNIQUE) endif() # plumed_STATIC_LDFLAGS_OTHER:INTERNAL=-rdynamic;-Wl,-Bsymbolic;-fopenmp -#-rdynamic is automatically set by cmake, as -fPIC +# -rdynamic is automatically set by cmake, and also -fPIC ################################################################################ ################################the pycv library################################ ################################################################################ -add_library(PythonCVInterface SHARED src/ActionWithPython.cpp src/PythonCVInterface.cpp src/PythonFunction.cpp) -#public, so they trickle down to the python module -target_compile_definitions(PythonCVInterface PUBLIC ${plumed_CFLAGS}) -target_compile_options(PythonCVInterface PUBLIC ${PLUMED_CXX_FLAGS}) -target_include_directories(PythonCVInterface PUBLIC src ${plumed_INCLUDEDIR}) -####################################################################### +add_library( + PythonCVInterface SHARED src/ActionWithPython.cpp src/PythonCVInterface.cpp + src/PythonFunction.cpp) +# public, so they trickle down to the python module +target_compile_definitions(PythonCVInterface PUBLIC ${Plumed_CFLAGS}) +target_include_directories(PythonCVInterface PUBLIC src ${Plumed_INCLUDEDIR}) +# #################################################################### # uncommenting this brings problems since some symbols here are needed # by the python module even if it should be the correct setting... # https://gcc.gnu.org/wiki/Visibility could be a starting point @@ -52,13 +58,13 @@ target_include_directories(PythonCVInterface PUBLIC src ${plumed_INCLUDEDIR}) # target_compile_options(PythonCVInterface PRIVATE -fvisibility=hidden) target_link_libraries(PythonCVInterface PRIVATE pybind11::embed) target_link_libraries(PythonCVInterface PUBLIC plumedKernel ${extraLibs}) -#this removes the "lib" prefix +# this removes the "lib" prefix set_target_properties(PythonCVInterface PROPERTIES PREFIX "") install(TARGETS PythonCVInterface DESTINATION pycv) ################################################################################ -############################The pvCV companion module########################### +###########################The pvCV companion module############################ ################################################################################ pybind11_add_module(plumedCommunications src/PlumedPythonEmbeddedModule.cpp) diff --git a/plugins/pycv/FindPlumed.cmake b/plugins/pycv/FindPlumed.cmake new file mode 100644 index 0000000000..e2a816cbc4 --- /dev/null +++ b/plugins/pycv/FindPlumed.cmake @@ -0,0 +1,87 @@ +if(NOT Plumed_FOUND) + find_package(PkgConfig) + if(Plumed_FIND_QUIETLY) + function(message) + # THIS completely shuts down messages + endfunction() + pkg_check_modules(PLUMED QUIET plumedInternals) + else() + pkg_check_modules(PLUMED plumedInternals) + endif() + + if(Plumed_FOUND) + if("-D__PLUMED_HAS_MPI=1" IN_LIST Plumed_CFLAGS) + set(Plumed_HAS_MPI + 1 + CACHE INTERNAL "plumed has MPI") + endif() + if("-fopenmp" IN_LIST Plumed_STATIC_LDFLAGS_OTHER) + set(Plumed_HAS_OPENMP + 1 + CACHE INTERNAL "plumed has OpenMP") + endif() + else() + message(STATUS "plumed not found via pkgconfig, trying executable") + + execute_process( + COMMAND plumed info --include-dir + RESULT_VARIABLE PLUMED_EXECUTABLE + OUTPUT_QUIET ERROR_QUIET) + if(PLUMED_EXECUTABLE EQUAL 0) + set(Plumed_FOUND + 1 + CACHE INTERNAL "plumed found") + + message(STATUS "Configuring plumed from executable") + execute_process( + COMMAND plumed info --include-dir + OUTPUT_VARIABLE Plumed_INCLUDEDIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(Plumed_INCLUDEDIR + ${Plumed_INCLUDEDIR} + CACHE INTERNAL "plumed include dir") + execute_process( + COMMAND plumed info --configuration + OUTPUT_VARIABLE Plumed_CONFIG + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(Plumed_CPP_FLAGS "") + + string(REPLACE "\n" ";" ProcessFile_LINES "${Plumed_CONFIG}") + foreach(_line ${ProcessFile_LINES}) + if(${_line} MATCHES "CPPFLAGS=.*") + set(Plumed_CPP_FLAGS ${_line}) + string(REGEX REPLACE "CPPFLAGS= *" "" Plumed_CPP_FLAGS + ${Plumed_CPP_FLAGS}) + string(REPLACE "\\" "" Plumed_CPP_FLAGS ${Plumed_CPP_FLAGS}) + string(REPLACE "-D" ";" Plumed_CPP_FLAGS ${Plumed_CPP_FLAGS}) + # message(STATUS "Found PLUMED CPP_FLAGS: \"${Plumed_CPP_FLAGS}\"") + # message(STATUS "Found PLUMED CPP_FLAGS:") foreach(_flag + # ${Plumed_CPP_FLAGS}) message(STATUS " \"${_flag}\"") endforeach() + endif() + if(${_line} MATCHES ".*-fopenmp.*") + set(Plumed_HAS_MPI + 1 + CACHE INTERNAL "plumed has MPI") + endif() + endforeach() + set(Plumed_CFLAGS + ${Plumed_CPP_FLAGS} + CACHE INTERNAL "plumed Definitions flags") + + execute_process(COMMAND plumed config -q has mpi + RESULT_VARIABLE Plumed_WITH_MPI) + if(Plumed_WITH_MPI EQUAL 0) + set(Plumed_HAS_MPI + 1 + CACHE INTERNAL "plumed has MPI") + endif() + + else() + if(Plumed_FIND_REQUIRED) + message(FATAL_ERROR "plumed not found") + endif() + endif() + endif() +endif() From 8eb73c9daad2e77d31e15087429389aab0d5d9f4 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:08:50 +0200 Subject: [PATCH 27/46] Restored the Makefile --- plugins/pycv/Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/pycv/Makefile diff --git a/plugins/pycv/Makefile b/plugins/pycv/Makefile new file mode 100644 index 0000000000..013840f7d5 --- /dev/null +++ b/plugins/pycv/Makefile @@ -0,0 +1,19 @@ +.PHONY: clean check check_standalone check_python all + +all: pycv_here + +pycv_here: src/*.cpp src/*.h src/pycv/*.py + @python3 -m pip install . + @which python3 > $@ + +clean: + @python3 -m pip uninstall pycv + +check_standalone: + $(MAKE) -C regtest testclean + $(MAKE) -C regtest checkfail + +check_python: + python3 -m pytest + +check: check_standalone check_python From 1c8737c97526b1717bb2b2ff8571f500ac652d9c Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:45:32 +0200 Subject: [PATCH 28/46] restoring the standalone tests --- .../regtest/pycvcomm/rt-MDinformations/config | 28 +++++++++++++++++++ .../pycvcomm/rt-MDinformations/plumed.dat | 2 +- .../regtest/pycvcomm/rt-PBC-getBox/config | 28 +++++++++++++++++++ .../regtest/pycvcomm/rt-PBC-getBox/plumed.dat | 2 +- .../regtest/pycvcomm/rt-PBC-getInvBox/config | 28 +++++++++++++++++++ .../pycvcomm/rt-PBC-getInvBox/plumed.dat | 2 +- plugins/pycv/regtest/pycvcomm/rt-PBCs/config | 28 +++++++++++++++++++ .../pycv/regtest/pycvcomm/rt-PBCs/plumed.dat | 2 +- .../pycvcomm/rt-absoluteIndexes/config | 28 +++++++++++++++++++ .../pycvcomm/rt-absoluteIndexes/plumed.dat | 2 +- .../regtest/pycvcomm/rt-autoFunctions/config | 28 +++++++++++++++++++ .../pycvcomm/rt-autoFunctions/plumed.dat | 2 +- plugins/pycv/regtest/pycvcomm/rt-doc/config | 28 +++++++++++++++++++ .../regtest/pycvcomm/rt-doc/config.reference | 28 +++++++++++++++++++ .../pycv/regtest/pycvcomm/rt-doc/plumed.dat | 2 +- .../regtest/pycvcomm/rt-getPosition/config | 28 +++++++++++++++++++ .../pycvcomm/rt-getPosition/plumed.dat | 2 +- .../regtest/pycvcomm/rt-getPositionNL/config | 28 +++++++++++++++++++ .../pycvcomm/rt-getPositionNL/plumed.dat | 2 +- .../pycvcomm/rt-getPositionNLPair/config | 28 +++++++++++++++++++ .../pycvcomm/rt-getPositionNLPair/plumed.dat | 2 +- .../regtest/pycvcomm/rt-getPositions/config | 28 +++++++++++++++++++ .../pycvcomm/rt-getPositions/plumed.dat | 2 +- .../pycv/regtest/pycvcomm/rt-makeWhole/config | 28 +++++++++++++++++++ .../regtest/pycvcomm/rt-makeWhole/plumed.dat | 2 +- .../pycvcomm/rt-massesAndCharges/config | 28 +++++++++++++++++++ .../pycvcomm/rt-massesAndCharges/plumed.dat | 2 +- .../pycvcomm/rt-massesAndChargesArray/config | 28 +++++++++++++++++++ .../rt-massesAndChargesArray/plumed.dat | 2 +- .../pycvcomm/rt-multipleComponents/config | 28 +++++++++++++++++++ .../pycvcomm/rt-multipleComponents/plumed.dat | 2 +- .../rt-multipleValuePeriodicity/config | 28 +++++++++++++++++++ .../rt-multipleValuePeriodicity/plumed.dat | 2 +- .../regtest/pycvcomm/rt-multiplecalls/config | 28 +++++++++++++++++++ .../pycvcomm/rt-multiplecalls/plumed.dat | 2 +- .../pycvcomm/rt-newFrameNewAtom/config | 28 +++++++++++++++++++ .../pycvcomm/rt-newFrameNewAtom/plumed.dat | 2 +- .../pycvcomm/rt-newFrameNewAtomSTR/config | 28 +++++++++++++++++++ .../pycvcomm/rt-newFrameNewAtomSTR/plumed.dat | 2 +- .../regtest/pycvcomm/rt-persistentData/config | 28 ++++++++++++++++++- .../pycvcomm/rt-persistentData/plumed.dat | 2 +- .../pycvcomm/rt-valuePeriodicity/config | 28 +++++++++++++++++++ .../pycvcomm/rt-valuePeriodicity/plumed.dat | 2 +- .../regtest/pycvfunc/rt-ArgsMethods/config | 28 +++++++++++++++++++ .../pycvfunc/rt-ArgsMethods/plumed.dat | 2 +- .../regtest/pycvfunc/rt-Components/config | 28 +++++++++++++++++++ .../regtest/pycvfunc/rt-Components/plumed.dat | 2 +- .../regtest/pycvfunc/rt-MDinformations/config | 28 +++++++++++++++++++ .../pycvfunc/rt-MDinformations/plumed.dat | 2 +- .../pycv/regtest/pycvfunc/rt-arguments/config | 28 +++++++++++++++++++ .../regtest/pycvfunc/rt-arguments/plumed.dat | 2 +- .../regtest/pycvfunc/rt-argumentsArray/config | 28 +++++++++++++++++++ .../pycvfunc/rt-argumentsArray/plumed.dat | 2 +- .../rt-argumentsWithComponents/config | 28 +++++++++++++++++++ .../rt-argumentsWithComponents/plumed.dat | 2 +- .../regtest/pycvfunc/rt-derivative/config | 28 +++++++++++++++++++ .../regtest/pycvfunc/rt-derivative/plumed.dat | 2 +- plugins/pycv/regtest/pycvfunc/rt-doc/config | 28 +++++++++++++++++++ .../regtest/pycvfunc/rt-doc/config.reference | 28 +++++++++++++++++++ .../pycv/regtest/pycvfunc/rt-doc/plumed.dat | 2 +- .../pycv/regtest/pycvfunc/rt-withPYCV/config | 28 +++++++++++++++++++ .../regtest/pycvfunc/rt-withPYCV/plumed.dat | 2 +- 62 files changed, 925 insertions(+), 31 deletions(-) diff --git a/plugins/pycv/regtest/pycvcomm/rt-MDinformations/config b/plugins/pycv/regtest/pycvcomm/rt-MDinformations/config index 7429ccc9fa..af185de1f2 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-MDinformations/config +++ b/plugins/pycv/regtest/pycvcomm/rt-MDinformations/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz --mc massCharges.dat" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-MDinformations/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-MDinformations/plumed.dat index b2aa6e0aa5..fc6d26d9b9 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-MDinformations/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-MDinformations/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config b/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config +++ b/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/plumed.dat index 99aca77cbe..8e0f71ac14 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config b/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config +++ b/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/plumed.dat index 58aa94faa7..ccfaae24fd 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBCs/config b/plugins/pycv/regtest/pycvcomm/rt-PBCs/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBCs/config +++ b/plugins/pycv/regtest/pycvcomm/rt-PBCs/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBCs/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-PBCs/plumed.dat index 4d73a47b57..d26fa5f694 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBCs/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-PBCs/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancePBCs CALCULATE=pydist diff --git a/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config b/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config +++ b/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/plumed.dat index b5ab5a470d..8cb195373b 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config b/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config +++ b/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/plumed.dat index a9cf9e0185..5a9cfb8f26 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-doc/config b/plugins/pycv/regtest/pycvcomm/rt-doc/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-doc/config +++ b/plugins/pycv/regtest/pycvcomm/rt-doc/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-doc/config.reference b/plugins/pycv/regtest/pycvcomm/rt-doc/config.reference index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-doc/config.reference +++ b/plugins/pycv/regtest/pycvcomm/rt-doc/config.reference @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-doc/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-doc/plumed.dat index 34b82a81c2..d3657abc0d 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-doc/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-doc/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvdist: PYCVINTERFACE IMPORT=pyhelp diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPosition/config b/plugins/pycv/regtest/pycvcomm/rt-getPosition/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPosition/config +++ b/plugins/pycv/regtest/pycvcomm/rt-getPosition/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPosition/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-getPosition/plumed.dat index 4f10c542cc..aa7cc493f0 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPosition/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-getPosition/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancegetAtPos CALCULATE=pydist diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config b/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/plumed.dat index 75d37d16bc..1c7340e6d4 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: PYCVINTERFACE GROUPA=1,4 IMPORT=pydistancegetAtPos CALCULATE=pydist diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config b/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/plumed.dat index a8b77fa7ef..e35d02e559 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositions/config b/plugins/pycv/regtest/pycvcomm/rt-getPositions/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositions/config +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositions/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositions/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-getPositions/plumed.dat index 41acc74975..5995120f82 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositions/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositions/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancegetAt CALCULATE=pydist diff --git a/plugins/pycv/regtest/pycvcomm/rt-makeWhole/config b/plugins/pycv/regtest/pycvcomm/rt-makeWhole/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-makeWhole/config +++ b/plugins/pycv/regtest/pycvcomm/rt-makeWhole/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-makeWhole/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-makeWhole/plumed.dat index 7c72b82cb1..79bb423ec4 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-makeWhole/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-makeWhole/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config b/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config index 7429ccc9fa..af185de1f2 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config +++ b/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz --mc massCharges.dat" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/plumed.dat index b5ab5a470d..8cb195373b 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config b/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config index 7429ccc9fa..af185de1f2 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config +++ b/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz --mc massCharges.dat" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/plumed.dat index 2124644f0e..517ddbfa7d 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config b/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config +++ b/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/plumed.dat index 77e7340b95..a3a0ee55a3 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: PYCVINTERFACE ATOMS=1,2,4 IMPORT=pydistancegetAt CALCULATE=pydist NOPBC diff --git a/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config b/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config +++ b/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/plumed.dat index 5250932b26..5e41a1ab40 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config b/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config index 82e4472874..dca9b502ca 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config +++ b/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz --dump-forces forces --dump-forces-fmt=%10.6f" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/plumed.dat index 527ea33178..1752024b03 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cv1: PYCVINTERFACE ATOMS=1,3 IMPORT=distcv CALCULATE=cv cv2: PYCVINTERFACE ATOMS=1,4 IMPORT=distcv CALCULATE=cv diff --git a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config +++ b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/plumed.dat index 4c7b6b9735..a31f126c5f 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cv1: PYCVINTERFACE ATOMS=@mdatoms IMPORT=pycvPerFrame CALCULATE=pydist PREPARE=changeAtom diff --git a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config +++ b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/plumed.dat index 4c7b6b9735..a31f126c5f 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cv1: PYCVINTERFACE ATOMS=@mdatoms IMPORT=pycvPerFrame CALCULATE=pydist PREPARE=changeAtom diff --git a/plugins/pycv/regtest/pycvcomm/rt-persistentData/config b/plugins/pycv/regtest/pycvcomm/rt-persistentData/config index 66a5c0dad7..a0ec704a92 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-persistentData/config +++ b/plugins/pycv/regtest/pycvcomm/rt-persistentData/config @@ -4,5 +4,31 @@ arg="--plumed plumed.dat --ixyz traj.xyz" #this will showcase that you can import a complex module!!! plumed_regtest_before(){ - cp -r ../pycvPersistentData . + cp -r ../pycvPersistentData . + + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 } diff --git a/plugins/pycv/regtest/pycvcomm/rt-persistentData/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-persistentData/plumed.dat index b5ebc5d1a4..dbbb42b33d 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-persistentData/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-persistentData/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cv1: PYCVINTERFACE ATOMS=@mdatoms IMPORT=pycvPersistentData CALCULATE=pydist INIT=pyinit diff --git a/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config b/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config +++ b/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/plumed.dat b/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/plumed.dat index 52ea575ec2..c4ea179df8 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/plumed.dat +++ b/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE diff --git a/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config b/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config +++ b/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/plumed.dat index 658124827e..3a6dda360f 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ d12c: DISTANCE ATOMS=1,2 COMPONENTS diff --git a/plugins/pycv/regtest/pycvfunc/rt-Components/config b/plugins/pycv/regtest/pycvfunc/rt-Components/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-Components/config +++ b/plugins/pycv/regtest/pycvfunc/rt-Components/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-Components/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-Components/plumed.dat index bb48f0c8f4..9521aa747d 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-Components/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-Components/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ dc: DISTANCE ATOMS=1,2 COMPONENTS diff --git a/plugins/pycv/regtest/pycvfunc/rt-MDinformations/config b/plugins/pycv/regtest/pycvfunc/rt-MDinformations/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-MDinformations/config +++ b/plugins/pycv/regtest/pycvfunc/rt-MDinformations/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-MDinformations/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-MDinformations/plumed.dat index b75648d8e9..163660f533 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-MDinformations/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-MDinformations/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ fPY: ... PYFUNCTION diff --git a/plugins/pycv/regtest/pycvfunc/rt-arguments/config b/plugins/pycv/regtest/pycvfunc/rt-arguments/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-arguments/config +++ b/plugins/pycv/regtest/pycvfunc/rt-arguments/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-arguments/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-arguments/plumed.dat index ced0f2f8df..9bcea812e5 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-arguments/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-arguments/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ d1: DISTANCE ATOMS=1,2 d2: DISTANCE ATOMS=1,3 diff --git a/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config b/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config +++ b/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/plumed.dat index 84460382e5..e4fb18fbd6 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ dc: DISTANCE ATOMS=1,2 COMPONENTS d: DISTANCE ATOMS=1,2 diff --git a/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config b/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config +++ b/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/plumed.dat index 84460382e5..e4fb18fbd6 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ dc: DISTANCE ATOMS=1,2 COMPONENTS d: DISTANCE ATOMS=1,2 diff --git a/plugins/pycv/regtest/pycvfunc/rt-derivative/config b/plugins/pycv/regtest/pycvfunc/rt-derivative/config index 7e13a932fd..a9b93b35ca 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-derivative/config +++ b/plugins/pycv/regtest/pycvfunc/rt-derivative/config @@ -9,3 +9,31 @@ plumed_regtest_after() { awk 'function abs(v) {return v < 0 ? -v : v} NR>1{print $1, $2, 0.0001 < abs($3-$4) } ' deriv_delta } + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-derivative/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-derivative/plumed.dat index 519df8b70c..4a1d9d609b 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-derivative/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-derivative/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ d1: DISTANCE ATOMS=1,2 d2: DISTANCE ATOMS=1,3 diff --git a/plugins/pycv/regtest/pycvfunc/rt-doc/config b/plugins/pycv/regtest/pycvfunc/rt-doc/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-doc/config +++ b/plugins/pycv/regtest/pycvfunc/rt-doc/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-doc/config.reference b/plugins/pycv/regtest/pycvfunc/rt-doc/config.reference index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-doc/config.reference +++ b/plugins/pycv/regtest/pycvfunc/rt-doc/config.reference @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-doc/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-doc/plumed.dat index f9618b43cf..05d656eacf 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-doc/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-doc/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvdist: PYFUNCTION IMPORT=pyhelp diff --git a/plugins/pycv/regtest/pycvfunc/rt-withPYCV/config b/plugins/pycv/regtest/pycvfunc/rt-withPYCV/config index 010fed6f0a..bca39af1e7 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-withPYCV/config +++ b/plugins/pycv/regtest/pycvfunc/rt-withPYCV/config @@ -1,3 +1,31 @@ type=driver arg="--plumed plumed.dat --ixyz traj.xyz" + +plumed_regtest_before() { + if [[ -z $PLUMED_PYTHON_BIN ]]; then + PLUMED_PYTHON_BIN=python + fi + pycvpath=$($PLUMED_PYTHON_BIN -m pycv) + sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat +} + +plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT"; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + if $PLUMED_PYTHON_BIN -c "import pycv"; then + return 1 + fi + + return 0 + fi + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import pycv" 2>/dev/null; then + if [ $python_bin != python ]; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/plugins/pycv/regtest/pycvfunc/rt-withPYCV/plumed.dat b/plugins/pycv/regtest/pycvfunc/rt-withPYCV/plumed.dat index a749a417cb..8d344a4078 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-withPYCV/plumed.dat +++ b/plugins/pycv/regtest/pycvfunc/rt-withPYCV/plumed.dat @@ -1,4 +1,4 @@ -LOAD FILE=../../../../PythonCVInterface.so +LOAD FILE=@pycvpath@ cvPY: ... PYCVINTERFACE From 62d8aba8c710111674590339186a1752c96abac6 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:52:49 +0200 Subject: [PATCH 29/46] resahping the python test --- plugins/pycv/pythontests/test_run.py | 181 ++++++++++++++------------- 1 file changed, 94 insertions(+), 87 deletions(-) diff --git a/plugins/pycv/pythontests/test_run.py b/plugins/pycv/pythontests/test_run.py index 91a68bcb20..e5e7fc2d70 100644 --- a/plugins/pycv/pythontests/test_run.py +++ b/plugins/pycv/pythontests/test_run.py @@ -5,6 +5,9 @@ import os from contextlib import contextmanager +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + @contextmanager def cd(newdir): prevdir = os.getcwd() @@ -14,93 +17,97 @@ def cd(newdir): finally: os.chdir(prevdir) -def read_xyz(filename): - xyz = open(filename) - n_atoms = int(xyz.readline()) - title = xyz.readline() - trajectory =[] - while True : - atom_type= np.zeros(n_atoms).astype(str) - coordinates = np.zeros([n_atoms,3]) - for i in range(0,n_atoms) : - line = xyz.readline() - atom,x,y,z = line.split() - atom_type[i]=atom - coordinates[i,:]=np.array([x,y,z],dtype=np.float64) - trajectory.append( coordinates ) - nextline = xyz.readline() - if( nextline=="" ) : break - c_atoms = int(nextline) - if( c_atoms!=n_atoms ) : break - title = xyz.readline() - xyz.close() - return trajectory - -def create_plumed_var( plmd, name, command ): - plmd.cmd("readInputLine", name + ": " + command ) - shape = np.zeros( 1, dtype=np.int_ ) - plmd.cmd("getDataRank " + name, shape ) - data = np.zeros((1)) - plmd.cmd("setMemoryForData " + name, data ) - return data - -class Test(unittest.TestCase): - def runtest(self): - from pycv import getPythonCVInterface - os.system('rm -f bck.*') - # Output to four decimal places only - np.set_printoptions(precision=4) - # Read trajectory - traj = read_xyz("traj.xyz") - num_frames = len(traj) - num_atoms = traj[0].shape[0] - - # Create arrays for stuff - box=np.diag(12.41642*np.ones(3,dtype=np.float64)) - virial=np.zeros((3,3),dtype=np.float64) - masses=np.ones(num_atoms,dtype=np.float64) - forces=np.random.rand(num_atoms,3) - charges=np.zeros(num_atoms,dtype=np.float64) - - # Create PLUMED object and read input - plmd = Plumed() - - # not really needed, used to check https://github.com/plumed/plumed2/issues/916 - plumed_version = np.zeros(1, dtype=np.intc) - plmd.cmd( "getApiVersion", plumed_version) - - plmd.cmd("setMDEngine","python") - plmd.cmd("setTimestep", 1.) - plmd.cmd("setKbT", 1.) - plmd.cmd("setNatoms",num_atoms) - plmd.cmd("setLogFile","test.log") - plmd.cmd("init") - # plmd.cmd("readInputLine","LOAD FILE=./PythonCVInterface.so") - plmd.cmd("readInputLine",f"LOAD FILE={getPythonCVInterface()}") - cvPy = create_plumed_var( plmd, "cvPy", "PYCVINTERFACE IMPORT=mypycv") - plmd.cmd("readInputLine","PRINT FILE=colvar.out ARG=*") - # Open an output file - with open("logfile", "w+") as of: - - # Now analyze the trajectory - for step in range(0,num_frames) : - of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n" ) - plmd.cmd("setStep",step ) - plmd.cmd("setBox",box ) - plmd.cmd("setMasses", masses ) - plmd.cmd("setCharges", charges ) - plmd.cmd("setPositions", traj[step]) - plmd.cmd("setForces", forces ) - plmd.cmd("setVirial", virial ) - plmd.cmd("calc") - - self.assertEqual(cvPy,2) - - - def test(self): - - self.runtest() + +def read_xyz(filename: str): + xyz = open(filename) + n_atoms = int(xyz.readline()) + _ = xyz.readline() + trajectory = [] + while True: + atom_type = np.zeros(n_atoms).astype(str) + coordinates = np.zeros([n_atoms, 3]) + for i in range(0, n_atoms): + line = xyz.readline() + atom, x, y, z = line.split() + atom_type[i] = atom + coordinates[i, :] = np.array([x, y, z], dtype=np.float64) + trajectory.append(coordinates) + nextline = xyz.readline() + if nextline == "": + break + c_atoms = int(nextline) + if c_atoms != n_atoms: + break + _ = xyz.readline() + xyz.close() + return trajectory + + +def create_plumed_var(plmd: Plumed, name: str, command: str): + plmd.cmd("readInputLine", name + ": " + command) + shape = np.zeros(1, dtype=np.int_) + plmd.cmd("getDataRank " + name, shape) + data = np.zeros((1)) + plmd.cmd("setMemoryForData " + name, data) + return data + + +class TestPyCV(unittest.TestCase): + def setUpTraj(self): + self.traj = read_xyz("traj.xyz") + self.num_frames = len(self.traj) + self.num_atoms = self.traj[0].shape[0] + + # Create arrays for stuff + self.box = np.diag(12.41642 * np.ones(3, dtype=np.float64)) + self.virial = np.zeros((3, 3), dtype=np.float64) + self.masses = np.ones(self.num_atoms, dtype=np.float64) + self.forces = np.random.rand(self.num_atoms, 3) + self.charges = np.zeros(self.num_atoms, dtype=np.float64) + + def preparePlumed(self): + from pycv import getPythonCVInterface + + # Create PLUMED object and read input + plmd = Plumed() + + # not really needed, used to check https://github.com/plumed/plumed2/issues/916 + plumed_version = np.zeros(1, dtype=np.intc) + plmd.cmd("getApiVersion", plumed_version) + plmd.cmd("setMDEngine", "python") + plmd.cmd("setTimestep", 1.0) + plmd.cmd("setKbT", 1.0) + plmd.cmd("setNatoms", self.num_atoms) + plmd.cmd("setLogFile", "test.log") + plmd.cmd("init") + plmd.cmd("readInputLine", f"LOAD FILE={getPythonCVInterface()}") + return plmd + + def test_nat(self): + with cd(THIS_DIR): + self.setUpTraj() + plmd = self.preparePlumed() + cvPy = create_plumed_var(plmd, "cvPy", "PYCVINTERFACE IMPORT=mypycv") + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + # Now analyze the trajectory + for step in range(0, self.num_frames): + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") + plmd.cmd("setStep", step) + plmd.cmd("setBox", self.box) + plmd.cmd("setMasses", self.masses) + plmd.cmd("setCharges", self.charges) + plmd.cmd("setPositions", self.traj[step]) + plmd.cmd("setForces", self.forces) + plmd.cmd("setVirial", self.virial) + plmd.cmd("calc") + + self.assertEqual(cvPy, 2) + if __name__ == "__main__": + os.environ["PLUMED_MAXBACKUP"] = "0" + # Output to four decimal places only + np.set_printoptions(precision=4) unittest.main() - From 287ae990b9e07263933985fc40dcead639ec75f8 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:44:17 +0200 Subject: [PATCH 30/46] adding some extra tests --- .../{mypycv.py => atoms_number.py} | 2 +- plugins/pycv/pythontests/pydistancePBCs.py | 1 + .../pycv/pythontests/pydistancegetAtPos.py | 1 + plugins/pycv/pythontests/test_run.py | 56 ++++++++++++++++++- 4 files changed, 57 insertions(+), 3 deletions(-) rename plugins/pycv/pythontests/{mypycv.py => atoms_number.py} (97%) create mode 120000 plugins/pycv/pythontests/pydistancePBCs.py create mode 120000 plugins/pycv/pythontests/pydistancegetAtPos.py diff --git a/plugins/pycv/pythontests/mypycv.py b/plugins/pycv/pythontests/atoms_number.py similarity index 97% rename from plugins/pycv/pythontests/mypycv.py rename to plugins/pycv/pythontests/atoms_number.py index 13b71e3a52..0f3bca1aaf 100644 --- a/plugins/pycv/pythontests/mypycv.py +++ b/plugins/pycv/pythontests/atoms_number.py @@ -1,5 +1,5 @@ import plumedCommunications as PLMD -import numpy + from sys import stderr as log # log = open("pydist.log", "w") diff --git a/plugins/pycv/pythontests/pydistancePBCs.py b/plugins/pycv/pythontests/pydistancePBCs.py new file mode 120000 index 0000000000..7e45c7145a --- /dev/null +++ b/plugins/pycv/pythontests/pydistancePBCs.py @@ -0,0 +1 @@ +../regtest/pycvcomm/rt-PBCs/pydistancePBCs.py \ No newline at end of file diff --git a/plugins/pycv/pythontests/pydistancegetAtPos.py b/plugins/pycv/pythontests/pydistancegetAtPos.py new file mode 120000 index 0000000000..7d693ec5cd --- /dev/null +++ b/plugins/pycv/pythontests/pydistancegetAtPos.py @@ -0,0 +1 @@ +../regtest/pycvcomm/rt-getPosition/pydistancegetAtPos.py \ No newline at end of file diff --git a/plugins/pycv/pythontests/test_run.py b/plugins/pycv/pythontests/test_run.py index e5e7fc2d70..8fbb59e367 100644 --- a/plugins/pycv/pythontests/test_run.py +++ b/plugins/pycv/pythontests/test_run.py @@ -85,9 +85,10 @@ def preparePlumed(self): def test_nat(self): with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" self.setUpTraj() plmd = self.preparePlumed() - cvPy = create_plumed_var(plmd, "cvPy", "PYCVINTERFACE IMPORT=mypycv") + cvPy = create_plumed_var(plmd, "cvPy", "PYCVINTERFACE IMPORT=atoms_number") plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") # Open an output file with open("logfile", "w+") as of: @@ -105,9 +106,60 @@ def test_nat(self): self.assertEqual(cvPy, 2) + def test_atomPositions(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + self.setUpTraj() + plmd = self.preparePlumed() + + cvPy=create_plumed_var(plmd, "cvPy", "PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancegetAtPos CALCULATE=pydist") + cvCPP=create_plumed_var(plmd, "cvCPP", "DISTANCE ATOMS=1,4 NOPBC") + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + # Now analyze the trajectory + for step in range(0, self.num_frames): + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") + plmd.cmd("setStep", step) + plmd.cmd("setBox", self.box) + plmd.cmd("setMasses", self.masses) + plmd.cmd("setCharges", self.charges) + plmd.cmd("setPositions", self.traj[step]) + plmd.cmd("setForces", self.forces) + plmd.cmd("setVirial", self.virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal(cvPy, cvCPP,decimal=4) + + def test_atomPositionsPBC(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + self.setUpTraj() + plmd = self.preparePlumed() + + cvPy=create_plumed_var(plmd, "cvPy", "PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancePBCs CALCULATE=pydist") + cvCPP=create_plumed_var(plmd, "cvCPP", "DISTANCE ATOMS=1,4") + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + # Now analyze the trajectory + for step in range(0, self.num_frames): + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") + plmd.cmd("setStep", step) + plmd.cmd("setBox", self.box) + plmd.cmd("setMasses", self.masses) + plmd.cmd("setCharges", self.charges) + plmd.cmd("setPositions", self.traj[step]) + plmd.cmd("setForces", self.forces) + plmd.cmd("setVirial", self.virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal(cvPy, cvCPP,decimal=4) + if __name__ == "__main__": - os.environ["PLUMED_MAXBACKUP"] = "0" # Output to four decimal places only np.set_printoptions(precision=4) unittest.main() From 557887be3cd710a86f368dca99b796de446fce80 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:47:17 +0200 Subject: [PATCH 31/46] updating the WF --- .github/workflows/linuxWF.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/linuxWF.yml b/.github/workflows/linuxWF.yml index 21a1237ea2..8c96987838 100644 --- a/.github/workflows/linuxWF.yml +++ b/.github/workflows/linuxWF.yml @@ -198,8 +198,7 @@ jobs: if: contains( matrix.variant, '-pycv-' ) working-directory: ./plugins/pycv/ run: | - pip install --user -r requirements.txt source ../../sourceme.sh ln -s $(realpath ../../regtest/scripts) ./regtest/scripts - ./prepareMakeForDevelop.sh make check + From 6e405e9fa6227290026ec0b190680e812bd7378b Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Thu, 17 Oct 2024 16:22:49 +0200 Subject: [PATCH 32/46] better makefile? --- plugins/pycv/Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/plugins/pycv/Makefile b/plugins/pycv/Makefile index 013840f7d5..0d23a37074 100644 --- a/plugins/pycv/Makefile +++ b/plugins/pycv/Makefile @@ -1,19 +1,24 @@ +#this makefiles assume that pip and pytest are installed .PHONY: clean check check_standalone check_python all all: pycv_here pycv_here: src/*.cpp src/*.h src/pycv/*.py - @python3 -m pip install . - @which python3 > $@ + @echo installing pycv + pip install . + touch $@ clean: - @python3 -m pip uninstall pycv + pip uninstall pycv + rm -fv pycv_here -check_standalone: +check_standalone: pycv_here $(MAKE) -C regtest testclean $(MAKE) -C regtest checkfail -check_python: - python3 -m pytest +#just in case pytest is still not installed we install it before the tests +check_python: pycv_here + pip install pytest + pytest check: check_standalone check_python From 840993e5cfa3654971ae3d8bc7b48ad9d52a17b9 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 18 Oct 2024 12:19:02 +0200 Subject: [PATCH 33/46] addressing a problem with master --- plugins/pycv/pythontests/pycvPerFrame.py | 1 + plugins/pycv/pythontests/pycvPerFrameSTR.py | 1 + plugins/pycv/pythontests/test_cv.py | 167 ++++++++++++++++++ plugins/pycv/pythontests/test_run.py | 165 ----------------- .../pycv/pythontests/trajnewFrameNewAtom.xyz | 24 +++ .../pycv/pythontests/utilities_for_test.py | 84 +++++++++ plugins/pycv/src/PythonCVInterface.cpp | 3 + 7 files changed, 280 insertions(+), 165 deletions(-) create mode 120000 plugins/pycv/pythontests/pycvPerFrame.py create mode 120000 plugins/pycv/pythontests/pycvPerFrameSTR.py create mode 100644 plugins/pycv/pythontests/test_cv.py delete mode 100644 plugins/pycv/pythontests/test_run.py create mode 100644 plugins/pycv/pythontests/trajnewFrameNewAtom.xyz create mode 100644 plugins/pycv/pythontests/utilities_for_test.py diff --git a/plugins/pycv/pythontests/pycvPerFrame.py b/plugins/pycv/pythontests/pycvPerFrame.py new file mode 120000 index 0000000000..72efc4907a --- /dev/null +++ b/plugins/pycv/pythontests/pycvPerFrame.py @@ -0,0 +1 @@ +../regtest/pycvcomm/rt-newFrameNewAtom/pycvPerFrame.py \ No newline at end of file diff --git a/plugins/pycv/pythontests/pycvPerFrameSTR.py b/plugins/pycv/pythontests/pycvPerFrameSTR.py new file mode 120000 index 0000000000..fe96d1970c --- /dev/null +++ b/plugins/pycv/pythontests/pycvPerFrameSTR.py @@ -0,0 +1 @@ +../regtest/pycvcomm/rt-newFrameNewAtomSTR/pycvPerFrame.py \ No newline at end of file diff --git a/plugins/pycv/pythontests/test_cv.py b/plugins/pycv/pythontests/test_cv.py new file mode 100644 index 0000000000..44f78224a5 --- /dev/null +++ b/plugins/pycv/pythontests/test_cv.py @@ -0,0 +1,167 @@ +import unittest +import numpy as np + +from utilities_for_test import * + +import os + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class TestPyCV(unittest.TestCase): + def test_nat(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, num_frames, num_atoms, box, virial, masses, forces, charges = ( + setUpTraj("traj.xyz") + ) + plmd = preparePlumed(num_atoms) + cvPy = create_plumed_var(plmd, "cvPy", "PYCVINTERFACE IMPORT=atoms_number") + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + # Now analyze the trajectory + for step in range(0, num_frames): + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + + self.assertEqual(cvPy, 2) + + def test_atomPositions(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, num_frames, num_atoms, box, virial, masses, forces, charges = ( + setUpTraj("traj.xyz") + ) + plmd = preparePlumed(num_atoms) + + cvPy = create_plumed_var( + plmd, + "cvPy", + "PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancegetAtPos CALCULATE=pydist", + ) + cvCPP = create_plumed_var(plmd, "cvCPP", "DISTANCE ATOMS=1,4 NOPBC") + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + # Now analyze the trajectory + for step in range(0, num_frames): + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal(cvPy, cvCPP, decimal=4) + + def test_atomPositionsPBC(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, num_frames, num_atoms, box, virial, masses, forces, charges = ( + setUpTraj("traj.xyz") + ) + plmd = preparePlumed(num_atoms) + + cvPy = create_plumed_var( + plmd, + "cvPy", + "PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancePBCs CALCULATE=pydist", + ) + cvCPP = create_plumed_var(plmd, "cvCPP", "DISTANCE ATOMS=1,4") + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + # Now analyze the trajectory + for step in range(0, num_frames): + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal(cvPy, cvCPP, decimal=4) + + def test_newFrameNewAtomSTR(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, num_frames, num_atoms, box, virial, masses, forces, charges = ( + setUpTraj("trajnewFrameNewAtom.xyz") + ) + plmd = preparePlumed(num_atoms) + + cvPy = create_plumed_var( + plmd, + "cvPy", + "PYCVINTERFACE ATOMS=@mdatoms IMPORT=pycvPerFrameSTR CALCULATE=pydist PREPARE=changeAtom", + ) + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + # Now analyze the trajectory + for step in range(0, num_frames): + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal(cvPy, step + 1.0, decimal=4) + + def test_newFrameNewAtom(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, num_frames, num_atoms, box, virial, masses, forces, charges = ( + setUpTraj("trajnewFrameNewAtom.xyz") + ) + plmd = preparePlumed(num_atoms) + + cvPy = create_plumed_var( + plmd, + "cvPy", + "PYCVINTERFACE ATOMS=@mdatoms IMPORT=pycvPerFrame CALCULATE=pydist PREPARE=changeAtom", + ) + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + with open("logfile", "w+") as of: + # Now analyze the trajectory + for step in range(0, num_frames): + of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal(cvPy, step + 1.0, decimal=4) + + +if __name__ == "__main__": + # Output to four decimal places only + np.set_printoptions(precision=4) + unittest.main() diff --git a/plugins/pycv/pythontests/test_run.py b/plugins/pycv/pythontests/test_run.py deleted file mode 100644 index 8fbb59e367..0000000000 --- a/plugins/pycv/pythontests/test_run.py +++ /dev/null @@ -1,165 +0,0 @@ -import unittest -import numpy as np -from plumed import Plumed - -import os -from contextlib import contextmanager - -THIS_DIR = os.path.dirname(os.path.abspath(__file__)) - - -@contextmanager -def cd(newdir): - prevdir = os.getcwd() - os.chdir(newdir) - try: - yield - finally: - os.chdir(prevdir) - - -def read_xyz(filename: str): - xyz = open(filename) - n_atoms = int(xyz.readline()) - _ = xyz.readline() - trajectory = [] - while True: - atom_type = np.zeros(n_atoms).astype(str) - coordinates = np.zeros([n_atoms, 3]) - for i in range(0, n_atoms): - line = xyz.readline() - atom, x, y, z = line.split() - atom_type[i] = atom - coordinates[i, :] = np.array([x, y, z], dtype=np.float64) - trajectory.append(coordinates) - nextline = xyz.readline() - if nextline == "": - break - c_atoms = int(nextline) - if c_atoms != n_atoms: - break - _ = xyz.readline() - xyz.close() - return trajectory - - -def create_plumed_var(plmd: Plumed, name: str, command: str): - plmd.cmd("readInputLine", name + ": " + command) - shape = np.zeros(1, dtype=np.int_) - plmd.cmd("getDataRank " + name, shape) - data = np.zeros((1)) - plmd.cmd("setMemoryForData " + name, data) - return data - - -class TestPyCV(unittest.TestCase): - def setUpTraj(self): - self.traj = read_xyz("traj.xyz") - self.num_frames = len(self.traj) - self.num_atoms = self.traj[0].shape[0] - - # Create arrays for stuff - self.box = np.diag(12.41642 * np.ones(3, dtype=np.float64)) - self.virial = np.zeros((3, 3), dtype=np.float64) - self.masses = np.ones(self.num_atoms, dtype=np.float64) - self.forces = np.random.rand(self.num_atoms, 3) - self.charges = np.zeros(self.num_atoms, dtype=np.float64) - - def preparePlumed(self): - from pycv import getPythonCVInterface - - # Create PLUMED object and read input - plmd = Plumed() - - # not really needed, used to check https://github.com/plumed/plumed2/issues/916 - plumed_version = np.zeros(1, dtype=np.intc) - plmd.cmd("getApiVersion", plumed_version) - plmd.cmd("setMDEngine", "python") - plmd.cmd("setTimestep", 1.0) - plmd.cmd("setKbT", 1.0) - plmd.cmd("setNatoms", self.num_atoms) - plmd.cmd("setLogFile", "test.log") - plmd.cmd("init") - plmd.cmd("readInputLine", f"LOAD FILE={getPythonCVInterface()}") - return plmd - - def test_nat(self): - with cd(THIS_DIR): - os.environ["PLUMED_MAXBACKUP"] = "0" - self.setUpTraj() - plmd = self.preparePlumed() - cvPy = create_plumed_var(plmd, "cvPy", "PYCVINTERFACE IMPORT=atoms_number") - plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") - # Open an output file - with open("logfile", "w+") as of: - # Now analyze the trajectory - for step in range(0, self.num_frames): - of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") - plmd.cmd("setStep", step) - plmd.cmd("setBox", self.box) - plmd.cmd("setMasses", self.masses) - plmd.cmd("setCharges", self.charges) - plmd.cmd("setPositions", self.traj[step]) - plmd.cmd("setForces", self.forces) - plmd.cmd("setVirial", self.virial) - plmd.cmd("calc") - - self.assertEqual(cvPy, 2) - - def test_atomPositions(self): - with cd(THIS_DIR): - os.environ["PLUMED_MAXBACKUP"] = "0" - self.setUpTraj() - plmd = self.preparePlumed() - - cvPy=create_plumed_var(plmd, "cvPy", "PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancegetAtPos CALCULATE=pydist") - cvCPP=create_plumed_var(plmd, "cvCPP", "DISTANCE ATOMS=1,4 NOPBC") - - plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") - # Open an output file - with open("logfile", "w+") as of: - # Now analyze the trajectory - for step in range(0, self.num_frames): - of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") - plmd.cmd("setStep", step) - plmd.cmd("setBox", self.box) - plmd.cmd("setMasses", self.masses) - plmd.cmd("setCharges", self.charges) - plmd.cmd("setPositions", self.traj[step]) - plmd.cmd("setForces", self.forces) - plmd.cmd("setVirial", self.virial) - plmd.cmd("calc") - - np.testing.assert_almost_equal(cvPy, cvCPP,decimal=4) - - def test_atomPositionsPBC(self): - with cd(THIS_DIR): - os.environ["PLUMED_MAXBACKUP"] = "0" - self.setUpTraj() - plmd = self.preparePlumed() - - cvPy=create_plumed_var(plmd, "cvPy", "PYCVINTERFACE ATOMS=1,4 IMPORT=pydistancePBCs CALCULATE=pydist") - cvCPP=create_plumed_var(plmd, "cvCPP", "DISTANCE ATOMS=1,4") - - plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") - # Open an output file - with open("logfile", "w+") as of: - # Now analyze the trajectory - for step in range(0, self.num_frames): - of.write("RUNNING ANALYSIS FOR STEP " + str(step) + "\n") - plmd.cmd("setStep", step) - plmd.cmd("setBox", self.box) - plmd.cmd("setMasses", self.masses) - plmd.cmd("setCharges", self.charges) - plmd.cmd("setPositions", self.traj[step]) - plmd.cmd("setForces", self.forces) - plmd.cmd("setVirial", self.virial) - plmd.cmd("calc") - - np.testing.assert_almost_equal(cvPy, cvCPP,decimal=4) - - -if __name__ == "__main__": - # Output to four decimal places only - np.set_printoptions(precision=4) - unittest.main() diff --git a/plugins/pycv/pythontests/trajnewFrameNewAtom.xyz b/plugins/pycv/pythontests/trajnewFrameNewAtom.xyz new file mode 100644 index 0000000000..ead294112f --- /dev/null +++ b/plugins/pycv/pythontests/trajnewFrameNewAtom.xyz @@ -0,0 +1,24 @@ +4 +100 100 100 +X 0 0 0 +X 0 0 1 +X 0 0 0 +X 0 0 0 +4 +100 100 100 +X 0 0 0 +X 0 0 0 +X 0 0 2 +X 0 0 0 +4 +100 100 100 +X 0 0 0 +X 0 0 0 +X 0 0 0 +X 0 0 3 +4 +100 100 100 +X 0 0 0 +X 0 0 4 +X 0 0 0 +X 0 0 0 diff --git a/plugins/pycv/pythontests/utilities_for_test.py b/plugins/pycv/pythontests/utilities_for_test.py new file mode 100644 index 0000000000..1c62b7ddab --- /dev/null +++ b/plugins/pycv/pythontests/utilities_for_test.py @@ -0,0 +1,84 @@ +from plumed import Plumed +from contextlib import contextmanager +import os +import numpy as np + +__all__ = ["read_xyz", "setUpTraj", "preparePlumed", "cd", "create_plumed_var"] + + +@contextmanager +def cd(newdir): + prevdir = os.getcwd() + os.chdir(newdir) + try: + yield + finally: + os.chdir(prevdir) + + +def read_xyz(filename: str): + xyz = open(filename) + n_atoms = int(xyz.readline()) + _ = xyz.readline() + trajectory = [] + while True: + atom_type = np.zeros(n_atoms).astype(str) + coordinates = np.zeros([n_atoms, 3]) + for i in range(0, n_atoms): + line = xyz.readline() + atom, x, y, z = line.split() + atom_type[i] = atom + coordinates[i, :] = np.array([x, y, z], dtype=np.float64) + trajectory.append(coordinates) + nextline = xyz.readline() + if nextline == "": + break + c_atoms = int(nextline) + if c_atoms != n_atoms: + break + _ = xyz.readline() + xyz.close() + return trajectory + + +def setUpTraj(trajfile: str): + traj = read_xyz(trajfile) + num_frames = len(traj) + num_atoms = traj[0].shape[0] + + # Create arrays for stuff + box = np.diag(12.41642 * np.ones(3, dtype=np.float64)) + virial = np.zeros((3, 3), dtype=np.float64) + masses = np.ones(num_atoms, dtype=np.float64) + forces = np.random.rand(num_atoms, 3) + charges = np.zeros(num_atoms, dtype=np.float64) + + return traj, num_frames, num_atoms, box, virial, masses, forces, charges + + +def preparePlumed(num_atoms: int): + from pycv import getPythonCVInterface + + # Create PLUMED object and read input + plmd = Plumed() + + # not really needed, used to check https://github.com/plumed/plumed2/issues/916 + plumed_version = np.zeros(1, dtype=np.intc) + plmd.cmd("getApiVersion", plumed_version) + plmd.cmd("setMDEngine", "python") + plmd.cmd("setTimestep", 1.0) + plmd.cmd("setKbT", 1.0) + plmd.cmd("setNatoms", num_atoms) + plmd.cmd("setLogFile", "test.log") + plmd.cmd("init") + plmd.cmd("readInputLine", f"LOAD FILE={getPythonCVInterface()}") + return plmd + + +def create_plumed_var(plmd: Plumed, name: str, command: str): + plmd.cmd("readInputLine", name + ": " + command) + shape = np.zeros(1, dtype=np.int_) + plmd.cmd("getDataRank " + name, shape) + data = np.zeros((1)) + plmd.cmd("setMemoryForData " + name, data) + return data diff --git a/plugins/pycv/src/PythonCVInterface.cpp b/plugins/pycv/src/PythonCVInterface.cpp index 08fb1fe9ef..bf725b7c17 100644 --- a/plugins/pycv/src/PythonCVInterface.cpp +++ b/plugins/pycv/src/PythonCVInterface.cpp @@ -422,6 +422,7 @@ PythonCVInterface::PythonCVInterface(const ActionOptions&ao) ://the catch only a PLUMED_COLVAR_INIT(ao), ActionWithPython(ao) { try { + py::gil_scoped_acquire gil; //Loading the python module std::string import; parse("IMPORT",import); @@ -612,6 +613,7 @@ void PythonCVInterface::prepare() { } } if (hasPrepare) { + py::gil_scoped_acquire gil; py::dict prepareDict = pyPrepare(this); if (prepareDict.contains("setAtomRequest")) { //should I use "interpretAtomList"? @@ -657,6 +659,7 @@ void PythonCVInterface::calculate() { nl->update(getPositions()); } } + py::gil_scoped_acquire gil; // Call the function py::object r = pyCalculate(this); if(getNumberOfComponents()>1) { // MULTIPLE NAMED COMPONENTS From a22dd66a283770f00741a793d6853c07d6063a63 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:03:20 +0200 Subject: [PATCH 34/46] Now pycv appears to load correcly --- plugins/pycv/pythontests/justInit.py | 10 ++ plugins/pycv/pythontests/justInitDict.py | 8 ++ plugins/pycv/pythontests/justPrepare.py | 13 +++ plugins/pycv/pythontests/justUpdate.py | 12 +++ plugins/pycv/pythontests/test_cv_calls.py | 122 ++++++++++++++++++++++ plugins/pycv/src/PythonCVInterface.cpp | 1 + 6 files changed, 166 insertions(+) create mode 100644 plugins/pycv/pythontests/justInit.py create mode 100644 plugins/pycv/pythontests/justInitDict.py create mode 100644 plugins/pycv/pythontests/justPrepare.py create mode 100644 plugins/pycv/pythontests/justUpdate.py create mode 100644 plugins/pycv/pythontests/test_cv_calls.py diff --git a/plugins/pycv/pythontests/justInit.py b/plugins/pycv/pythontests/justInit.py new file mode 100644 index 0000000000..b0df723d36 --- /dev/null +++ b/plugins/pycv/pythontests/justInit.py @@ -0,0 +1,10 @@ +import numpy as np +import plumedCommunications + + +def myInit(_: plumedCommunications.PythonCVInterface): + return{"Value": plumedCommunications.defaults.COMPONENT_NODEV,} + +def plumedCalculate(action: plumedCommunications.PythonCVInterface): + at: np.ndarray = action.getPositions() + return at[0][0]+at[0][1] diff --git a/plugins/pycv/pythontests/justInitDict.py b/plugins/pycv/pythontests/justInitDict.py new file mode 100644 index 0000000000..009b089f4f --- /dev/null +++ b/plugins/pycv/pythontests/justInitDict.py @@ -0,0 +1,8 @@ +import numpy as np +import plumedCommunications + +plumedInit={"Value": plumedCommunications.defaults.COMPONENT,} + +def plumedCalculate(action: plumedCommunications.PythonCVInterface): + at: np.ndarray = action.getPositions() + return at[0][0]+at[0][1] diff --git a/plugins/pycv/pythontests/justPrepare.py b/plugins/pycv/pythontests/justPrepare.py new file mode 100644 index 0000000000..1e1bb7301f --- /dev/null +++ b/plugins/pycv/pythontests/justPrepare.py @@ -0,0 +1,13 @@ +import numpy as np +import plumedCommunications + +plumedInit={"Value": plumedCommunications.defaults.COMPONENT,} + +def plumedPrepare(_: plumedCommunications.PythonCVInterface): + toret = {"setAtomRequest": f"1"} + return toret + + +def plumedCalculate(action: plumedCommunications.PythonCVInterface): + at: np.ndarray = action.getPositions() + return at[0][0]+at[0][1] diff --git a/plugins/pycv/pythontests/justUpdate.py b/plugins/pycv/pythontests/justUpdate.py new file mode 100644 index 0000000000..182049abf5 --- /dev/null +++ b/plugins/pycv/pythontests/justUpdate.py @@ -0,0 +1,12 @@ +import numpy as np +import plumedCommunications + +plumedInit={"Value": plumedCommunications.defaults.COMPONENT,} + +def myUpdate(_: plumedCommunications.PythonCVInterface): + print("myUpdate") + return {} + +def plumedCalculate(action: plumedCommunications.PythonCVInterface): + at: np.ndarray = action.getPositions() + return at[0][0]+at[0][1] diff --git a/plugins/pycv/pythontests/test_cv_calls.py b/plugins/pycv/pythontests/test_cv_calls.py new file mode 100644 index 0000000000..d32264cc1e --- /dev/null +++ b/plugins/pycv/pythontests/test_cv_calls.py @@ -0,0 +1,122 @@ +import unittest +import numpy as np + +from utilities_for_test import * + +import os + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class TestPyCV(unittest.TestCase): + def test_INIT(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, _, num_atoms, box, virial, masses, forces, charges = setUpTraj( + "traj.xyz" + ) + plmd = preparePlumed(num_atoms) + + cvPy = create_plumed_var( + plmd, "cvPy", "PYCVINTERFACE ATOMS=4 IMPORT=justInit INIT=myInit" + ) + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + + step = 0 + + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + np.testing.assert_almost_equal(cvPy, 10.0, decimal=4) + + def test_INITDICT(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, _, num_atoms, box, virial, masses, forces, charges = setUpTraj( + "traj.xyz" + ) + plmd = preparePlumed(num_atoms) + + cvPy = create_plumed_var( + plmd, "cvPy", "PYCVINTERFACE ATOMS=4 IMPORT=justInitDict" + ) + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + + step = 0 + + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + np.testing.assert_almost_equal(cvPy, 10.0, decimal=4) + + def test_UPDATE(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, _, num_atoms, box, virial, masses, forces, charges = setUpTraj( + "traj.xyz" + ) + plmd = preparePlumed(num_atoms) + + cvPy = create_plumed_var( + plmd, "cvPy", "PYCVINTERFACE ATOMS=4 IMPORT=justUpdate UPDATE=myUpdate" + ) + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + + step = 0 + + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + np.testing.assert_almost_equal(cvPy, 10.0, decimal=4) + + def test_PREPARE(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, _, num_atoms, box, virial, masses, forces, charges = setUpTraj( + "traj.xyz" + ) + plmd = preparePlumed(num_atoms) + #atoms=4 but the module choses 1 + cvPy = create_plumed_var( + plmd, "cvPy", "PYCVINTERFACE ATOMS=4 IMPORT=justPrepare PREPARE=plumedPrepare") + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + # Open an output file + + step = 0 + + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal(cvPy, 5.0, decimal=4) + + + + +if __name__ == "__main__": + # Output to four decimal places only + np.set_printoptions(precision=4) + unittest.main() diff --git a/plugins/pycv/src/PythonCVInterface.cpp b/plugins/pycv/src/PythonCVInterface.cpp index bf725b7c17..4632abf8c6 100644 --- a/plugins/pycv/src/PythonCVInterface.cpp +++ b/plugins/pycv/src/PythonCVInterface.cpp @@ -643,6 +643,7 @@ void PythonCVInterface::prepare() { void PythonCVInterface::update() { try { if(hasUpdate) { + py::gil_scoped_acquire gil; py::dict updateDict=pyUpdate(this); //See what to do here } From b3e9f22df0955fe22c7e010ce4bce7549df416a9 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:18:58 +0200 Subject: [PATCH 35/46] added an extra test --- plugins/pycv/pythontests/pycvPersistentData | 1 + plugins/pycv/pythontests/test_cv.py | 33 +++++++++++++++++++++ plugins/pycv/pythontests/test_cv_calls.py | 9 +++--- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 120000 plugins/pycv/pythontests/pycvPersistentData diff --git a/plugins/pycv/pythontests/pycvPersistentData b/plugins/pycv/pythontests/pycvPersistentData new file mode 120000 index 0000000000..e74d2380e4 --- /dev/null +++ b/plugins/pycv/pythontests/pycvPersistentData @@ -0,0 +1 @@ +../regtest/pycvcomm/rt-persistentData/pycvPersistentData \ No newline at end of file diff --git a/plugins/pycv/pythontests/test_cv.py b/plugins/pycv/pythontests/test_cv.py index 44f78224a5..7d0ddc1631 100644 --- a/plugins/pycv/pythontests/test_cv.py +++ b/plugins/pycv/pythontests/test_cv.py @@ -160,6 +160,39 @@ def test_newFrameNewAtom(self): np.testing.assert_almost_equal(cvPy, step + 1.0, decimal=4) + def test_loadAmodule_and_persistData(self): + """This test loads a module that is a directory and stores some data within plumed""" + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, num_frames, num_atoms, box, virial, masses, forces, charges = ( + setUpTraj("trajnewFrameNewAtom.xyz") + ) + plmd = preparePlumed(num_atoms) + + cvPy = create_plumed_var( + plmd, + "cvPy", + "PYCVINTERFACE ATOMS=@mdatoms IMPORT=pycvPersistentData CALCULATE=pydist INIT=pyinit", + ) + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + + # Now analyze the trajectory + for step in range(0, num_frames): + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + # this cv sums the number of the step till now: + # to future me: "//" is integer (floor) division + np.testing.assert_almost_equal( + cvPy, ((step) * (step + 1)) // 2, decimal=4 + ) + if __name__ == "__main__": # Output to four decimal places only diff --git a/plugins/pycv/pythontests/test_cv_calls.py b/plugins/pycv/pythontests/test_cv_calls.py index d32264cc1e..49ec3efd10 100644 --- a/plugins/pycv/pythontests/test_cv_calls.py +++ b/plugins/pycv/pythontests/test_cv_calls.py @@ -94,9 +94,12 @@ def test_PREPARE(self): "traj.xyz" ) plmd = preparePlumed(num_atoms) - #atoms=4 but the module choses 1 + # atoms=4 but the module choses 1 cvPy = create_plumed_var( - plmd, "cvPy", "PYCVINTERFACE ATOMS=4 IMPORT=justPrepare PREPARE=plumedPrepare") + plmd, + "cvPy", + "PYCVINTERFACE ATOMS=4 IMPORT=justPrepare PREPARE=plumedPrepare", + ) plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") # Open an output file @@ -114,8 +117,6 @@ def test_PREPARE(self): np.testing.assert_almost_equal(cvPy, 5.0, decimal=4) - - if __name__ == "__main__": # Output to four decimal places only np.set_printoptions(precision=4) From a699ba578494411f80ec96ef4adbf659c2595248 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:00:38 +0200 Subject: [PATCH 36/46] set up aslo a few basic tests for pyfunc --- plugins/pycv/Makefile | 2 +- plugins/pycv/astyle.sh | 3 +- plugins/pycv/pythontests/pyfuncINITdict.py | 1 + plugins/pycv/pythontests/pyfuncINITfunc.py | 1 + plugins/pycv/pythontests/test_cv_calls.py | 2 +- plugins/pycv/pythontests/test_fun_calls.py | 92 +++++++++++++++++++ .../pycvfunc/rt-derivative/unitTest.py | 2 +- plugins/pycv/src/PythonFunction.cpp | 2 + 8 files changed, 101 insertions(+), 4 deletions(-) create mode 120000 plugins/pycv/pythontests/pyfuncINITdict.py create mode 120000 plugins/pycv/pythontests/pyfuncINITfunc.py create mode 100644 plugins/pycv/pythontests/test_fun_calls.py diff --git a/plugins/pycv/Makefile b/plugins/pycv/Makefile index 0d23a37074..3f07f69ade 100644 --- a/plugins/pycv/Makefile +++ b/plugins/pycv/Makefile @@ -19,6 +19,6 @@ check_standalone: pycv_here #just in case pytest is still not installed we install it before the tests check_python: pycv_here pip install pytest - pytest + pytest -v check: check_standalone check_python diff --git a/plugins/pycv/astyle.sh b/plugins/pycv/astyle.sh index 51b0a7be36..86a2d3da7f 100755 --- a/plugins/pycv/astyle.sh +++ b/plugins/pycv/astyle.sh @@ -3,13 +3,14 @@ #formatted with shfmt https://github.com/mvdan/sh/releases #checked with shellcheck +cd src || exit 1 for file in *.c *.cpp *.h *.inc.in; do test -f "$file" || continue echo -n "astyle $file" - ../../astyle/astyle --options=../../.astyle.options <"$file" >"${file}.tmp" && { + ../../../astyle/astyle --options=../../../.astyle.options <"$file" >"${file}.tmp" && { if cmp -s "$file" "${file}.tmp"; then echo else diff --git a/plugins/pycv/pythontests/pyfuncINITdict.py b/plugins/pycv/pythontests/pyfuncINITdict.py new file mode 120000 index 0000000000..eb9f725611 --- /dev/null +++ b/plugins/pycv/pythontests/pyfuncINITdict.py @@ -0,0 +1 @@ +../regtest/pycvfunc/rt-argumentsArray/unitTest.py \ No newline at end of file diff --git a/plugins/pycv/pythontests/pyfuncINITfunc.py b/plugins/pycv/pythontests/pyfuncINITfunc.py new file mode 120000 index 0000000000..d6961d59ba --- /dev/null +++ b/plugins/pycv/pythontests/pyfuncINITfunc.py @@ -0,0 +1 @@ +../regtest/pycvfunc/rt-derivative/unitTest.py \ No newline at end of file diff --git a/plugins/pycv/pythontests/test_cv_calls.py b/plugins/pycv/pythontests/test_cv_calls.py index 49ec3efd10..4c6086cbf4 100644 --- a/plugins/pycv/pythontests/test_cv_calls.py +++ b/plugins/pycv/pythontests/test_cv_calls.py @@ -8,7 +8,7 @@ THIS_DIR = os.path.dirname(os.path.abspath(__file__)) -class TestPyCV(unittest.TestCase): +class TestPyCVCalls(unittest.TestCase): def test_INIT(self): with cd(THIS_DIR): os.environ["PLUMED_MAXBACKUP"] = "0" diff --git a/plugins/pycv/pythontests/test_fun_calls.py b/plugins/pycv/pythontests/test_fun_calls.py new file mode 100644 index 0000000000..3ba155d062 --- /dev/null +++ b/plugins/pycv/pythontests/test_fun_calls.py @@ -0,0 +1,92 @@ +import unittest +import numpy as np + +from utilities_for_test import * + +import os + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + +# CALCULATE is tested "by default" + + +class TestFunctionCalls(unittest.TestCase): + def test_INIT(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, num_frames, num_atoms, box, virial, masses, forces, charges = ( + setUpTraj("traj.xyz") + ) + plmd = preparePlumed(num_atoms) + d1 = create_plumed_var(plmd, "d1", "DISTANCE ATOMS=1,2") + d2 = create_plumed_var(plmd, "d2", "DISTANCE ATOMS=1,3") + + fPy = create_plumed_var( + plmd, + "fPY", + "PYFUNCTION IMPORT=pyfuncINITfunc INIT=initForF CALCULATE=function ARG=d1,d2", + ) + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + + for step in range(num_frames): + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal(fPy, d1 * d2, decimal=4) + + def test_INITDICT(self): + with cd(THIS_DIR): + os.environ["PLUMED_MAXBACKUP"] = "0" + traj, num_frames, num_atoms, box, virial, masses, forces, charges = ( + setUpTraj("traj.xyz") + ) + plmd = preparePlumed(num_atoms) + + plmd.cmd("readInputLine", "dc: DISTANCE ATOMS=1,2 COMPONENTS") + shape = np.zeros(1, dtype=np.int_) + plmd.cmd("getDataRank " + "dc.x", shape) + plmd.cmd("getDataRank " + "dc.y", shape) + plmd.cmd("getDataRank " + "dc.z", shape) + dcx = np.zeros((1)) + dcy = np.zeros((1)) + dcz = np.zeros((1)) + plmd.cmd("setMemoryForData dc.x", dcx) + plmd.cmd("setMemoryForData dc.y", dcy) + plmd.cmd("setMemoryForData dc.z", dcz) + + d = create_plumed_var(plmd, "d", "DISTANCE ATOMS=1,2") + + fPy = create_plumed_var( + plmd, + "fPY", + "PYFUNCTION IMPORT=pyfuncINITdict INIT=initForF CALCULATE=function ARG=dc.x,dc.y,dc.z,d", + ) + + plmd.cmd("readInputLine", "PRINT FILE=colvar.out ARG=*") + + for step in range(num_frames): + plmd.cmd("setStep", step) + plmd.cmd("setBox", box) + plmd.cmd("setMasses", masses) + plmd.cmd("setCharges", charges) + plmd.cmd("setPositions", traj[step]) + plmd.cmd("setForces", forces) + plmd.cmd("setVirial", virial) + plmd.cmd("calc") + + np.testing.assert_almost_equal( + fPy, np.abs(np.sqrt(dcx**2 + dcy**2 + dcz**2) - d[0]), decimal=4 + ) + + +if __name__ == "__main__": + # Output to four decimal places only + np.set_printoptions(precision=4) + unittest.main() diff --git a/plugins/pycv/regtest/pycvfunc/rt-derivative/unitTest.py b/plugins/pycv/regtest/pycvfunc/rt-derivative/unitTest.py index a0c386bfe1..a1ffa9d34c 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-derivative/unitTest.py +++ b/plugins/pycv/regtest/pycvfunc/rt-derivative/unitTest.py @@ -5,7 +5,7 @@ print("Imported my pydist+.", file=log) -initForF={"Value": PLMD.defaults.COMPONENT} +def initForF(_: PLMD.PythonFunction): return {"Value": PLMD.defaults.COMPONENT} def function(action: PLMD.PythonFunction): arg = [action.argument(0), diff --git a/plugins/pycv/src/PythonFunction.cpp b/plugins/pycv/src/PythonFunction.cpp index 23d007063e..633c04f3a8 100644 --- a/plugins/pycv/src/PythonFunction.cpp +++ b/plugins/pycv/src/PythonFunction.cpp @@ -120,6 +120,7 @@ PythonFunction::PythonFunction(const ActionOptions&ao): Function(ao), ActionWithPython(ao) { try { + py::gil_scoped_acquire gil; //Loading the python module std::string import; parse("IMPORT",import); @@ -205,6 +206,7 @@ PythonFunction::PythonFunction(const ActionOptions&ao): // calculator void PythonFunction::calculate() { try { + py::gil_scoped_acquire gil; // Call the function py::object r = pyCalculate(this); if(getNumberOfComponents()>1) { // MULTIPLE NAMED COMPONENTS From 42a8dfc387365139277fe6bb3efcda7cce1d66ae Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:39:44 +0200 Subject: [PATCH 37/46] updated the docker recipes with the new installation method of pycv --- docker/fedora39-pycv | 2 -- docker/rocky8-pycv | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/docker/fedora39-pycv b/docker/fedora39-pycv index 80b6ed15d7..30cf608be3 100644 --- a/docker/fedora39-pycv +++ b/docker/fedora39-pycv @@ -5,7 +5,5 @@ RUN source /etc/bashrc \ && cd plumed2 \ && source ./sourceme.sh \ && cd plugins/pycv \ - && pip3 install -r requirements.txt \ && ln -s $(realpath ../../regtest/scripts) ./regtest/scripts \ - && python_bin=python3 ./prepareMakeForDevelop.sh \ && make check diff --git a/docker/rocky8-pycv b/docker/rocky8-pycv index 7dedd42ce3..ffaf7036cc 100644 --- a/docker/rocky8-pycv +++ b/docker/rocky8-pycv @@ -1,11 +1,9 @@ FROM plumed:rocky8 -RUN source ./.bashrc \ +RUN source /etc/bashrc \ && module load mpi \ && cd plumed2 \ && source ./sourceme.sh \ && cd plugins/pycv \ - && pip3 install --user -r requirements.txt \ && ln -s $(realpath ../../regtest/scripts) ./regtest/scripts \ - && python_bin=python3 ./prepareMakeForDevelop.sh \ && make check From e7012f72354581bf06b1797c98e2b4a55b197c43 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:00:24 +0200 Subject: [PATCH 38/46] using pip3 in the makefile --- plugins/pycv/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/pycv/Makefile b/plugins/pycv/Makefile index 3f07f69ade..a385ba0355 100644 --- a/plugins/pycv/Makefile +++ b/plugins/pycv/Makefile @@ -5,11 +5,11 @@ all: pycv_here pycv_here: src/*.cpp src/*.h src/pycv/*.py @echo installing pycv - pip install . + pip3 install . touch $@ clean: - pip uninstall pycv + pip3 uninstall pycv rm -fv pycv_here check_standalone: pycv_here @@ -18,7 +18,7 @@ check_standalone: pycv_here #just in case pytest is still not installed we install it before the tests check_python: pycv_here - pip install pytest + pip3 install pytest pytest -v check: check_standalone check_python From 4ab187df3bb7b4c26fead8ab5380a86d354f4594 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:58:19 +0200 Subject: [PATCH 39/46] sourcing the correct bashrc in rocky8 --- docker/rocky8-pycv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/rocky8-pycv b/docker/rocky8-pycv index ffaf7036cc..b663cf2e81 100644 --- a/docker/rocky8-pycv +++ b/docker/rocky8-pycv @@ -1,6 +1,6 @@ FROM plumed:rocky8 -RUN source /etc/bashrc \ +RUN . ./.bashrc \ && module load mpi \ && cd plumed2 \ && source ./sourceme.sh \ From cd5bd130c8b2b9604ec39120261b2a88f5d4533c Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:25:38 +0200 Subject: [PATCH 40/46] checking if changing env will make the CI pass --- docker/fedora39-pycv | 10 ++++++++++ docker/rocky8-pycv | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/docker/fedora39-pycv b/docker/fedora39-pycv index 30cf608be3..dd6f95d0e9 100644 --- a/docker/fedora39-pycv +++ b/docker/fedora39-pycv @@ -2,6 +2,16 @@ FROM plumed:fedora39 RUN source /etc/bashrc \ && module load mpi \ + && export OMPI_MCA_btl_base_warn_component_unused=0 \ + && export OMPI_MCA_btl_base_verbose=0 \ + && export OMPI_MCA_plm=isolated \ + && export OMPI_MCA_btl_vader_single_copy_mechanism=none \ + && export OMPI_MCA_rmaps_base_oversubscribe=yes \ + && export PATH=$HOME/opt/bin:$PATH \ + && export CPATH=$HOME/opt/include:$CPATH \ + && export INCLUDE=$HOME/opt/include:$INCLUDE \ + && export LIBRARY_PATH=$HOME/opt/lib:$LIBRARY_PATH \ + && export LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH \ && cd plumed2 \ && source ./sourceme.sh \ && cd plugins/pycv \ diff --git a/docker/rocky8-pycv b/docker/rocky8-pycv index b663cf2e81..7c541d3b17 100644 --- a/docker/rocky8-pycv +++ b/docker/rocky8-pycv @@ -2,6 +2,16 @@ FROM plumed:rocky8 RUN . ./.bashrc \ && module load mpi \ + && export OMPI_MCA_btl_base_warn_component_unused=0 \ + && export OMPI_MCA_btl_base_verbose=0 \ + && export OMPI_MCA_plm=isolated \ + && export OMPI_MCA_btl_vader_single_copy_mechanism=none \ + && export OMPI_MCA_rmaps_base_oversubscribe=yes \ + && export PATH=$HOME/opt/bin:$PATH \ + && export CPATH=$HOME/opt/include:$CPATH \ + && export INCLUDE=$HOME/opt/include:$INCLUDE \ + && export LIBRARY_PATH=$HOME/opt/lib:$LIBRARY_PATH \ + && export LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH \ && cd plumed2 \ && source ./sourceme.sh \ && cd plugins/pycv \ From 34aeec9c778ae9e3e975de5a88077dd05c1551b2 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:35:54 +0200 Subject: [PATCH 41/46] now findplumed uses plumed--no-mpi --- plugins/pycv/FindPlumed.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/pycv/FindPlumed.cmake b/plugins/pycv/FindPlumed.cmake index e2a816cbc4..160518c7cf 100644 --- a/plugins/pycv/FindPlumed.cmake +++ b/plugins/pycv/FindPlumed.cmake @@ -24,7 +24,7 @@ if(NOT Plumed_FOUND) message(STATUS "plumed not found via pkgconfig, trying executable") execute_process( - COMMAND plumed info --include-dir + COMMAND plumed --no-mpi info --include-dir RESULT_VARIABLE PLUMED_EXECUTABLE OUTPUT_QUIET ERROR_QUIET) if(PLUMED_EXECUTABLE EQUAL 0) @@ -34,7 +34,7 @@ if(NOT Plumed_FOUND) message(STATUS "Configuring plumed from executable") execute_process( - COMMAND plumed info --include-dir + COMMAND plumed --no-mpi info --include-dir OUTPUT_VARIABLE Plumed_INCLUDEDIR OUTPUT_STRIP_TRAILING_WHITESPACE) @@ -42,7 +42,7 @@ if(NOT Plumed_FOUND) ${Plumed_INCLUDEDIR} CACHE INTERNAL "plumed include dir") execute_process( - COMMAND plumed info --configuration + COMMAND plumed --no-mpi info --configuration OUTPUT_VARIABLE Plumed_CONFIG OUTPUT_STRIP_TRAILING_WHITESPACE) @@ -70,7 +70,7 @@ if(NOT Plumed_FOUND) ${Plumed_CPP_FLAGS} CACHE INTERNAL "plumed Definitions flags") - execute_process(COMMAND plumed config -q has mpi + execute_process(COMMAND plumed --no-mpi config -q has mpi RESULT_VARIABLE Plumed_WITH_MPI) if(Plumed_WITH_MPI EQUAL 0) set(Plumed_HAS_MPI From ea2e77fc12beb3f4f094efcbfcd59b2b0c6af0ef Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:49:16 +0200 Subject: [PATCH 42/46] readding a donfiguration file --- docker/fedora39-pycv | 1 + docker/rocky8-pycv | 1 + plugins/pycv/Makefile | 16 ++++++++++------ plugins/pycv/configurePyCV.sh | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100755 plugins/pycv/configurePyCV.sh diff --git a/docker/fedora39-pycv b/docker/fedora39-pycv index dd6f95d0e9..e2a0fb36ba 100644 --- a/docker/fedora39-pycv +++ b/docker/fedora39-pycv @@ -15,5 +15,6 @@ RUN source /etc/bashrc \ && cd plumed2 \ && source ./sourceme.sh \ && cd plugins/pycv \ + && ./configurePyCV.sh \ && ln -s $(realpath ../../regtest/scripts) ./regtest/scripts \ && make check diff --git a/docker/rocky8-pycv b/docker/rocky8-pycv index 7c541d3b17..35b12ad5ea 100644 --- a/docker/rocky8-pycv +++ b/docker/rocky8-pycv @@ -15,5 +15,6 @@ RUN . ./.bashrc \ && cd plumed2 \ && source ./sourceme.sh \ && cd plugins/pycv \ + && ./configurePyCV.sh \ && ln -s $(realpath ../../regtest/scripts) ./regtest/scripts \ && make check diff --git a/plugins/pycv/Makefile b/plugins/pycv/Makefile index a385ba0355..d045ccf3e6 100644 --- a/plugins/pycv/Makefile +++ b/plugins/pycv/Makefile @@ -1,3 +1,7 @@ + +PYTHON=python +#optional, just in case you want to override python with ./configurePyCV.sh +-include Makefile.conf #this makefiles assume that pip and pytest are installed .PHONY: clean check check_standalone check_python all @@ -5,12 +9,12 @@ all: pycv_here pycv_here: src/*.cpp src/*.h src/pycv/*.py @echo installing pycv - pip3 install . - touch $@ + $(PYTHON) -m pip install . + @touch $@ clean: - pip3 uninstall pycv - rm -fv pycv_here + @$(PYTHON) -m pip uninstall pycv -y + @rm -fv pycv_here check_standalone: pycv_here $(MAKE) -C regtest testclean @@ -18,7 +22,7 @@ check_standalone: pycv_here #just in case pytest is still not installed we install it before the tests check_python: pycv_here - pip3 install pytest - pytest -v + @$(PYTHON) -m pip install pytest + @$(PYTHON) -m pytest -v check: check_standalone check_python diff --git a/plugins/pycv/configurePyCV.sh b/plugins/pycv/configurePyCV.sh new file mode 100755 index 0000000000..f97dcaae8b --- /dev/null +++ b/plugins/pycv/configurePyCV.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +#formatted with shfmtv3.36.0 (https://github.com/mvdan/sh/releases) + +#A simple script to configure PyCV if python does not work +PYTHON="" +if which plumed >/dev/null; then + echo "plumed found" + PYTHON=$(plumed --no-mpi info --configuration | grep 'python_bin=') + PYTHON=${PYTHON#python_bin=} +fi + +if [ -z "$PYTHON" ]; then + echo "python not found using plumed" + echo "serching for available python with plumed module installed" + + for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + if $python_bin -c "import plumed" 2>/dev/null; then + if [ $python_bin != python ]; then + PYTHON=$python_bin + fi + return 1 + fi + done + +fi + +if [ -z "$PYTHON" ]; then + echo "python not found" + exit 1 +fi + +cat <Makefile.conf +PYTHON=$(which "$PYTHON") +EOF From c3edc252c3ec5e66a51236a3fb50fe6af7a597d5 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:40:17 +0100 Subject: [PATCH 43/46] Now the tests are compatible with with GNUsed and BSDsed --- plugins/pycv/regtest/pycvcomm/rt-MDinformations/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-PBCs/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-doc/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-doc/config.reference | 2 +- plugins/pycv/regtest/pycvcomm/rt-getPosition/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-getPositions/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-makeWhole/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config | 2 +- .../pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-persistentData/config | 2 +- plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-Components/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-MDinformations/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-arguments/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-derivative/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-doc/config | 2 +- plugins/pycv/regtest/pycvfunc/rt-doc/config.reference | 2 +- plugins/pycv/regtest/pycvfunc/rt-withPYCV/config | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/plugins/pycv/regtest/pycvcomm/rt-MDinformations/config b/plugins/pycv/regtest/pycvcomm/rt-MDinformations/config index af185de1f2..293f9280a2 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-MDinformations/config +++ b/plugins/pycv/regtest/pycvcomm/rt-MDinformations/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config b/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config +++ b/plugins/pycv/regtest/pycvcomm/rt-PBC-getBox/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config b/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config +++ b/plugins/pycv/regtest/pycvcomm/rt-PBC-getInvBox/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-PBCs/config b/plugins/pycv/regtest/pycvcomm/rt-PBCs/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-PBCs/config +++ b/plugins/pycv/regtest/pycvcomm/rt-PBCs/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config b/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config +++ b/plugins/pycv/regtest/pycvcomm/rt-absoluteIndexes/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config b/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config +++ b/plugins/pycv/regtest/pycvcomm/rt-autoFunctions/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-doc/config b/plugins/pycv/regtest/pycvcomm/rt-doc/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-doc/config +++ b/plugins/pycv/regtest/pycvcomm/rt-doc/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-doc/config.reference b/plugins/pycv/regtest/pycvcomm/rt-doc/config.reference index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-doc/config.reference +++ b/plugins/pycv/regtest/pycvcomm/rt-doc/config.reference @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPosition/config b/plugins/pycv/regtest/pycvcomm/rt-getPosition/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPosition/config +++ b/plugins/pycv/regtest/pycvcomm/rt-getPosition/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config b/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositionNL/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config b/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositionNLPair/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-getPositions/config b/plugins/pycv/regtest/pycvcomm/rt-getPositions/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-getPositions/config +++ b/plugins/pycv/regtest/pycvcomm/rt-getPositions/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-makeWhole/config b/plugins/pycv/regtest/pycvcomm/rt-makeWhole/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-makeWhole/config +++ b/plugins/pycv/regtest/pycvcomm/rt-makeWhole/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config b/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config index af185de1f2..293f9280a2 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config +++ b/plugins/pycv/regtest/pycvcomm/rt-massesAndCharges/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config b/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config index af185de1f2..293f9280a2 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config +++ b/plugins/pycv/regtest/pycvcomm/rt-massesAndChargesArray/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config b/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config +++ b/plugins/pycv/regtest/pycvcomm/rt-multipleComponents/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config b/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config +++ b/plugins/pycv/regtest/pycvcomm/rt-multipleValuePeriodicity/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config b/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config index dca9b502ca..e94ad8dbb3 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config +++ b/plugins/pycv/regtest/pycvcomm/rt-multiplecalls/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config +++ b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtom/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config +++ b/plugins/pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-persistentData/config b/plugins/pycv/regtest/pycvcomm/rt-persistentData/config index a0ec704a92..18862d248b 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-persistentData/config +++ b/plugins/pycv/regtest/pycvcomm/rt-persistentData/config @@ -10,7 +10,7 @@ plumed_regtest_before(){ PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config b/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config +++ b/plugins/pycv/regtest/pycvcomm/rt-valuePeriodicity/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config b/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config +++ b/plugins/pycv/regtest/pycvfunc/rt-ArgsMethods/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-Components/config b/plugins/pycv/regtest/pycvfunc/rt-Components/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-Components/config +++ b/plugins/pycv/regtest/pycvfunc/rt-Components/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-MDinformations/config b/plugins/pycv/regtest/pycvfunc/rt-MDinformations/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-MDinformations/config +++ b/plugins/pycv/regtest/pycvfunc/rt-MDinformations/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-arguments/config b/plugins/pycv/regtest/pycvfunc/rt-arguments/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-arguments/config +++ b/plugins/pycv/regtest/pycvfunc/rt-arguments/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config b/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config +++ b/plugins/pycv/regtest/pycvfunc/rt-argumentsArray/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config b/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config +++ b/plugins/pycv/regtest/pycvfunc/rt-argumentsWithComponents/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-derivative/config b/plugins/pycv/regtest/pycvfunc/rt-derivative/config index a9b93b35ca..75fa9a51a6 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-derivative/config +++ b/plugins/pycv/regtest/pycvfunc/rt-derivative/config @@ -15,7 +15,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-doc/config b/plugins/pycv/regtest/pycvfunc/rt-doc/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-doc/config +++ b/plugins/pycv/regtest/pycvfunc/rt-doc/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-doc/config.reference b/plugins/pycv/regtest/pycvfunc/rt-doc/config.reference index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-doc/config.reference +++ b/plugins/pycv/regtest/pycvfunc/rt-doc/config.reference @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { diff --git a/plugins/pycv/regtest/pycvfunc/rt-withPYCV/config b/plugins/pycv/regtest/pycvfunc/rt-withPYCV/config index bca39af1e7..9cca9530cc 100644 --- a/plugins/pycv/regtest/pycvfunc/rt-withPYCV/config +++ b/plugins/pycv/regtest/pycvfunc/rt-withPYCV/config @@ -7,7 +7,7 @@ plumed_regtest_before() { PLUMED_PYTHON_BIN=python fi pycvpath=$($PLUMED_PYTHON_BIN -m pycv) - sed -i "s%@pycvpath@%${pycvpath}%g" plumed.dat + sed -i.bak "s%@pycvpath@%${pycvpath}%g" plumed.dat } plumed_custom_skip() { From d9bd6b4c2726cd34714a7f29db0c9ac918ed66c7 Mon Sep 17 00:00:00 2001 From: Toni Date: Wed, 22 Jan 2025 16:48:58 +0100 Subject: [PATCH 44/46] added scripts symlink for convenience --- plugins/pycv/regtest/scripts | 1 + 1 file changed, 1 insertion(+) create mode 120000 plugins/pycv/regtest/scripts diff --git a/plugins/pycv/regtest/scripts b/plugins/pycv/regtest/scripts new file mode 120000 index 0000000000..cc8f0eb429 --- /dev/null +++ b/plugins/pycv/regtest/scripts @@ -0,0 +1 @@ +/home/toni/compile/plumed2/regtest/scripts \ No newline at end of file From 47e9b7128c73b3fa64d03cb66af8a2220c0dbe43 Mon Sep 17 00:00:00 2001 From: Toni Date: Wed, 22 Jan 2025 17:23:22 +0100 Subject: [PATCH 45/46] Updated readme for pip-based instructions. --- plugins/pycv/README.md | 153 +++++++++++++++++++++-------------------- 1 file changed, 79 insertions(+), 74 deletions(-) diff --git a/plugins/pycv/README.md b/plugins/pycv/README.md index 448da81b1b..8cb1bb705c 100644 --- a/plugins/pycv/README.md +++ b/plugins/pycv/README.md @@ -14,7 +14,10 @@ Advantages of using PYCV over standard development of CVs in C++ are: You can see the original PyCV [here](https://giorginolab.github.io/plumed2-pycv) [![DOI](https://joss.theoj.org/papers/10.21105/joss.01773/status.svg)](https://doi.org/10.21105/joss.01773) -[![plumID:19.075](https://www.plumed-nest.org/eggs/19/075/badge.svg)](https://www.plumed-nest.org/eggs/19/075/) +[![plumID:19.075](https://www.plumed-nest.org/eggs/19/075/badge.svg)](https://www.plumed-nest.org/eggs/19/075/). + +Note that the current syntax is different than the one described in the original paper. + ## Documentation @@ -24,22 +27,22 @@ The PYCV module defines the following actions: * `PYCVINTERFACE`, to implement single- and multi-component CVs in Python; * `PYFUNCTION`, to implement arbitrary functions. -Plumed will start a a Python interpreter. -Then Plumed will import a python module with the `IMPORT=` keyword, this module -must contain at least two objects: a calculate function that will be called at -the `calculate()` step, and an init function or dictionary that will be used at -time of constructing the pycv. +Plumed will start an embedded Python interpreter. +Then Plumed will import a python module with the `IMPORT=` keyword. This module +must contain at least two objects: a *calculate* function that will be called at +the `calculate()` step, and an *init* function or dictionary that will be used at +time of constructing the PYCV. The module that can be imported can be a `*.py` file or a directory that contains -an `__init__.py`, or a module in the your python path. +an `__init__.py`, or a module in the your Python path. `PYCVINTERFACE` will accept also functions during the `prepare()` and `update()` steps. -`PYCVINTERFACE` will accept also the `ATOMS` keyword (see `DISTANCE` cv) -**or** a series of keyword relative to the neighbour list (see `COORDINATION` cv). +`PYCVINTERFACE` will accept also the `ATOMS` keyword (see `DISTANCE` CV) +**or** a series of keyword relative to the neighbour list (see `COORDINATION` CV). If both the flavour of asking atom is used, `PYCVINTERFACE` will raise and error. -The interface to python as anticipated before depends on the following keywords: +The interface to Python, as anticipated above, depends on the following keywords: | keyword | description | PYCVINTERFACE | PYFUNCTION | |-----------|----------------------------------------------|---------------|------------| @@ -49,55 +52,51 @@ The interface to python as anticipated before depends on the following keywords: | PREPARE | the function to call at `prepare()` step | ✅ | ❌ | | UPDATE | the function to call at `update()` step | ✅ | ❌ | -If not specified INIT will default to `"plumedInit` and CALCULATE to -`"plumedCalculate"`, on the other hand, if PREPARE and UPDATE are not present, will be ignored. +If not specified, `INIT` will default to `plumedInit` and `CALCULATE` to +`plumedCalculate`. On the other hand, if `PREPARE` and `UPDATE` are not present, they will be ignored. -## Preparation +## Installation -For compiling the plugin you just need pybind11 and numpy. -I always recomend to create and ad-hoc environment for your projects: -```bash -python3 -m venv pycvenv -source ./pycvenv/bin/activate -pip install -U pip -pip install -r requirements.txt -``` -The requirements.txt file is in the home of the plug in +It should be sufficient to run, ideally in a virtual or conda environment: -### Standard compilation + cd plugins/pycv + pip install . -If you have a plumed that supports plumed mklib (that will be release in the 2.10 version, but it is avaiable in the master branch) with multiple files you can simply -```bash -./standaloneCompile.sh -``` -### Developer compilation +Required dependencies `numpy` and `pybind11` are installed as part of the installation process. -If you want to contribute to this module, -the procedure is slighly more compex: -```bash -./prepareMakeForDevelop.sh -``` -will prepare a Make.inc in this directory that will be included by the Makefile. -Then simply: -```bash -make -``` +Note that an in-place installation, `pip install -e .`, won't work. + + +## Regression tests + +A suite of regression tests are provided in the `regtest` subdirectory. They can be run e.g. with + + make -C regtest + + +## Common runtime problems + +On some platforms, *embedded* Python interpreters (such as the one used in PYCV) appear to behave +differently than the plain ones, raising surprising errors. For example: + +* Some Python configurations (e.g. Conda under Linux) require the + Python shared library to be found in the LD_LIBRARY_PATH, + ignoring the activated environment. This manifests itself with an + error like: + + libpython3.13.so.1.0: cannot open shared object file: No such file or directory + + +* Similarly, some Python configurations (e.g. MacOS) ignore the current + environment when searching for packages (e.g. `numpy`). Hence, + one should set PYTHONPATH manually. This manifests itself with an + error like: + + No module named numpy -#### Set up tests -If you are interested in running the test regarding this plugin you can use the same procedure as with the standard plumed, but in the subdir regtest of this plugin. -The only requirement is to copy or to create a symbolic link to the `regtest/scripts` directory in a plumed source. Plumed must be runnable to execute tests -```bash -cd regtest -ln -s path/to/plumed/source/regtest/scripts . -make -``` -### About older Plumed versions -If you are using an older plumed version you must know that: - - On linux the plug-in can be loaded only if `LOAD` supports the `GLOBAL` keyword - - mklib won't work (supports only single file compilations), so you'll need to use `./prepareMakeForDevelop.sh` ## Getting started @@ -218,14 +217,30 @@ def plumedCalculate(action: PLMD.PythonFunction): ``` This simply prints an "Hello, world!" at each step of the simulation/trajectory. -### An example, gradient calculation with jax +## JAX + +Transparent auto-differentiation, JIT compilation, neural networks and vectorization +are readily available through Google's [JAX +library](https://github.com/google/jax) (recommended). + +### Installation -Here's a quick example with calculation of an angle between three atoms +As described in the [jax documenation](https://jax.readthedocs.io/en/latest/installation.html), there are several installation routes, and calculations can be accelerated with various hardware. For example: + - example if you have a cuda12 compatible device (a wheel for cuda will be installed alongside jax): +`pip install "jax[cuda12_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html` + - example if you have a cuda12 compatible device, and **cuda already installed on your system**: +`pip install "jax[cuda12_local]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html` + + + +### Example: a CV with automatic gradient calculation + +Here's a numpy-style calculation of an angle between three atoms, with automatic differentiation: **plumed.dat** ``` -cv1: PYTHONCV ATOMS=1,4,3 IMPORT=jaxcv CALCULATE=cv1 +cv1: PYCVINTERFACE ATOMS=1,4,3 IMPORT=jaxcv CALCULATE=cv1 ``` **jaxcv.py** @@ -237,6 +252,7 @@ from jax import grad, jit, vmap import plumedCommunications plumedInit={"Value": plumedCommunications.defaults.COMPONENT} + # Implementation of the angle function. @jit really improves speed @jit def angle(x): @@ -249,7 +265,7 @@ def angle(x): return theta # Use JAX to auto-gradient it -grad_angle = grad(angle) +grad_angle = jit(grad(angle)) # The CV function actually called def cv1(action): @@ -257,35 +273,23 @@ def cv1(action): return angle(x), grad_angle(x) ``` -## EXTRA: JAX - -Transparent auto-differentiation, JIT compilation, and vectorization -are available through Google's [JAX -library](https://github.com/google/jax) (recommended). - -### Install jax: - -Go to the original guide in the [jax documenation](https://jax.readthedocs.io/en/latest/installation.html) - -jax has different method of installation, and can be accelerated with various different hardware, -(as stated before, trying to install things in a virtual environment make doing error less costly) -The command for installing should be similar to: - - example if you have a cuda12 compatible device (a wheel for cuda will be installed alongside jax): -`pip install "jax[cuda12_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html` - - example if you have a cuda12 compatible device, and **cuda already installed on your system**: -`pip install "jax[cuda12_local]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html` - ## Limitations - No test have been done with MPI -- JAX's GPU/TPU offloading are not 100% testes. +- JAX's GPU/TPU offloading are not 100% tested. + + +If you are using an older Plumed version you must know that: + - On linux the plug-in can be loaded only if `LOAD` supports the `GLOBAL` keyword + - mklib won't work (supports only single file compilations), so you'll need to use `./prepareMakeForDevelop.sh` ## Authors -Original author: Toni Giorgino +Original author: Toni Giorgino Daniele Rapetti + ## Contributing Please report bugs and ideas via this repository's *Issues*. @@ -301,6 +305,7 @@ Collective Variables in Python. The Journal of Open Source Software [![plumID:19.075](https://www.plumed-nest.org/eggs/19/075/badge.svg)](https://www.plumed-nest.org/eggs/19/075/) + ## Copyright PYCV is distributed under the LGPL terms: see COPYRIGHT. From ce3a877d19118719348379f99c828d8ba8ee4b3b Mon Sep 17 00:00:00 2001 From: Toni Date: Fri, 24 Jan 2025 14:05:17 +0100 Subject: [PATCH 46/46] pycv regtest symlink should be relative. also remove its creation from docker --- docker/fedora39-pycv | 1 - plugins/pycv/regtest/scripts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/fedora39-pycv b/docker/fedora39-pycv index e2a0fb36ba..de9be8abf5 100644 --- a/docker/fedora39-pycv +++ b/docker/fedora39-pycv @@ -16,5 +16,4 @@ RUN source /etc/bashrc \ && source ./sourceme.sh \ && cd plugins/pycv \ && ./configurePyCV.sh \ - && ln -s $(realpath ../../regtest/scripts) ./regtest/scripts \ && make check diff --git a/plugins/pycv/regtest/scripts b/plugins/pycv/regtest/scripts index cc8f0eb429..efaa4c5613 120000 --- a/plugins/pycv/regtest/scripts +++ b/plugins/pycv/regtest/scripts @@ -1 +1 @@ -/home/toni/compile/plumed2/regtest/scripts \ No newline at end of file +../../../regtest/scripts \ No newline at end of file