/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package etomica.normalmode;

import etomica.api.IAtom;
import etomica.api.IAtomList;
import etomica.api.IVectorMutable;
import etomica.config.IConformation;
import etomica.space.ISpace;

 /**
  *  Conformation for HS Dimer
  *
  * @author Tai Boon Tan
  *
  */
public class ConformationHSDimer implements IConformation, java.io.Serializable{
	
	public ConformationHSDimer(ISpace space){
		this.space = space;
		vector = space.makeVector();
	}

	public void initializePositions(IAtomList atomList) {
			
		IAtom n1 = atomList.getAtom(SpeciesHSDimer.indexAtom1);
		n1.getPosition().E(new double[] {-L/2, 0, 0});
		
		IAtom n2 = atomList.getAtom(SpeciesHSDimer.indexAtom2);
		n2.getPosition().E(new double[] {L/2, 0, 0});
		
	}
		
	protected final ISpace space;
	protected static final double L = 0.6;
	
	protected IVectorMutable vector;
	
	private static final long serialVersionUID = 1L;
}

@@ -284,16 +284,44 @@
 omList;%0A
+import etomica.api.IVector;%0A
 import e
@@ -382,16 +382,59 @@
 ormation
+Oriented;%0Aimport etomica.space.IOrientation
 ;%0Aimport
@@ -588,16 +588,24 @@
 ormation
+Oriented
 , java.i
@@ -662,16 +662,26 @@
 ce space
+, double L
 )%7B%0A%09%09thi
@@ -699,22 +699,106 @@
 pace;%0A%09%09
+this.L = L;%0A        orientationX = space.makeOrientation();%0A        IVectorMutable 
 vector
+X
  = space
@@ -816,73 +816,237 @@
 ();%0A
-%09%7D%0A%0A%09public void initializePositions(IAtomList atomList) %7B%0A%09%09%09%0A%09%09
+        vectorX.setX(0, 1);%0A        orientationX.setDirection(vectorX);%0A%09%7D%0A%0A    public void initializePositions(IAtomList atomList, IOrientation orientation) %7B%0A        IVector orientationDir = orientation.getDirection();%0A        
 IAto
@@ -1097,18 +1097,24 @@
 Atom1);%0A
-%09%09
+        
 n1.getPo
@@ -1127,42 +1127,56 @@
 ().E
-(new double%5B%5D %7B-L/2, 0, 0%7D);%0A%09%09%0A%09%09
+a1Tv1(-0.5*L, orientationDir);%0A        %0A        
 IAto
@@ -1227,18 +1227,24 @@
 Atom2);%0A
-%09%09
+        
 n2.getPo
@@ -1257,38 +1257,156 @@
 ().E
-(new double%5B%5D %7BL/2, 0, 0%7D);%0A%09%09
+a1Tv1(+0.5*L, orientationDir);%0A    %7D%0A%0A    public void initializePositions(IAtomList atomList) %7B%0A        initializePositions(atomList, orientationX);
 %0A%09%7D%0A
@@ -1450,23 +1450,16 @@
 otected 
-static 
 final do
@@ -1468,14 +1468,8 @@
 le L
- = 0.6
 ;%0A%09%0A
@@ -1480,36 +1480,40 @@
 tected I
-VectorMutable vector
+Orientation orientationX
 ;%0A%09%0A%09pri

allow length, orientation to be specified