diff --git a/regtest/adjmat/rt-dfg2/plumed.dat b/regtest/adjmat/rt-dfg2/plumed.dat index 7ec48683272370de215e2dfe148bcb5d58651536..8cc97a83303a40a04679bf6d4b3fbb50b7b74af3 100644 --- a/regtest/adjmat/rt-dfg2/plumed.dat +++ b/regtest/adjmat/rt-dfg2/plumed.dat @@ -12,6 +12,7 @@ OUTPUT_CLUSTER CLUSTERS=dfs CLUSTER=1 FILE=dfs.dat clust2a: CLUSTER_WITHSURFACE CLUSTERS=dfs RCUT_SURF=0.3 size2a: CLUSTER_NATOMS CLUSTERS=clust2a CLUSTER=2 +dia2a: CLUSTER_DIAMETER CLUSTERS=clust2a CLUSTER=2 OUTPUT_CLUSTER CLUSTERS=clust2a CLUSTER=2 FILE=dfs2.dat -PRINT ARG=size2a FILE=size +PRINT ARG=size2a,dia2a FILE=size FMT=%8.4f diff --git a/regtest/adjmat/rt-dfg2/size.reference b/regtest/adjmat/rt-dfg2/size.reference index 180f9d2e4b6ee05ae999415971b354717c45080a..0ed52ef5855fdb85f7b7be585f7d62eca9f07cdf 100644 --- a/regtest/adjmat/rt-dfg2/size.reference +++ b/regtest/adjmat/rt-dfg2/size.reference @@ -1,2 +1,2 @@ -#! FIELDS time size2a - 0.000000 78.000000 +#! FIELDS time size2a dia2a + 0.000000 78.0000 2.3294 diff --git a/src/adjmat/ClusterAnalysisBase.cpp b/src/adjmat/ClusterAnalysisBase.cpp index e92367e9223a29389bf17ef3fd7be222eb23b61c..1b92aca9d32000f25200d859237f9c97fb947778 100644 --- a/src/adjmat/ClusterAnalysisBase.cpp +++ b/src/adjmat/ClusterAnalysisBase.cpp @@ -41,12 +41,6 @@ myclusters(NULL) if(!found_cluster) error("unable to interpret input clusters " + matname[0] ); myclusters = dynamic_cast<ClusteringBase*>( mybasemulticolvars[0] ); if( !myclusters ) error("input label is not that of a DFS object"); - - // Create all tasks by copying those from underlying DFS object (which is actually MultiColvar) - for(unsigned i=0;i<myclusters->getNumberOfNodes();++i) addTaskToList(i); - - // And now finish the setup of everything in the base - setupAtomLists(); } void ClusterAnalysisBase::turnOnDerivatives(){ diff --git a/src/adjmat/ClusterDiameter.cpp b/src/adjmat/ClusterDiameter.cpp index f250e0afb31f98a409a57ac1dc673a6296fbf75b..af37292eccf9cce7a5773b5328bde43b87c2182e 100644 --- a/src/adjmat/ClusterDiameter.cpp +++ b/src/adjmat/ClusterDiameter.cpp @@ -72,7 +72,7 @@ ClusterAnalysisBase(ao) for(unsigned j=0;j<i;++j) addTaskToList( i*getNumberOfNodes() + j ); } // Now create a higest vessel - addVessel("HIGHEST", "", -1); readVesselKeywords(); + addVessel("HIGHEST", "", -1); setupAtomLists(); } void ClusterDiameter::turnOnDerivatives(){ @@ -93,22 +93,10 @@ void ClusterDiameter::calculate(){ } void ClusterDiameter::performTask( const unsigned& task_index, const unsigned& current, MultiValue& myvals ) const { - unsigned iatom=current/getNumberOfNodes(), jatom = current - iatom*getNumberOfNodes(); + unsigned iatom=std::floor(current/getNumberOfNodes()), jatom = current - iatom*getNumberOfNodes(); Vector distance=getSeparation( getPosition(iatom), getPosition(jatom) ); - double dd = distance.modulo(), inv = 1.0/dd ; myvals.setValue( 1, dd ); - if( !doNotCalculateDerivatives() ){ - myvals.addDerivative( 1, 3*iatom + 0, -inv*distance[0] ); - myvals.addDerivative( 1, 3*iatom + 1, -inv*distance[1] ); - myvals.addDerivative( 1, 3*iatom + 2, -inv*distance[2] ); - myvals.addDerivative( 1, 3*jatom + 0, +inv*distance[0] ); - myvals.addDerivative( 1, 3*jatom + 1, +inv*distance[1] ); - myvals.addDerivative( 1, 3*jatom + 2, +inv*distance[2] ); - Tensor vir = -inv*Tensor(distance,distance); - unsigned vbase = myvals.getNumberOfDerivatives() - 9; - for(unsigned i=0;i<3;++i){ - for(unsigned j=0;j<3;++j) myvals.addDerivative( 1, vbase+3*i+j, vir(i,j) ); - } - } + double dd = distance.modulo(), inv = 1.0/dd ; + myvals.setValue( 0, 1.0 ); myvals.setValue( 1, dd ); } } diff --git a/src/adjmat/ClusterDistribution.cpp b/src/adjmat/ClusterDistribution.cpp index 14810ede92e67ed4b72a3f76048a833b2e6e43de..38f4870954fd6bb29733dfffa8f867a8e07d5beb 100644 --- a/src/adjmat/ClusterDistribution.cpp +++ b/src/adjmat/ClusterDistribution.cpp @@ -78,8 +78,11 @@ nderivatives(0) parseFlag("INVERSE_TRANSFORM",inverse); if( inverse && !use_switch ) error("INVERSE_TRANSFORM option was specified but no TRANSOFRM switching function was given"); - // Setup the various things this will calculate - readVesselKeywords(); + // Create all tasks by copying those from underlying DFS object (which is actually MultiColvar) + for(unsigned i=0;i<getNumberOfNodes();++i) addTaskToList(i); + + // And now finish the setup of everything in the base + setupAtomLists(); } void ClusterDistribution::calculate(){ diff --git a/src/adjmat/ClusterProperties.cpp b/src/adjmat/ClusterProperties.cpp index c7a7f7c5cfaba33f76423b29a1893f3881bbcec9..5e8a889bba2d03f6e91cc7f92befa3a0fc82c4b0 100644 --- a/src/adjmat/ClusterProperties.cpp +++ b/src/adjmat/ClusterProperties.cpp @@ -165,8 +165,11 @@ ClusterAnalysisBase(ao) if( clustr<1 ) error("cannot look for a cluster larger than the largest cluster"); if( clustr>getNumberOfNodes() ) error("cluster selected is invalid - too few atoms in system"); - // Setup the various things this will calculate - readVesselKeywords(); + // Create all tasks by copying those from underlying DFS object (which is actually MultiColvar) + for(unsigned i=0;i<getNumberOfNodes();++i) addTaskToList(i); + + // And now finish the setup of everything in the base + setupAtomLists(); } void ClusterProperties::calculate(){ diff --git a/src/adjmat/ClusterSize.cpp b/src/adjmat/ClusterSize.cpp index 5ae3eb1f447f72daca816bd830a6eac5f10cae71..a636dce7141f1ff2a190fff42bc8f342d61f7129 100644 --- a/src/adjmat/ClusterSize.cpp +++ b/src/adjmat/ClusterSize.cpp @@ -68,7 +68,10 @@ ClusterAnalysisBase(ao) if( clustr<1 ) error("cannot look for a cluster larger than the largest cluster"); if( clustr>getNumberOfNodes() ) error("cluster selected is invalid - too few atoms in system"); - addValue(); setNotPeriodic(); + // Create all tasks by copying those from underlying DFS object (which is actually MultiColvar) + for(unsigned i=0;i<getNumberOfNodes();++i) addTaskToList(i); + // And now finish the setup of everything in the base + setupAtomLists(); addValue(); setNotPeriodic(); } void ClusterSize::turnOnDerivatives(){