break if replex_calls is None: raise RuntimeError("Could not parse the number of replex calls performed") if abs(replex_calls - p_swaps) > 1: raise RuntimeError("The number of actual swaps ("+str(replex_calls)+") is different to the number of requested swaps +("+str(p_swaps)+")") expectedCvs={10.0: 0.304967, 5.0: 2.52568, 2.0: 20.5657, 1.0: 23.1892} for i,T in enumerate(Temperatures): outputfile="o"+str(i)+".xml" xmldoc=ET.parse(outputfile) measured_T=float(xmldoc.getroot().find(".//Temperature").attrib["Mean"]) if not dynamo.isclose(measured_T, T, 4e-2): error_count = error_count + 1 print "Simulation Temperature is different to what is expected:"+str(measured_T)+"!="+str(T) simtime=float(xmldoc.getroot().find(".//Duration").attrib["Time"]) expected_simtime = swap_time * replex_calls * math.sqrt(min(Temperatures)/T) if not dynamo.isclose(simtime, expected_simtime, 1e-4): error_count = error_count + 1 print "Simulation duration is different to what is expected:"+str(simtime)+"!="+str(expected_simtime) measured_Cv=float(xmldoc.getroot().find(".//ResidualHeatCapacity").attrib["Value"]) expected_Cv=expectedCvs[T] if not dynamo.isclose(measured_Cv, expected_Cv, 0.1): error_count = error_count + 1 print "Simulation heat capacity is different to what is expected:"+str(measured_Cv)+"!="+str(expected_Cv)
subprocess.call(cmd) output = ET.parse('output.xml') datatag=output.find('./Misc/UConfigurational') datatag.attrib['Max'] def sphereVol(r): return 4 * r*r*r * 3.14159265 / 3.0 Z = sphereVol(0.5) * math.exp(0.75 / kT - W) Z += (sphereVol(1.0) - sphereVol(0.5)) * math.exp(0.5 / kT - W) print Z E = -0.75 * sphereVol(0.5) * math.exp(0.75 / kT - W) - 0.5 * (sphereVol(1.0) - sphereVol(0.5)) * math.exp(0.5 / kT - W) E /= Z if not dynamo.isclose(E, float(datatag.attrib['Mean']), 0.01): error_count +=1 if float(datatag.attrib['Min']) != -0.75: error_count +=1 if float(datatag.attrib['Max']) != -0.5: error_count +=1 print "Total errors:", error_count sys.exit(error_count > 0)