package etomica.simulation.prototypes;

import etomica.action.BoxImposePbc;
import etomica.action.BoxInflate;
import etomica.action.activity.ActivityIntegrate;
import etomica.atom.AtomType;
import etomica.box.Box;
import etomica.config.ConfigurationLattice;
import etomica.data.DataSourceCountSteps;
import etomica.integrator.IntegratorMC;
import etomica.integrator.mcmove.MCMoveAtom;
import etomica.integrator.mcmove.MCMoveVolume;
import etomica.lattice.LatticeCubicFcc;
import etomica.listener.IntegratorListenerAction;
import etomica.potential.P2SoftSphere;
import etomica.potential.P2SoftSphericalTruncated;
import etomica.potential.PotentialMasterMonatomic;
import etomica.simulation.Simulation;
import etomica.space3d.Space3D;
import etomica.species.SpeciesSpheresMono;

/**
 * A demo simulation to test aspects of the frontend.
 * <p>
 * Separate paragraph
 * <p>
 * Another paragraph. {@code some.code;}
 * <p>
 * <ul>
 * <li>List item</li>
 * </ul>
 */
public class DemoSim extends Simulation {

    private final PotentialMasterMonatomic potentialMaster;

    public DemoSim() {
        super(Space3D.getInstance());
        potentialMaster = new PotentialMasterMonatomic(this);
        IntegratorMC integrator = new IntegratorMC(this, potentialMaster);
        integrator.setTemperature(1);


        MCMoveAtom mcMoveAtom = new MCMoveAtom(random, potentialMaster, space);
        ActivityIntegrate activityIntegrate = new ActivityIntegrate(integrator);
        activityIntegrate.setMaxSteps(10000000);
        getController().addAction(activityIntegrate);

        SpeciesSpheresMono species = new SpeciesSpheresMono(this, space);
        //species2 = new SpeciesSpheresMono(this);
        addSpecies(species);
        Box box = new Box(space);
        addBox(box);
        box.setNMolecules(species, 108);
        BoxInflate inflater = new BoxInflate(box, space);
        inflater.setTargetDensity(1);
        inflater.actionPerformed();
        new ConfigurationLattice(new LatticeCubicFcc(space), space).initializeCoordinates(box);
        P2SoftSphere potential = new P2SoftSphere(space, 1, 1, 12);
        P2SoftSphericalTruncated truncated = new P2SoftSphericalTruncated(space, potential, box.getBoundary().getBoxSize().getX(0) / 2);

        AtomType type1 = species.getLeafType();
        potentialMaster.addPotential(truncated, new AtomType[]{type1, type1});

        DataSourceCountSteps meterCycles = new DataSourceCountSteps(integrator);

        integrator.setBox(box);
        integrator.getMoveManager().addMCMove(mcMoveAtom);
        integrator.getEventManager().addListener(new IntegratorListenerAction(new BoxImposePbc(box, space)));

        MCMoveVolume mcMoveVolume = new MCMoveVolume(potentialMaster, this.getRandom(), this.getSpace(), 1);
        integrator.getMoveManager().addMCMove(mcMoveVolume);


    }

}

@@ -271,36 +271,65 @@
 ca.data.
-DataSourceCountSteps
+*;%0Aimport etomica.data.meter.MeterPotentialEnergy
 ;%0Aimport
@@ -2854,22 +2854,993 @@
 veVolume);%0A%0A
+        MeterPotentialEnergy energy = new MeterPotentialEnergy(potentialMaster);%0A        energy.setBox(box);%0A%0A        AccumulatorHistogram hist = new AccumulatorHistogram();%0A        DataPump histPump = new DataPump(energy, hist);%0A        IntegratorListenerAction histAct = new IntegratorListenerAction(histPump);%0A        integrator.getEventManager().addListener(histAct);%0A%0A        AccumulatorAverageCollapsing avgEnergy = new AccumulatorAverageCollapsing();%0A        avgEnergy.setPushInterval(10);%0A        DataPump pump = new DataPump(energy, avgEnergy);%0A        IntegratorListenerAction pumpListener = new IntegratorListenerAction(pump);%0A        pumpListener.setInterval(10);%0A        integrator.getEventManager().addListener(pumpListener);%0A%0A        AccumulatorHistory h = new AccumulatorHistory();%0A        DataPump hp = new DataPump(energy, h);%0A        IntegratorListenerAction ha = new IntegratorListenerAction(hp);%0A        integrator.getEventManager().addListener(ha);%0A
 %0A    %7D%0A%0A%7D%0A

Add histogram and history accumulators to DemoSim