From 394c7a3524882713fd1ecd0a8b36d64e749c30a1 Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Mon, 13 May 2024 17:28:51 +0100 Subject: [PATCH] Added documentation for output components in shortcuts --- regtest/dimred/rt-smap-osample/plumed.dat | 4 +- .../rt-smap-osample/projections.reference | 2 +- regtest/dimred/rt-smap-osample/smap.reference | 2 +- .../dimred/rt-smap-pointwise/smap.reference | 2 +- regtest/dimred/rt-smap-smacof/smap.reference | 2 +- regtest/dimred/rt-smap1/smap.reference | 2 +- src/adjmat/Bridge.cpp | 1 + src/adjmat/ContactMatrixShortcut.cpp | 12 ++---- src/cltools/Driver.cpp | 43 +++++++++++++++---- src/cltools/GenJson.cpp | 7 +-- src/clusters/ClusterDiameter.cpp | 1 + src/clusters/ClusterNatoms.cpp | 1 + src/clusters/ClusterWithSurface.cpp | 1 + src/clusters/OutputCluster.cpp | 2 +- src/colvar/DRMSD.cpp | 1 + src/colvar/ExtraCV.cpp | 1 + src/colvar/GyrationShortcut.cpp | 1 + src/colvar/MultiRMSD.cpp | 1 + src/colvar/RMSDShortcut.cpp | 1 + src/core/ActionShortcut.cpp | 1 + src/core/ActionWithValue.cpp | 1 + src/core/Value.cpp | 9 ++++ src/core/Value.h | 2 + src/crystdistrib/BopsShortcut.cpp | 1 + src/crystdistrib/DopsShortcut.cpp | 1 + src/crystdistrib/RopsShortcut.cpp | 1 + src/dimred/ArrangePoints.cpp | 15 ++++--- .../ClassicalMultiDimensionalScaling.cpp | 1 + src/dimred/PCA.cpp | 1 + src/dimred/SketchMap.cpp | 18 +++++--- src/dimred/SketchMapProjection.cpp | 1 + src/function/Product.cpp | 1 + src/generic/Average.cpp | 1 + src/generic/Ones.cpp | 1 + src/generic/PDB2Constant.cpp | 1 + src/gridtools/ConvertToFES.cpp | 1 + src/gridtools/Gradient.cpp | 1 + src/gridtools/Histogram.cpp | 1 + src/gridtools/KLEntropy.cpp | 1 + src/gridtools/MultiColvarDensity.cpp | 1 + src/gridtools/PairEntropies.cpp | 1 + src/gridtools/PairEntropy.cpp | 1 + src/gridtools/RDF.cpp | 1 + src/landmarks/LogSumExp.cpp | 1 + src/mapping/AdaptivePath.cpp | 1 + src/mapping/GeometricPathShortcut.cpp | 2 + src/mapping/Path.cpp | 10 ++--- src/matrixtools/CovarianceMatrix.cpp | 1 + src/matrixtools/Determinent.cpp | 1 + src/multicolvar/AlphaBeta.cpp | 1 + src/multicolvar/Dihcor.cpp | 1 + src/multicolvar/DumpMultiColvar.cpp | 2 +- src/multicolvar/MFilterLess.cpp | 1 + src/refdist/Displacement.cpp | 1 + src/refdist/EuclideanDistance.cpp | 1 + src/refdist/Kernel.cpp | 1 + src/refdist/MahalanobisDistance.cpp | 1 + src/refdist/NormalizedEuclideanDistance.cpp | 1 + src/vatom/CenterShortcut.cpp | 1 + src/volumes/Density.cpp | 1 + src/wham/WhamHistogram.cpp | 1 + src/wham/WhamWeights.cpp | 1 + 62 files changed, 131 insertions(+), 50 deletions(-) diff --git a/regtest/dimred/rt-smap-osample/plumed.dat b/regtest/dimred/rt-smap-osample/plumed.dat index 31bd38618a..6a073a7b0d 100644 --- a/regtest/dimred/rt-smap-osample/plumed.dat +++ b/regtest/dimred/rt-smap-osample/plumed.dat @@ -19,5 +19,5 @@ smap: SKETCHMAP ... LOW_DIM_FUNCTION={SMAP R_0=4 A=1 B=2} CGTOL=1E-4 OS_CGTOL=1E-3 ... -DUMPVECTOR ARG=smap.*,lwe FMT=%8.4f FILE=smap -DUMPVECTOR ARG=smap_osample.coord-1,smap_osample.coord-2,weights FILE=projections FMT=%8.2f +DUMPVECTOR ARG=smap,lwe FMT=%8.4f FILE=smap +DUMPVECTOR ARG=smap_osample,weights FILE=projections FMT=%8.2f diff --git a/regtest/dimred/rt-smap-osample/projections.reference b/regtest/dimred/rt-smap-osample/projections.reference index 942b898aaa..7d9df45ef3 100644 --- a/regtest/dimred/rt-smap-osample/projections.reference +++ b/regtest/dimred/rt-smap-osample/projections.reference @@ -1,4 +1,4 @@ -#! FIELDS time parameter smap_osample.coord-1 smap_osample.coord-2 weights +#! FIELDS time parameter smap_osample_pp.coord-1 smap_osample_pp.coord-2 weights 500.000000 0 0.75 1.97 1.00 500.000000 1 -0.41 -2.02 1.00 500.000000 2 -1.23 0.97 1.00 diff --git a/regtest/dimred/rt-smap-osample/smap.reference b/regtest/dimred/rt-smap-osample/smap.reference index 6671d0ad11..207dd34c2a 100644 --- a/regtest/dimred/rt-smap-osample/smap.reference +++ b/regtest/dimred/rt-smap-osample/smap.reference @@ -1,4 +1,4 @@ -#! FIELDS time parameter smap.coord-1 smap.coord-2 lwe +#! FIELDS time parameter smap_ap.coord-1 smap_ap.coord-2 lwe 500.000000 0 0.7566 1.9772 2.0000 500.000000 1 -1.2291 0.9669 1.0000 500.000000 2 0.6420 -0.6544 4.0000 diff --git a/regtest/dimred/rt-smap-pointwise/smap.reference b/regtest/dimred/rt-smap-pointwise/smap.reference index b843e2eb29..7936d58a4b 100644 --- a/regtest/dimred/rt-smap-pointwise/smap.reference +++ b/regtest/dimred/rt-smap-pointwise/smap.reference @@ -1,4 +1,4 @@ -#! FIELDS time parameter smap.coord-1 smap.coord-2 lwe +#! FIELDS time parameter smap_ap.coord-1 smap_ap.coord-2 lwe 100.000000 0 3.069 -0.094 1.000 100.000000 1 2.470 -3.680 1.000 100.000000 2 4.827 0.498 1.000 diff --git a/regtest/dimred/rt-smap-smacof/smap.reference b/regtest/dimred/rt-smap-smacof/smap.reference index bb4ae0a616..d07b73bc6a 100644 --- a/regtest/dimred/rt-smap-smacof/smap.reference +++ b/regtest/dimred/rt-smap-smacof/smap.reference @@ -1,4 +1,4 @@ -#! FIELDS time parameter smap.coord-1 smap.coord-2 lwe +#! FIELDS time parameter smap_ap.coord-1 smap_ap.coord-2 lwe 500.000000 0 -966.3 1318.3 1.0 500.000000 1 -607.3 827.1 1.0 500.000000 2 26.7 -36.8 1.0 diff --git a/regtest/dimred/rt-smap1/smap.reference b/regtest/dimred/rt-smap1/smap.reference index 958746d8e6..ad04d6a046 100644 --- a/regtest/dimred/rt-smap1/smap.reference +++ b/regtest/dimred/rt-smap1/smap.reference @@ -1,4 +1,4 @@ -#! FIELDS time parameter smap.coord-1 smap.coord-2 weights +#! FIELDS time parameter smap_ap.coord-1 smap_ap.coord-2 weights 50.000000 0 18.8066 10.1521 1.0000 50.000000 1 14.0852 9.9268 1.0000 50.000000 2 8.3328 9.6157 1.0000 diff --git a/src/adjmat/Bridge.cpp b/src/adjmat/Bridge.cpp index be15844f88..d018fb07b2 100644 --- a/src/adjmat/Bridge.cpp +++ b/src/adjmat/Bridge.cpp @@ -55,6 +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"); } Bridge::Bridge(const ActionOptions& ao): diff --git a/src/adjmat/ContactMatrixShortcut.cpp b/src/adjmat/ContactMatrixShortcut.cpp index 47d63a0ce0..70682bdb68 100644 --- a/src/adjmat/ContactMatrixShortcut.cpp +++ b/src/adjmat/ContactMatrixShortcut.cpp @@ -24,6 +24,7 @@ #include "core/PlumedMain.h" #include "core/ActionSet.h" #include "core/Group.h" +#include "AdjacencyMatrixBase.h" //+PLUMEDOC MATRIX CONTACT_MATRIX /* @@ -69,20 +70,13 @@ class ContactMatrixShortcut : public ActionShortcut { PLUMED_REGISTER_ACTION(ContactMatrixShortcut,"CONTACT_MATRIX") void ContactMatrixShortcut::registerKeywords(Keywords& keys) { - ActionShortcut::registerKeywords( keys ); - keys.add("atoms","GROUPA",""); - keys.add("atoms","GROUPB",""); - keys.add("atoms-2","ATOMS","the atoms for which you would like to calculate the adjacency matrix (basically equivalent to GROUP)"); - keys.add("numbered","GROUP","specifies the list of atoms that should be assumed indistinguishable"); + AdjacencyMatrixBase::registerKeywords( keys ); + keys.remove("GROUP"); keys.add("numbered","GROUP","specifies the list of atoms that should be assumed indistinguishable"); keys.add("compulsory","NN","6","The n parameter of the switching function "); keys.add("compulsory","MM","0","The m parameter of the switching function; 0 implies 2*NN"); keys.add("compulsory","D_0","0.0","The d_0 parameter of the switching function"); keys.add("compulsory","R_0","The r_0 parameter of the switching function"); keys.add("numbered","SWITCH","specify the switching function to use between two sets of indistinguishable atoms"); - 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.addFlag("COMPONENTS",false,"also calculate the components of the vector connecting the atoms in the contact matrix"); - keys.addFlag("NOPBC",false,"don't use pbc"); keys.addActionNameSuffix("_PROPER"); keys.needsAction("TRANSPOSE"); keys.needsAction("CONCATENATE"); } diff --git a/src/cltools/Driver.cpp b/src/cltools/Driver.cpp index f8008272ae..4738332a1c 100644 --- a/src/cltools/Driver.cpp +++ b/src/cltools/Driver.cpp @@ -776,8 +776,9 @@ int Driver::main(FILE* in,FILE*out,Communicator& pc) { if( valuedict_file.length()>0 ) { OFile valuefile; valuefile.open( valuedict_file ); valuefile.printf("{\n"); bool firsta=true; for(const auto & pp : p.getActionSet()) { + if( pp.get()->getName()=="CENTER" ) continue ; ActionWithVirtualAtom* avv=dynamic_cast(pp.get()); - if( avv || pp.get()->getName()=="GROUP" ) { + if( avv || pp.get()->getName()=="GROUP" || pp.get()->getName()=="DENSITY" ) { Action* p(pp.get()); if( firsta ) { valuefile.printf(" \"%s\" : {\n", p->getLabel().c_str() ); firsta=false; } else valuefile.printf(",\n \"%s\" : {\n", p->getLabel().c_str() ); @@ -791,22 +792,46 @@ int Driver::main(FILE* in,FILE*out,Communicator& pc) { else valuefile.printf(",\n \"%s\" : {\n", av->getLabel().c_str() ); bool firstv=true; Keywords keys; actionRegister().getKeywords( av->getName(), keys ); for(unsigned i=0; igetNumberOfComponents(); ++i) { - Value* myval = av->copyOutput(i); std::string compname = myval->getName(), vtype, description; std::size_t dot=compname.find("."); - if( myval->getRank()==0 ) vtype="scalar"; - else if( myval->getRank()>0 && myval->hasDerivatives() ) vtype="grid"; - else if( myval->getRank()==1 ) vtype="vector"; - else if( myval->getRank()==2 ) vtype="matrix"; - else plumed_merror("unknown type for value " + myval->getName() ); + Value* myval = av->copyOutput(i); std::string compname = myval->getName(), description; std::size_t dot=compname.find("."); if( dot!=std::string::npos ) { std::string cname = compname.substr(dot+1); description = av->getOutputComponentDescription( cname, keys ); } else description = keys.getOutputComponentDescription(".#!value"); if( description.find("\\")!=std::string::npos ) error("found invalid backslash character in documentation for component " + compname + " in action " + av->getName() + " with label " + av->getLabel() ); - if( firstv ) { valuefile.printf(" \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), vtype.c_str(), description.c_str() ); firstv=false; } - else valuefile.printf(",\n \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), vtype.c_str(), description.c_str() ); + if( firstv ) { valuefile.printf(" \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), myval->getValueType().c_str(), description.c_str() ); firstv=false; } + else valuefile.printf(",\n \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), myval->getValueType().c_str(), description.c_str() ); } valuefile.printf("\n }"); } ActionShortcut* as=pp->castToActionShortcut(); + if( as ) { + unsigned ncomponents = 0; std::vector val_actions; + Keywords keys; actionRegister().getKeywords( as->getName(), keys ); + std::vector cnames( keys.getOutputComponents().size() ); + for(unsigned i=0; igetShortcutLabel(); + else valname = as->getShortcutLabel() + "_" + cnames[i]; + ActionWithValue* av = p.getActionSet().selectWithLabel( valname ); + if( av ) val_actions.push_back(av); + } + if( val_actions.size()==0 ) continue ; + + if( firsta ) { valuefile.printf(" \"shortcut_%s\" : {\n", as->getShortcutLabel().c_str() ); firsta=false; } + else valuefile.printf(",\n \"shortcut_%s\" : {\n", as->getShortcutLabel().c_str() ); + bool firstv=true; + for(unsigned i=0; igetNumberOfComponents(); ++j) { + Value* myval = val_actions[i]->copyOutput(j); std::string compname = myval->getName(), description; std::size_t dot=compname.find("."); + if( dot!=std::string::npos ) { + std::string cname = compname.substr(dot+1); description = val_actions[i]->getOutputComponentDescription( cname, keys ); + } else description = description = keys.getOutputComponentDescription(".#!value"); + if( description.find("\\")!=std::string::npos ) error("found invalid backslash character in documentation for component " + compname + " in action " + val_actions[i]->getName() + " with label " + val_actions[i]->getLabel() ); + if( firstv ) { valuefile.printf(" \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), myval->getValueType().c_str(), description.c_str() ); firstv=false; } + else valuefile.printf(",\n \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), myval->getValueType().c_str(), description.c_str() ); + } + } + valuefile.printf("\n }"); + } } valuefile.printf("\n}\n"); valuefile.close(); } diff --git a/src/cltools/GenJson.cpp b/src/cltools/GenJson.cpp index dc19d57ee5..26882ea0d0 100644 --- a/src/cltools/GenJson.cpp +++ b/src/cltools/GenJson.cpp @@ -141,12 +141,7 @@ int GenJson::main(FILE* in, FILE*out,Communicator& pc) { std::cout<<" \"description\": \""<& keymap ) { diff --git a/src/core/ActionWithValue.cpp b/src/core/ActionWithValue.cpp index 194467bd28..5571f5c589 100644 --- a/src/core/ActionWithValue.cpp +++ b/src/core/ActionWithValue.cpp @@ -45,6 +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"); 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"); diff --git a/src/core/Value.cpp b/src/core/Value.cpp index 63938923dd..a9b18a6d7f 100644 --- a/src/core/Value.cpp +++ b/src/core/Value.cpp @@ -381,4 +381,13 @@ bool Value::calculateOnUpdate() const { return (valtype==average || valtype==calcFromAverage); } +std::string Value::getValueType() const { + if( getRank()==0 ) return "scalar"; + if( getRank()>0 && hasDerivatives() ) return "grid"; + if( getRank()==1 ) return "vector"; + if( getRank()==2 ) return "matrix"; + plumed_merror("unknown type for value " + getName() ); + return ""; +} + } diff --git a/src/core/Value.h b/src/core/Value.h index 5ff26c7579..c1ebfa13c1 100644 --- a/src/core/Value.h +++ b/src/core/Value.h @@ -242,6 +242,8 @@ class Value { void setGridDerivatives( const unsigned& n, const unsigned& j, const double& val ); /// Add another value to the end of the data vector held by this value. This is used in COLLECT void push_back( const double& val ); +/// Get the type of value that is stored here + std::string getValueType() const ; }; inline diff --git a/src/crystdistrib/BopsShortcut.cpp b/src/crystdistrib/BopsShortcut.cpp index 9e80fd62a5..f06ecc1e4c 100644 --- a/src/crystdistrib/BopsShortcut.cpp +++ b/src/crystdistrib/BopsShortcut.cpp @@ -63,6 +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.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 b74cfa2f24..7465b3b732 100644 --- a/src/crystdistrib/DopsShortcut.cpp +++ b/src/crystdistrib/DopsShortcut.cpp @@ -60,6 +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.needsAction("DISTANCE_MATRIX"); keys.needsAction("CUSTOM"); keys.needsAction("ONES"); keys.needsAction("MATRIX_VECTOR_PRODUCT"); } diff --git a/src/crystdistrib/RopsShortcut.cpp b/src/crystdistrib/RopsShortcut.cpp index 9292c92fd6..d647de6664 100644 --- a/src/crystdistrib/RopsShortcut.cpp +++ b/src/crystdistrib/RopsShortcut.cpp @@ -63,6 +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.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 0918a2da37..357eefe4d0 100644 --- a/src/dimred/ArrangePoints.cpp +++ b/src/dimred/ArrangePoints.cpp @@ -60,6 +60,7 @@ class ArrangePoints : static void registerKeywords( Keywords& keys ); ArrangePoints( const ActionOptions& ); unsigned getNumberOfDerivatives() override { return 0; } + void prepare() override ; void calculate() override ; virtual void optimize( std::vector& pos ); void apply() override {} @@ -305,6 +306,14 @@ void ArrangePoints::optimize( std::vector& pos ) { } } +void ArrangePoints::prepare() { + // Make sure all the components are the right size + std::vector shape(1,getPntrToArgument( dimout )->getShape()[0]); + for(unsigned j=0; jgetShape()[0]!=shape[0] ) getPntrToComponent(j)->setShape( shape ); + } +} + void ArrangePoints::calculate() { // Retrive the initial value unsigned nvals = getPntrToArgument( dimout )->getShape()[0]; @@ -314,12 +323,6 @@ void ArrangePoints::calculate() { } // Do the optimization optimize( pos ); - // Make sure all the components are the right size - for(unsigned j=0; jgetShape()[0]!=nvals ) { - std::vector shape(1,nvals); getPntrToComponent(j)->setShape( shape ); - } - } // And set the final values for(unsigned i=0; iset( i, pos[dimout*i+j] ); diff --git a/src/dimred/ClassicalMultiDimensionalScaling.cpp b/src/dimred/ClassicalMultiDimensionalScaling.cpp index 64ceabddb0..ff948203e2 100644 --- a/src/dimred/ClassicalMultiDimensionalScaling.cpp +++ b/src/dimred/ClassicalMultiDimensionalScaling.cpp @@ -175,6 +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.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 006614f979..711697f6e3 100644 --- a/src/dimred/PCA.cpp +++ b/src/dimred/PCA.cpp @@ -113,6 +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.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/SketchMap.cpp b/src/dimred/SketchMap.cpp index 068d1d2468..698ad35b8c 100644 --- a/src/dimred/SketchMap.cpp +++ b/src/dimred/SketchMap.cpp @@ -63,8 +63,10 @@ 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.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("OUTER_PRODUCT"); keys.needsAction("ARRANGE_POINTS"); keys.needsAction("PROJECT_POINTS"); keys.needsAction("VSTACK"); } SketchMap::SketchMap( const ActionOptions& ao): @@ -100,7 +102,7 @@ SketchMap::SketchMap( const ActionOptions& ao): readInputLine( wvec + "_mat: OUTER_PRODUCT ARG=" + wvec + "_normed," + wvec + "_normed"); // Run the arrange points object std::string ldfunc, cgtol, maxiter; parse("LOW_DIM_FUNCTION",ldfunc); parse("CGTOL",cgtol); parse("MAXITER",maxiter); unsigned ncycles; parse("NCYCLES",ncycles); - std::string num, argstr, lname=getShortcutLabel(); if( ncycles>0 ) lname = getShortcutLabel() + "_cg"; + std::string num, argstr, lname=getShortcutLabel() + "_ap"; if( ncycles>0 ) lname = getShortcutLabel() + "_cg"; argstr = "ARG=" + getShortcutLabel() + "_mds-1"; for(unsigned i=1; i cgrid(ndim); parseVector("CGRID_SIZE",cgrid); pwise_args += " CGRID_SIZE=" + cgrid[0]; for(unsigned i=1; igetName().find("LANDMARK_SELECT")==std::string::npos ) { - readInputLine( getShortcutLabel() + "_osample: PROJECT_POINTS " + argstr + " TARGET1=" + getShortcutLabel() + "_hdmat FUNC1={" + ldfunc + "} WEIGHTS1=" + wvec + "_normed CGTOL=" + cgtol ); + readInputLine( getShortcutLabel() + "_osample_pp: PROJECT_POINTS " + argstr + " TARGET1=" + getShortcutLabel() + "_hdmat FUNC1={" + ldfunc + "} WEIGHTS1=" + wvec + "_normed CGTOL=" + cgtol ); } else { ActionWithValue* dissims = plumed.getActionSet().selectWithLabel( argn + "_rectdissims"); if( !dissims ) error("cannot PROJECT_ALL as " + as->getName() + " with label " + argn + " was involved without the DISSIMILARITIES keyword"); readInputLine( getShortcutLabel() + "_lhdmat: MORE_THAN ARG=" + argn + "_rectdissims SQUARED SWITCH={" + hdfunc + "}"); - readInputLine( getShortcutLabel() + "_osample: PROJECT_POINTS ARG=" + argstr + " TARGET1=" + getShortcutLabel() + "_lhdmat FUNC1={" + ldfunc + "} WEIGHTS1=" + wvec + "_normed CGTOL=" + cgtol ); + readInputLine( getShortcutLabel() + "_osample_pp: PROJECT_POINTS ARG=" + argstr + " TARGET1=" + getShortcutLabel() + "_lhdmat FUNC1={" + ldfunc + "} WEIGHTS1=" + wvec + "_normed CGTOL=" + cgtol ); } + argstr="ARG=" + getShortcutLabel() + "_osample_pp.coord-1"; for(unsigned i=1; i