@@ -0,0 +1,1471 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public%0A * License, v. 2.0. If a copy of the MPL was not distributed with this%0A * file, You can obtain one at http://mozilla.org/MPL/2.0/. */%0Apackage etomica.modules.nucleation;%0A%0Aimport etomica.atom.AtomTest;%0Aimport etomica.atom.IAtom;%0Aimport etomica.box.Box;%0Aimport etomica.data.DataSourceScalar;%0Aimport etomica.modules.glass.AtomNbrClusterer;%0Aimport etomica.units.dimensions.Quantity;%0A%0Apublic class MeterLargestCluster extends DataSourceScalar %7B%0A%0A    protected final AtomNbrClusterer clusterer;%0A    protected final Box box;%0A%0A    public MeterLargestCluster(Box box) %7B%0A        super(%22largest cluster%22, Quantity.DIMENSION);%0A        this.box = box;%0A        clusterer = new AtomNbrClusterer(box, new AtomTest() %7B%0A            @Override%0A            public boolean test(IAtom a) %7B%0A                return true;%0A            %7D%0A        %7D);%0A        clusterer.setNbrMax(1.5);%0A    %7D%0A%0A    public double getDataAsScalar() %7B%0A        clusterer.findClusters();%0A        int%5B%5D firstAtom = clusterer.getFirstAtom();%0A        int%5B%5D nextAtom = clusterer.getNextAtom();%0A        int largestCluster = 0;%0A        for (int i = 0; i %3C firstAtom.length; i++) %7B%0A            if (firstAtom%5Bi%5D == -1) break;%0A            int s = 0;%0A            for (int ii = firstAtom%5Bi%5D; ii != -1; ii = nextAtom%5Bii%5D) %7B%0A                s++;%0A            %7D%0A            if (s %3E largestCluster) largestCluster = s;%0A        %7D%0A        return largestCluster;%0A    %7D%0A%0A%7D%0A

add meter cluster size data collection