Skip to content

Commit

Permalink
switch
Browse files Browse the repository at this point in the history
  • Loading branch information
mark waller committed Aug 12, 2016
1 parent df39679 commit 196bd42
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ public class JaxbFileReader extends AbstractJaxbReader {
*/
public JAXBElement<Cml> read(String input, Object jaxbObject) {
this.input = new File(input);
System.out.println("input is" + input);
JAXBElement<Cml> marshalled = init(jaxbObject);
System.out.println("Marshalled" + marshalled);

return marshalled;
}

protected JAXBElement<Cml> unmarshal(Object jaxbObject) throws JAXBException{
System.out.println("input is " + input);
JAXBElement<Cml> marshalled = (JAXBElement<Cml>) jaxbUnmarshaller.unmarshal(input);
return marshalled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class JaxbFileReaderSpec extends Specification{
def "test method read()"(){
when:"jaxb reader reads a given file"
def reader= new JaxbFileReader()
JAXBElement<Cml> msr= reader.read("./src/test/resources/lih.xml",new Cml())
JAXBElement mlJAXB =((((JAXBElement)msr.getValue().getAnyCmlOrAnyOrAny().get(0))))
MoleculeList ml= mlJAXB.getValue()
JAXBElement<Cml> msr= reader.read("./src/test/resources/1D.xml",new Cml())
JAXBElement mlJAXB =((((JAXBElement)msr.getValue().getAnyCmlOrAnyOrAny().get(0))))
MoleculeList ml= mlJAXB.getValue()
then:"assert the content in the given file"
msr.getValue().getAnyCmlOrAnyOrAny().size()==2
ml.getAnyCmlOrAnyOrAny().size()==2
msr.getValue().getAnyCmlOrAnyOrAny().size()==2
ml.getAnyCmlOrAnyOrAny().size()==2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,14 @@ else if (job.getParameter(PARTITIONER).equals(SIZE)){
int qmNumberSize = Integer.parseInt( job.getParameter(NUMBER_QM).toString()) * 2 / 3;
double distance_s_qm_in = Double.parseDouble(job.getParameter(DISTANCE_S_QM_IN).toString());
double distance_t_qm_out = Double.parseDouble(job.getParameter(DISTANCE_T_QM_OUT).toString());

System.out.println("com" + centerOfMass);
System.out.println("com" + sortedMolecules.get(0).getAtoms());
System.out.println("distance is " + distanceCalculator.closest(centerOfMass,sortedMolecules.get(0)) );

//find first molecule that is outside of limit.
MolecularSystem.Molecule moleculeAtT_Qm_Out =
sortedMolecules.stream()
.filter(molecule ->
distanceCalculator.closest(centerOfMass, molecule) > distance_t_qm_out)
.findFirst()
.get();
System.out.println("qmNumberSize is " + qmNumberSize);
qmAdaptiveMolecules = new HashSet<>(sortedMolecules.subList(0, qmNumberSize));

System.out.println("index " + sortedMolecules.indexOf(moleculeAtT_Qm_Out));

bufferMolecules = new HashSet<>(sortedMolecules.subList(numberOfQm,
sortedMolecules.indexOf(moleculeAtT_Qm_Out) + 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,11 @@ class NumberPartitionerSpec extends Specification{
qmAdaptiveAndBuffer.get(BUFFER).size()==1
}

private MolecularSystem.Molecule createMolecule() {
def atom = Mock(MolecularSystem.Molecule.Atom)
def molecule = Mock(MolecularSystem.Molecule)
molecule.getAtoms() >> [atom]
molecule
}

}

0 comments on commit 196bd42

Please sign in to comment.