package etomica.models.water;

import etomica.api.IAtomTypeSphere;
import etomica.api.IMolecule;
import etomica.atom.AtomLeaf;
import etomica.atom.AtomPositionGeometricCenter;
import etomica.atom.AtomTypeSphere;
import etomica.atom.Molecule;
import etomica.chem.elements.ElementSimple;
import etomica.chem.elements.Hydrogen;
import etomica.chem.elements.Oxygen;
import etomica.space.ISpace;
import etomica.species.Species;

/**
 * Species for 4-point water molecule.
 */
public class SpeciesWater4P extends Species {

    public SpeciesWater4P(ISpace space) {
        super(new AtomPositionGeometricCenter(space));
        this.space = space;
        hType = new AtomTypeSphere(Hydrogen.INSTANCE, 2.0);
        oType = new AtomTypeSphere(Oxygen.INSTANCE, 3.167);
        mType = new AtomTypeSphere(new ElementSimple("M", 1.0), 2.0);
        addChildType(hType);
        addChildType(oType);
        addChildType(mType);

        setConformation(new ConformationWaterTIP4P(space)); 
     }

     public IMolecule makeMolecule() {
         Molecule water = new Molecule(this);
         water.addChildAtom(new AtomLeaf(space, hType));
         water.addChildAtom(new AtomLeaf(space, hType));
         water.addChildAtom(new AtomLeaf(space, oType));
         water.addChildAtom(new AtomLeaf(space, mType));
         conformation.initializePositions(water.getChildList());
         return water;
     }

     public IAtomTypeSphere getHydrogenType() {
         return hType;
     }

     public AtomTypeSphere getOxygenType() {
         return oType;
     }

     public IAtomTypeSphere getMType() {
         return mType;
     }

     public int getNumLeafAtoms() {
         return 4;
     }
    
    public final static int indexH1 = 0;
    public final static int indexH2 = 1;
    public final static int indexO  = 2;
    public final static int indexM  = 3;

    private static final long serialVersionUID = 1L;
    protected final ISpace space;
    protected final AtomTypeSphere oType, hType, mType;
}
@@ -120,16 +120,53 @@
 omLeaf;%0A
+import etomica.atom.AtomLeafDynamic;%0A
 import e
@@ -206,16 +206,16 @@
 Center;%0A
-
 import e
@@ -586,24 +586,124 @@
 ce space) %7B%0A
+        this(space, false);%0A    %7D%0A    %0A    public SpeciesWater4P(ISpace space, boolean isDynamic) %7B%0A
         supe
@@ -769,24 +769,60 @@
 ce = space;%0A
+        this.isDynamic = isDynamic;%0A
         hTyp
@@ -1261,32 +1261,80 @@
 er.addChildAtom(
+isDynamic ? new AtomLeafDynamic(space, hType) : 
 new AtomLeaf(spa
@@ -1366,32 +1366,80 @@
 er.addChildAtom(
+isDynamic ? new AtomLeafDynamic(space, hType) : 
 new AtomLeaf(spa
@@ -1471,32 +1471,80 @@
 er.addChildAtom(
+isDynamic ? new AtomLeafDynamic(space, oType) : 
 new AtomLeaf(spa
@@ -1584,16 +1584,64 @@
 ildAtom(
+isDynamic ? new AtomLeafDynamic(space, mType) : 
 new Atom
@@ -2269,16 +2269,16 @@
 D = 1L;%0A
-
     prot
@@ -2299,24 +2299,63 @@
 pace space;%0A
+    protected final boolean isDynamic;%0A
     protecte

allow for dynamic water