@@ -0,0 +1,1580 @@
+package etomica.osmoticvirial;%0A%0Aimport etomica.atom.AtomType;%0Aimport etomica.atom.IAtomList;%0Aimport etomica.box.Box;%0Aimport etomica.data.DataSourceScalar;%0Aimport etomica.molecule.IMolecule;%0Aimport etomica.molecule.IMoleculeList;%0Aimport etomica.molecule.iterator.MpiIntraspeciesAA;%0Aimport etomica.space.Boundary;%0Aimport etomica.space.Space;%0Aimport etomica.space.Vector;%0Aimport etomica.species.ISpecies;%0Aimport etomica.units.Length;%0A%0Apublic class MeterRminSpecies extends DataSourceScalar %7B%0A    protected AtomType type1, type2;%0A    protected MpiIntraspeciesAA iterator;%0A    protected Vector dr;%0A    protected Boundary boundary;%0A%0A    public MeterRminSpecies(Space space, Box box, ISpecies species)%7B%0A        super(%22RminSpecies%22, Length.DIMENSION);%0A        dr = space.makeVector();%0A        iterator = new MpiIntraspeciesAA(species);%0A        iterator.setBox(box);%0A        boundary = box.getBoundary();%0A%0A    %7D%0A%0A    @Override%0A    public double getDataAsScalar() %7B%0A        double rminSq = Double.POSITIVE_INFINITY;%0A        iterator.reset();%0A        for (IMoleculeList pair = iterator.next(); pair != null;%0A             pair = iterator.next()) %7B%0A            if (type1 != null && (pair.getMolecule(0).getType() != type1 %7C%7C pair.getMolecule(1).getType() != type2)) continue;%0A            dr.Ev1Mv2(pair.getMolecule(1).getChildList().getAtom(0).getPosition(),pair.getMolecule(0).getChildList().getAtom(0).getPosition());%0A            boundary.nearestImage(dr);%0A            double r2 = dr.squared();%0A            if (rminSq %3E r2) rminSq = r2;%0A%0A        %7D%0A        return Math.sqrt(rminSq);%0A    %7D%0A%0A%7D%0A

add meter to calculate min distance for a specific species