<commit_before>package etomica.modules.sam;
import etomica.action.activity.ActivityIntegrate;
import etomica.api.IAtomLeaf;
import etomica.api.IAtomSet;
import etomica.api.IAtomType;
import etomica.api.IAtomTypeLeaf;
import etomica.api.IBox;
import etomica.api.IMolecule;
import etomica.api.IPotentialMaster;
import etomica.api.ISpecies;
import etomica.api.IVector;
import etomica.atom.AtomTypeSphere;
import etomica.atom.iterator.ApiBuilder;
import etomica.atom.iterator.Atomset3IteratorIndexList;
import etomica.atom.iterator.Atomset4IteratorIndexList;
import etomica.atom.iterator.AtomsetIteratorBasisDependent;
import etomica.box.Box;
import etomica.chem.elements.ElementSimple;
import etomica.config.Conformation;
import etomica.config.ConformationChainZigZag;
import etomica.graphics.DisplayBoxCanvasG3DSys;
import etomica.graphics.DisplayCanvas;
import etomica.graphics.SimulationGraphic;
import etomica.integrator.IntegratorVelocityVerlet;
import etomica.lattice.crystal.BasisMonatomic;
import etomica.paracetamol.ApiIndexList;
import etomica.potential.P2Harmonic;
import etomica.potential.P2LennardJones;
import etomica.potential.P3BondAngle;
import etomica.potential.P4BondTorsion;
import etomica.potential.PotentialGroup;
import etomica.potential.PotentialMaster;
import etomica.simulation.Simulation;
import etomica.space.BoundaryRectangularSlit;
import etomica.space.Space;
import etomica.space3d.Space3D;
import etomica.species.SpeciesSpheresMono;
import etomica.units.Kelvin;
import etomica.units.Pixel;
import etomica.virial.SpeciesAlkane;

/**
 * Self-assembled monolayer module.
 * @author <NAME>
 *
 */
public class Sam extends Simulation {
    
    private static final long serialVersionUID = 1L;
    public SpeciesAlkane species;
    public IBox box;
    public IntegratorVelocityVerlet integrator;
    public ActivityIntegrate activityIntegrate;
    public P1WCAWall wallPotential;
    public ConfigurationSAM config;
    public P2LennardJones p2CH2, p2CH3, p2CH2CH3;
    public P2Harmonic p2Bond;
    public P3BondAngle p3Bond;
    public P4BondTorsion p4Bond;
    public PotentialGroup p1Intra;
    public int chainLength;
    
