def testExpected_diffIndicesEach(self): """ This tests the populators a bit better; since they have to actually deal with partially-populated matrices""" #Create options objects rollOxyIndices, rollHyIndices = [0,3], [ [1,2], [4,5] ] pitchOxyIndices, pitchHyIndices = [3,6,9], [ [4,5], [7,8], [10,11] ] currArgs = [self.binResObj, rollOxyIndices, rollHyIndices] currKwargs = {"checkEdges":False} optsObjRoll = distrOptObjHelp.WaterOrientationOptions(*currArgs, **currKwargs, angleType="roll") currArgs = [self.binResObj, pitchOxyIndices, pitchHyIndices] optsObjPitch = distrOptObjHelp.WaterOrientationOptions(*currArgs, **currKwargs, angleType="pitch") #Create sparse calculator + populate sparseCalculator = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([optsObjRoll, optsObjPitch]) sparseCalculator.calcMatricesForGeom(self.cellA) #Create bin val getter testObjRoll = atomComboObjsMapHelp.getOneDimBinValGetterFromOptsObj(optsObjRoll) testObjPitch = atomComboObjsMapHelp.getOneDimBinValGetterFromOptsObj(optsObjPitch) #Figure out expected values expValsRoll = [ 0, 0] expValsPitch = [ 0, 0, 79.98644481907608 ] #run funct + compare expected and actual values actValsRoll = testObjRoll.getValsToBin( sparseCalculator ) actValsPitch = testObjPitch.getValsToBin( sparseCalculator ) [self.assertAlmostEqual(exp,act) for exp,act in it.zip_longest(expValsRoll, actValsRoll)] [self.assertAlmostEqual(exp,act) for exp,act in it.zip_longest(expValsPitch, actValsPitch)]
def createTestObjs(self): #Create the geometry self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Create an options object self.optsObj = self.initOptsClass(self.binResObj, self.diatomicIndices) #Get a sparse matrix populator + populate it self.sparseCalculator = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.optsObj]) self.sparseCalculator.calcMatricesForGeom(self.cellA) #Create the test object self.testObj = atomComboObjsMapHelp.getMultiDimBinValGetterFromOptsObjs([self.optsObj])
def createTestObjs(self): #Geom self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Create opts object currArgs = [self.binResObj, self.indicesFrom, self.indicesTo] self.optsObj = distrOptObjHelp.CalcHozDistOptions(*currArgs, minDistAToB=self.minDistAToB, minDistVal=self.minDistVal) #Get matrix calculator + populate self.sparseMatrixObj = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.optsObj]) self.sparseMatrixObj.calcMatricesForGeom(self.cellA) #get binval getter self.testObj = atomComboObjsMapHelp.getMultiDimBinValGetterFromOptsObjs([self.optsObj])
def createTestObjs(self): #Geom self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Create opts object tempBinResObj = None self.optsObj = distrOptObjHelp.CountNWithinDistOptions(tempBinResObj, self.distOpts, self.distRanges) #Get matrix calculator + populate self.sparseMatrixObj = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.optsObj]) self.sparseMatrixObj.calcMatricesForGeom(self.cellA) #get binval getter self.testObj = atomComboObjsMapHelp.getMultiDimBinValGetterFromOptsObjs([self.optsObj])
def createTestObjs(self): #Create the geometry self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams,lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Options object currArgs = [self.binResObj, self.fromOxyIndices, self.fromHyIndices, self.toOxyIndices, self.toHyIndices] currKwargs = {"acceptor":self.acceptor,"donor":self.donor, "maxOO":self.maxOO, "maxAngle":35} self.optsObj = distrOptObjHelp.CountHBondsBetweenWaterGroupsOptions(*currArgs, **currKwargs) #Get a sparse matrix populator + populate it self.sparseCalculator = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.optsObj]) self.sparseCalculator.calcMatricesForGeom(self.cellA) #Create the test object self.testObj = atomComboObjsMapHelp.getMultiDimBinValGetterFromOptsObjs([self.optsObj])
def createTestObjs(self): #Geom self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Create an options object currArgs = [self.binResObj, self.oxyIndices, self.hyIndices, self.toIndices] currKwargs = {"primaryIdxType":"O", "minDistType":self.minDistType} self.optsObj = distrOptObjHelp.WaterMinDistOptions(*currArgs, **currKwargs) #Sparse matrix calculator + populate it () self.sparseCalculator = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.optsObj]) self.sparseCalculator.calcMatricesForGeom(self.cellA) #Create the test object self.testObj = atomComboObjsMapHelp.getOneDimBinValGetterFromOptsObj(self.optsObj)
def createTestObjs(self): #Geom self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Options objects currArgs = [self.rdfBinObj, self.indicesA, self.indicesB] self.rdfOptObj = distrOptObjHelp.CalcRdfOptions(*currArgs, minDistAToB=self.minDistAToB, filterBasedOnBins=self.rdfFilterBasedOnBins) self.planarOptObj = calcRadImpl.CalcPlanarRdfOptions(self.dudBinResObj, self.indicesA, planeEqn=self.planeEqn) #Create sparse matrix populator and populate it self.sparseMatrixObj = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.rdfOptObj, self.planarOptObj]) self.sparseMatrixObj.calcMatricesForGeom(self.cellA) #Create the binner object self.testObj = atomComboObjsMapHelp.getMultiDimBinValGetterFromOptsObjs([self.rdfOptObj,self.planarOptObj])
def createTestObjs(self): #Create the geometry self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Create an options object currArgs = [self.binResObj,self.diatomicIndices, self.inpVector] currKwargs = {"leftToRight":self.leftToRight} self.optsObj = distrOptObjHelp.GetAngleWithGenericVectorForDiatomOpts(*currArgs, **currKwargs) #Get a sparse matrix populator + populate it self.sparseCalculator = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.optsObj]) self.sparseCalculator.calcMatricesForGeom(self.cellA) #Create the test object self.testObj = atomComboObjsMapHelp.getMultiDimBinValGetterFromOptsObjs([self.optsObj])
def createTestObjs(self): #Sort out geometry self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.cartCoords #Sort out options objects currArgs = [self.binResObj, self.oxyIndices, self.hyIndices] currKwargs = {"checkEdges":False} self.optsObjRoll = distrOptObjHelp.WaterOrientationOptions(*currArgs, **currKwargs, angleType="roll") self.optsObjPitch = distrOptObjHelp.WaterOrientationOptions(*currArgs, **currKwargs, angleType="pitch") self.optsObjAzi = distrOptObjHelp.WaterOrientationOptions(*currArgs, **currKwargs, angleType="azimuth") #Get the sparse matrix calculator and populate it self.sparseCalculator = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.optsObjRoll, self.optsObjPitch, self.optsObjAzi]) self.sparseCalculator.calcMatricesForGeom(self.cellA) #Get the bin val getter object self.testObj = atomComboObjsMapHelp.getMultiDimBinValGetterFromOptsObjs([self.optsObjRoll, self.optsObjPitch, self.optsObjAzi])
def createTestObjs(self): #Create the geometry self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Create opts for both planar and min dists dudBinsObj = None self.planarOpts = calcRadImpl.CalcPlanarRdfOptions(dudBinsObj, self.planarIndices, planeEqn=self.planeEqn) self.optsObj = calcDistribCoreHelp.CalcRdfOptions(dudBinsObj, self.fromIndices, self.toIndices, minDistAToB=True) #Create sparse matrix object + populate arrays self.sparseMatrixObj = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter([self.planarOpts, self.optsObj]) self.sparseMatrixObj.calcMatricesForGeom(self.cellA) #Create the individual binner objects self.planarBinner = tCode._PlanarDistsGetOneDimValsToBin(self.planeEqn, self.planarIndices) self.minDistBinner = tCode._MinDistsGetOneDimValsToBin(self.fromIndices, self.toIndices) #Create the binner object self.testObj = atomComboCoreHelp._GetMultiDimValsToBinFromSparseMatrices([self.planarBinner, self.minDistBinner])
def testExpectedWithDonorAndAcceptorCounter(self): #Remake the objects currArgs = [self.binResObj, self.fromOxyIndices, self.fromHyIndices, self.toOxyIndices, self.toHyIndices] currKwargs = {"acceptor":False, "donor":True, "maxOO":self.maxOO, "maxAngle":35} self.donorOptsObj = distrOptObjHelp.CountHBondsBetweenWaterGroupsOptions(*currArgs, **currKwargs) currKwargs = {"acceptor":True, "donor":False, "maxOO":self.maxOO, "maxAngle":35} self.acceptorOptsObj = distrOptObjHelp.CountHBondsBetweenWaterGroupsOptions(*currArgs, **currKwargs) optsObjs = [self.acceptorOptsObj,self.donorOptsObj] #Get a sparse matrix populator + populate it self.sparseCalculator = atomComboObjsMapHelp.getSparseMatrixCalculatorFromOptsObjIter(optsObjs) self.sparseCalculator.calcMatricesForGeom(self.cellA) #Create the test object self.testObj = atomComboObjsMapHelp.getMultiDimBinValGetterFromOptsObjs(optsObjs) #Figure out expected + test expVals = [ (0,0), (0,2) ] actVals = self._runTestFunct() for expIter,actIter in it.zip_longest(expVals,actVals): [self.assertAlmostEqual(exp,act) for exp,act in it.zip_longest(expIter,actIter)]