<commit_before>package etomica.data.meter;

import etomica.Atom;
import etomica.Default;
import etomica.EtomicaElement;
import etomica.EtomicaInfo;
import etomica.Phase;
import etomica.PotentialMaster;
import etomica.Space;
import etomica.Species;
import etomica.action.AtomActionTranslateTo;
import etomica.atom.AtomTreeNodeGroup;
import etomica.units.Dimension;

/**
 * Meter to measure the chemical potential (as its exponent: exp(-mu/kT)) of a
 * species via the Widom insertion method. Call to getDataAsScalar returns a
 * Widom-insertion average (i.e., sum of exp(-energy/kT) using a configurable
 * number of insertion trials) for a molecule of the desired species in the
 * given phase in its current configuration. It is expected that repeated calls
 * will be averaged to give an overall insertion average for many configurations
 * of the phase.
 * <br>
 * Meter can be configured to measure the residual chemical potential -- above
 * the ideal-gas value -- or the full chemical potential.  If not configured for
 * the residual chemical potential, the insertion average will be multiplied by
 * the species number density in the phase in its current configuration.  Default
 * behavior will give residual chemical potential.
 * 
 * @author <NAME>
 */
public class MeterWidomInsertion extends MeterScalar implements EtomicaElement {

	public MeterWidomInsertion(Space space, PotentialMaster potentialMaster) {
		super();
		energyMeter = new MeterPotentialEnergy(potentialMaster);
		setLabel("exp(-\u03BC/kT)"); //"\u03BC" is Unicode for greek "mu"
		nInsert = 100;
		setResidual(true);
		setTemperature(Default.TEMPERATURE);
        atomTranslator = new AtomActionTranslateTo(space); 

		//add mediator so that by default first species added to simulation is
		// used for sampling
		//if nothing else was previously specified
		//        sim.elementCoordinator.addMediatorPair(new
		// Mediator.MeterSpecies(sim.elementCoordinator) {
		//            public void add(Species species) {
		//                if(MeterWidomInsertion.this.wasAdded() ||
		// MeterWidomInsertion.this.getSpecies()==null)
		//                        MeterWidomInsertion.this.setSpecies(species);
		//            }
		//            public void add(MeterAbstract meter) {
		//                if(meter != MeterWidomInsertion.this ||
		// MeterWidomInsertion.this.getSpecies()!=null) return;
		//                for(Iterator ip=mediator.parentSimulation().speciesList().iterator();
		// ip.hasNext(); ) {
		//                    Species species = (Species)ip.next();
		//                    if(species.wasAdded()) {//will make first species the one
		//                        MeterWidomInsertion.this.setSpecies(species);
		//                        return;
		//                    }
		//                }
		//            }
		//        });
	}

	public static EtomicaInfo getEtomicaInfo() {<commit_msg>clean up<commit_after>package etomica.data.meter;

import etomica.Atom;
import etomica.Default;
import etomica.EtomicaElement;
import etomica.EtomicaInfo;
import etomica.Phase;
import etomica.PotentialMaster;
import etomica.Space;
import etomica.Species;
import etomica.action.AtomActionTranslateTo;
import etomica.atom.AtomTreeNodeGroup;
import etomica.units.Dimension;

/**
 * Meter to measure the chemical potential (as its exponent: exp(-mu/kT)) of a
 * species via the Widom insertion method. Call to getDataAsScalar returns a
 * Widom-insertion average (i.e., sum of exp(-energy/kT) using a configurable
 * number of insertion trials) for a molecule of the desired species in the
 * given phase in its current configuration. It is expected that repeated calls
 * will be averaged to give an overall insertion average for many configurations
 * of the phase.
 * <br>
 * Meter can be configured to measure the residual chemical potential -- above
 * the ideal-gas value -- or the full chemical potential.  If not configured for
 * the residual chemical potential, the insertion average will be multiplied by
 * the species number density in the phase in its current configuration.  Default
 * behavior will give residual chemical potential.
 * 
 * @author <NAME>
 */
public class MeterWidomInsertion extends MeterScalar implements EtomicaElement {

	public MeterWidomInsertion(Space space, PotentialMaster potentialMaster) {
		super();
		energyMeter = new MeterPotentialEnergy(potentialMaster);
		setLabel("exp(-\u03BC/kT)"); //"\u03BC" is Unicode for greek "mu"
		nInsert = 100;
		setResidual(true);
		setTemperature(Default.TEMPERATURE);
        atomTranslator = new AtomActionTranslateTo(space); 

	}

	public static EtomicaInfo getEtomicaInfo() {
{'fraction_non_alphanumeric': 0.08644104332830352, 'fraction_numerical': 0.003017891787023065, 'mean_word_length': 3.4148430066603237, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6877664', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1298, 'n_words': 424}