    public Sam() {
        super(Space.getInstance(3));
        PotentialMaster potentialMaster = new PotentialMaster(space); //List(this, 2.0);

        int nCellX = 10;
        int nCellZ = 10;
        double sizeCellX = 4;
        double sizeCellZ = 4;
        chainLength = 7;

        double surfaceSigma = 4.0;
        double sigma = 4.0;
        double bondL = 3.0;
        double epsilon = Kelvin.UNIT.toSim(100);

        //controller and integrator

	    //species and potentials
//	    species = new SpeciesSpheres(this, chainLength, new ElementSimple(this), new ConformationChain3D(space, new IVector[]{space.makeVector(new double[]{0, bondL, 0})}), space);
//	    ((AtomTypeSphere)species.getLeafType()).setDiameter(sigma);
        species = new SpeciesAlkane(this, space, chainLength);
        getSpeciesManager().addSpecies(species);

        //construct box
	    box = new Box(new BoundaryRectangularSlit(this, 1, space), space);
        addBox(box);
        IVector dim = space.makeVector();
        dim.E(new double[]{sizeCellX*nCellX, chainLength*bondL, sizeCellZ*nCellZ});
        box.setDimensions(dim);
        box.setNMolecules(species, nCellX*nCellZ);

        SpeciesSpheresMono speciesSurface = new SpeciesSpheresMono(this, space);
        ((AtomTypeSphere)speciesSurface.getLeafType()).setDiameter(surfaceSigma);
        ((ElementSimple)speciesSurface.getLeafType().getElement()).setMass(Double.POSITIVE_INFINITY);
        getSpeciesManager().addSpecies(speciesSurface);

        bondL = 1.54;
        double bondTheta = Math.PI*114/180;
        IVector vector1 = space.makeVector();
        vector1.setX(0, bondL);
        IVector vector2 = space.makeVector();
        vector2.setX(0, bondL*Math.cos(bondTheta));
        vector2.setX(1, bondL*Math.sin(bondTheta));
        Conformation conformation = new ConformationChainZigZag(space, vector1, vector2);
        species.setConformation(conformation);

        config = new ConfigurationSAM(this, space, species, speciesSurface);
        config.setBasisMolecules(new BasisMonatomic(space));
        config.setBasisSurface(new BasisMonatomic(space));
        config.setCellSizeX(4);
        config.setCellSizeZ(4);
        config.setNCellsX(4);
        config.setNCellsZ(4);
        config.setYOffset(4);

        config.initializeCoordinates(box);<commit_msg>change conformation (angle of chain to be vertical) so that initial energy is lower<commit_after>package etomica.modules.sam;
import etomica.action.activity.ActivityIntegrate;
import etomica.api.IAtomLeaf;
import etomica.api.IAtomSet;
import etomica.api.IAtomType;
import etomica.api.IAtomTypeLeaf;
import etomica.api.IBox;
import etomica.api.IMolecule;
import etomica.api.IPotentialMaster;
import etomica.api.ISpecies;
import etomica.api.IVector;
import etomica.atom.AtomTypeSphere;
import etomica.atom.iterator.ApiBuilder;
import etomica.atom.iterator.Atomset3IteratorIndexList;
import etomica.atom.iterator.Atomset4IteratorIndexList;
import etomica.atom.iterator.AtomsetIteratorBasisDependent;
import etomica.box.Box;
import etomica.chem.elements.ElementSimple;
import etomica.config.Conformation;
import etomica.config.ConformationChainZigZag;
import etomica.graphics.DisplayBoxCanvasG3DSys;
import etomica.graphics.DisplayCanvas;
import etomica.graphics.SimulationGraphic;
import etomica.integrator.IntegratorVelocityVerlet;
import etomica.lattice.crystal.BasisMonatomic;
import etomica.paracetamol.ApiIndexList;
import etomica.potential.P2Harmonic;
import etomica.potential.P2LennardJones;
import etomica.potential.P3BondAngle;
import etomica.potential.P4BondTorsion;
import etomica.potential.PotentialGroup;
import etomica.potential.PotentialMaster;
import etomica.simulation.Simulation;
import etomica.space.BoundaryRectangularSlit;
import etomica.space.Space;
import etomica.space3d.Space3D;
import etomica.species.SpeciesSpheresMono;
import etomica.units.Kelvin;
import etomica.units.Pixel;
import etomica.virial.SpeciesAlkane;

/**
 * Self-assembled monolayer module.
 * @author <NAME>
 *
 */
public class Sam extends Simulation {
    
    private static final long serialVersionUID = 1L;
    public SpeciesAlkane species;
    public IBox box;
    public IntegratorVelocityVerlet integrator;
    public ActivityIntegrate activityIntegrate;
    public P1WCAWall wallPotential;
    public ConfigurationSAM config;
    public P2LennardJones p2CH2, p2CH3, p2CH2CH3;
    public P2Harmonic p2Bond;
    public P3BondAngle p3Bond;
    public P4BondTorsion p4Bond;
    public PotentialGroup p1Intra;
    public int chainLength;
    
    public Sam() {
        super(Space.getInstance(3));
        PotentialMaster potentialMaster = new PotentialMaster(space); //List(this, 2.0);

        int nCellX = 10;
        int nCellZ = 10;
        double sizeCellX = 4;
        double sizeCellZ = 4;
        chainLength = 7;

        double surfaceSigma = 4.0;
        double sigma = 4.0;
        double bondL = 3.0;
        double epsilon = Kelvin.UNIT.toSim(100);

        //controller and integrator

	    //species and potentials
//	    species = new SpeciesSpheres(this, chainLength, new ElementSimple(this), new ConformationChain3D(space, new IVector[]{space.makeVector(new double[]{0, bondL, 0})}), space);
//	    ((AtomTypeSphere)species.getLeafType()).setDiameter(sigma);
        species = new SpeciesAlkane(this, space, chainLength);
        getSpeciesManager().addSpecies(species);

        //construct box
	    box = new Box(new BoundaryRectangularSlit(this, 1, space), space);
        addBox(box);
        IVector dim = space.makeVector();
        dim.E(new double[]{sizeCellX*nCellX, chainLength*bondL, sizeCellZ*nCellZ});
        box.setDimensions(dim);
        box.setNMolecules(species, nCellX*nCellZ);

        SpeciesSpheresMono speciesSurface = new SpeciesSpheresMono(this, space);
        ((AtomTypeSphere)speciesSurface.getLeafType()).setDiameter(surfaceSigma);
        ((ElementSimple)speciesSurface.getLeafType().getElement()).setMass(Double.POSITIVE_INFINITY);
        getSpeciesManager().addSpecies(speciesSurface);

        bondL = 1.54;
        double bondTheta = Math.PI*114/180;
        IVector vector1 = space.makeVector();
        vector1.setX(0, Math.cos(bondTheta/2)*bondL);
        vector1.setX(1, Math.sin(bondTheta/2)*bondL);
        IVector vector2 = space.makeVector();
        vector2.setX(0, -Math.cos(bondTheta/2)*bondL);
        vector2.setX(1, Math.sin(bondTheta/2)*bondL);
        Conformation conformation = new ConformationChainZigZag(space, vector1, vector2);
        species.setConformation(conformation);

        config = new ConfigurationSAM(this, space, species, speciesSurface);
        config.setBasisMolecules(new BasisMonatomic(space));
        config.setBasisSurface(new BasisMonatomic(space));
        config.setCellSizeX(4);
        config.setCellSizeZ(4);
        config.setNCellsX(4);
        config.setNCellsZ(4);
        config.setYOffset(3.3);

        config.initializeCoordinates(box);
{'fraction_non_alphanumeric': 0.09755830504762948, 'fraction_numerical': 0.01675243622030001, 'mean_word_length': 4.140123804164322, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6805598', 'n_tokens_mistral': 3085, 'n_tokens_neox': 2911, 'n_words': 542}