def createTestObjs(self): #Geom/Trajectory self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellB = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords, self.cellB.cartCoords = self.coordsA, self.coordsB trajStepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA, step=0, time=self.timeA) trajStepB = trajCoreHelp.TrajStepFlexible(unitCell=self.cellB, step=1, time=self.timeB) self.traj = trajCoreHelp.TrajectoryInMemory([trajStepA, trajStepB]) #Create the classification object options currArgs = [[self.binResObjA], self.oxyIndices, self.hyIndices] currKwargs = {"maxOHDist": self.maxOOHBond, "nNebs": self.nNebs} hydroxylClassifier = classDistrOptObjs.WaterDerivativeBasedOnDistanceClassifierOptsObj( *currArgs, **currKwargs) # currArgs = [ self.oxyIndices, self.hyIndices, hydroxylClassifier, self.distrOptObjs, self.useGroups ] currKwargs = { "useNonHyIdx": self.useNonHyIdx, "useIdxEach": self.useIdxEach } self.filteredOptObj = filteredOptObjHelp.WaterDerivativeFilteredOptsObj_simple( *currArgs, **currKwargs)
def createTestObjs(self): self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellB = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coordsA self.cellB.cartCoords = self.coordsB extraAttrDictA = { self.velKey: { "value": self.velsA, "cmpType": "numericalArray" } } extraAttrDictB = { self.velKey: { "value": self.velsB, "cmpType": "numericalArray" } } self.trajStepA = trajHelp.TrajStepFlexible( unitCell=self.cellA, extraAttrDict=extraAttrDictA) self.trajStepB = trajHelp.TrajStepFlexible( unitCell=self.cellB, extraAttrDict=extraAttrDictB) self.inpTrajA = trajHelp.TrajectoryInMemory( [self.trajStepA, self.trajStepB])
def createTestObjs(self): #Geom/Trajectory self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellB = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords, self.cellB.cartCoords = self.coordsA, self.coordsB trajStepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA, step=0, time=10) trajStepB = trajCoreHelp.TrajStepFlexible(unitCell=self.cellB, step=1, time=20) self.traj = trajCoreHelp.TrajectoryInMemory([trajStepA, trajStepB]) #Option object currArgs = [ self.binResObjA, self.oxyIndices, self.hyIndices, self.distFilterIndices, [self.distRangeA, self.distRangeB, self.distRangeC] ] self.optObj = classDistrOptObjs.WaterCountTypesMinDistAndHBondSimpleOpts( *currArgs)
def createTestFunct(self): self.stepA = trajHelp.TrajStepFlexible(step=self.steps[0], time=self.times[0]) self.stepB = trajHelp.TrajStepFlexible(step=self.steps[1], time=self.times[1]) self.stepC = trajHelp.TrajStepFlexible(step=self.steps[2], time=self.times[2]) self.stepD = trajHelp.TrajStepFlexible(step=self.steps[3], time=self.times[3]) self.allSteps = [self.stepA, self.stepB, self.stepC, self.stepD] self.inpTraj = trajHelp.TrajectoryInMemory(self.allSteps)
def createTestObjs(self): #Define some rotated water molecules #setting up water with an angle of 90 degrees and sqrt(2) bondlengths makes this simpler waterAzi90_pitch20 = [[0, 0, 0, "O"], [-1, 0.94, 0.34, "H"], [1, 0.94, 0.34, "H"]] #bin [1][1] waterAzi0_pitch20 = [[0, 0, 0, "O"], [0.94, 1.0, 0.34, "H"], [0.94, -1, 0.34, "H"]] #bin [0][1] waterAzi0_pitchm20 = [[0, 0, 0, "O"], [0.94, 1.0, -0.34, "H"], [0.94, -1, -0.34, "H"]] #bin [0][0] #Sort the trajectory; default is to use a one step trajectory self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = waterAzi90_pitch20 + waterAzi0_pitch20 + waterAzi0_pitchm20 + waterAzi0_pitchm20 self.stepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA) self.trajA = trajCoreHelp.TrajectoryInMemory([self.stepA]) #Create the options objects self.aziBins = binResHelp.BinnedResultsStandard.fromBinEdges( self.aziEdges) self.pitchBins = binResHelp.BinnedResultsStandard.fromBinEdges( self.pitchEdges) self.aziOpts = waterRotHelp.CalcStandardWaterOrientationDistribOptions( self.aziBins, self.waterIndicesAll, angleType="azimuth") self.pitchOpts = waterRotHelp.CalcStandardWaterOrientationDistribOptions( self.pitchBins, self.waterIndicesAll, angleType="pitch")
def createTestObjs(self): self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.cartCoords self.trajStepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA) #Create the bin objs self.binObjA = binResHelp.BinnedResultsStandard.fromBinEdges( self.binEdgesA) self.binObjB = binResHelp.BinnedResultsStandard.fromBinEdges( self.binEdgesB) #Create single binners self.binnerA = tCode._WaterRotationAngleBinnerFixedIndices( resBins=self.binObjA, indices=self.indicesA, angleIdx=self.angleIdxA) self.binnerB = tCode._WaterRotationAngleBinnerFixedIndices( resBins=self.binObjB, indices=self.indicesB, angleIdx=self.angleIdxB) #Create the multi binner (the test obj) self.testObj = tCode._WaterRotationAngleMultiBinnerFixedIndices( [self.binnerA, self.binnerB])
def createTestObjs(self): #Create co-ordinates self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.coords #Create a simple one-step trajectory self.stepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA) self.trajA = trajCoreHelp.TrajectoryInMemory([self.stepA]) #Create bins then options objects self.distBinsA = binResHelp.BinnedResultsStandard.fromBinEdges(self.distBinEdgesA) self.planarBinsA = binResHelp.BinnedResultsStandard.fromBinEdges(self.planarBinEdgesA) self.distBinsB = binResHelp.BinnedResultsStandard.fromBinEdges(self.distBinEdgesB) self.planarBinsB = binResHelp.BinnedResultsStandard.fromBinEdges(self.planarBinEdgesB) #binResObj, indicesA, indicesB, volume=None, minDistAToB=False): self.minDistsOptsA = calcDistribCoreHelp.CalcRdfOptions(self.distBinsA, self.indicesA_optsA, self.indicesB_optsA, minDistAToB=True) self.minDistsOptsB = calcDistribCoreHelp.CalcRdfOptions(self.distBinsB, self.indicesA_optsB, self.indicesB_optsB, minDistAToB=True) #binResObj, indices, planeEqn=None, volume=None): self.planarDistOptsA = calcRadImpl.CalcPlanarRdfOptions(self.planarBinsA, self.indicesA_optsA) self.planarDistOptsB = calcRadImpl.CalcPlanarRdfOptions(self.planarBinsB, self.indicesA_optsB) self.optsObjs = [ [self.minDistsOptsA, self.planarDistOptsA], [self.minDistsOptsB, self.planarDistOptsB] ]
def createTestObjs(self): #Define some rotated water molecules #setting up water with an angle of 90 degrees and sqrt(2) bondlengths makes this simpler waterAzi90_pitch20 = [ [0, 0, 0 + 7, "O"], [-1, 0.94, 0.34 + 7, "H"], [1, 0.94, 0.34 + 7, "H"] ] #Translated by +7 for planar dists stuff [means dist=3] waterAzi0_pitch20 = [[0, 0, 0 + 1, "O"], [0.94, 1.0, 0.34 + 1, "H"], [0.94, -1, 0.34 + 1, "H"]] waterAzi0_pitchm20 = [[0, 0, 0, "O"], [0.94, 1.0, -0.34, "H"], [0.94, -1, -0.34, "H"]] #Sort the trajectory; default is to use a one step trajectory self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = waterAzi90_pitch20 + waterAzi0_pitch20 + waterAzi0_pitchm20 + waterAzi0_pitchm20 self.stepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA) self.trajA = trajCoreHelp.TrajectoryInMemory([self.stepA]) #Create the options objects self.aziBinsA = binResHelp.BinnedResultsStandard.fromBinEdges( self.aziEdgesA) self.pitchBinsA = binResHelp.BinnedResultsStandard.fromBinEdges( self.pitchEdgesA) self.planarBinsA = binResHelp.BinnedResultsStandard.fromBinEdges( self.planarEdgesA) self.oxyDistBinsA = binResHelp.BinnedResultsStandard.fromBinEdges( self.oxyDistEdgesA) self.aziBinsB = binResHelp.BinnedResultsStandard.fromBinEdges( self.aziEdgesB) self.pitchBinsB = binResHelp.BinnedResultsStandard.fromBinEdges( self.pitchEdgesB) self.planarBinsB = binResHelp.BinnedResultsStandard.fromBinEdges( self.planarEdgesB) self.oxyDistBinsB = binResHelp.BinnedResultsStandard.fromBinEdges( self.oxyDistEdgesB) #Create options objs self.aziOptsA = waterRotHelp.CalcStandardWaterOrientationDistribOptions( self.aziBinsA, self.waterIndicesA, angleType="azimuth") self.pitchOptsA = waterRotHelp.CalcStandardWaterOrientationDistribOptions( self.pitchBinsA, self.waterIndicesA, angleType="pitch") self.planarOptsA = tCode.CalcWaterPlanarDistribOptions_fromOxy( self.planarBinsA, self.waterIndicesA) self.oxyDistOptsA = tCode.CalcWaterOxyMinimumDistOptions( self.oxyDistBinsA, self.waterIndicesA, self.oxyDistIndices) self.aziOptsB = waterRotHelp.CalcStandardWaterOrientationDistribOptions( self.aziBinsB, self.waterIndicesB, angleType="azimuth") self.pitchOptsB = waterRotHelp.CalcStandardWaterOrientationDistribOptions( self.pitchBinsB, self.waterIndicesB, angleType="pitch") self.planarOptsB = tCode.CalcWaterPlanarDistribOptions_fromOxy( self.planarBinsB, self.waterIndicesB) self.oxyDistOptsB = tCode.CalcWaterOxyMinimumDistOptions( self.oxyDistBinsB, self.waterIndicesB, self.oxyDistIndices) self.optsObjs = [[self.aziOptsA, self.pitchOptsA], [self.aziOptsB, self.pitchOptsB]]
def _getTrajFromStepIndices(self, stepIndices): outSteps = list() for idx in stepIndices: currStepIdx, currTime = self.steps[idx], self.times[idx] currTrajStep = trajHelp.TrajStepFlexible(step=currStepIdx, time=currTime) outSteps.append(currTrajStep) return trajHelp.TrajectoryInMemory(outSteps)
def createTestObjs(self): self.stepA = trajHelp.TrajStepFlexible(time=self.times[0], extraAttrDict={ self.atomTempKey: { "value": self.tempsA, "cmpType": "numericalArray" } }) self.stepB = trajHelp.TrajStepFlexible(time=self.times[1], extraAttrDict={ self.atomTempKey: { "value": self.tempsB, "cmpType": "numericalArray" } }) self.trajA = trajHelp.TrajectoryInMemory([self.stepA, self.stepB])
def createTestObjs(self): self.cellA = uCellHelp.UnitCell(lattParams=self.lattParamsA, lattAngles=self.lattAnglesA) self.cellA.cartCoords = self.cartCoordsA trajStepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA) self.trajA = trajCoreHelp.TrajectoryInMemory([trajStepA]) self.binResObjA = binResHelp.BinnedResultsStandard.fromBinEdges( self.binEdges)
def parseFullMdInfoFromCpoutAndXyzFilePaths(cpoutPath, xyzPath, tempKindPath=None, velocityPath=None, forcePath=None): """ Description of function Args: cpoutPath: (str) Path to *.cpout file xyzPath: (str) Path to *.xyz file tempKindPath: (str, optional) Path to a file containing atomic temperature for each kind of atom """ outDict = parseCpoutForMDJob(cpoutPath) outSteps = parseCp2kMdXyzFile(xyzPath) #If step 0 is in the xyz then we need to add the initial trajectory/thermal info to outDict if outSteps[0]["step"] == 0: # stepZero = trajHelp.TrajStepBase(unitCell=outDict["init_md_cell"], step=0, time=0) stepZero = trajHelp.TrajStepFlexible(unitCell=outDict["init_md_cell"], step=0, time=0) outDict["trajectory"].trajSteps.insert(0, stepZero) for key in outDict["thermo_data"].dataDict: outDict["thermo_data"].dataDict[key].insert( 0, outDict["init_thermo_dict"][key]) #Combine infor in cpout and xyz files to get full geometries outDict["trajectory"] = _getMergedTrajectoryFromParsedCpoutAndXyz( outDict, outSteps) #Optionally add velocities and forces if velocityPath is not None: _parseVelocitiesAndAddToTrajSteps(velocityPath, outDict["trajectory"].trajSteps) if forcePath is not None: _parseForcesXyzAndAddToTrajSteps(forcePath, outDict["trajectory"].trajSteps) #If tempKindPath is present, then parse it and add to the thermo data object if tempKindPath is not None: parsedTempKind = parseAtomTempFile(tempKindPath) firstGeom = [x for unused, x in zip([0], iter(outDict["trajectory"])) ][0].unitCell idxToLabelDict = _getKindIdxToSymbolDict( [x[-1] for x in firstGeom.cartCoords]) _addAtomicTempsToThermoDataObj(parsedTempKind, outDict["thermo_data"], idxToLabelDict=idxToLabelDict) assert outDict["thermo_data"].dataListLengthsAllEqual outDict.pop("init_thermo_dict") outDict.pop("init_md_cell") return outDict
def createTestObjs(self): self.extraAttrDict = copy.deepcopy(self.extraAttrA) self.extraAttrDict.update(copy.deepcopy(self.extraAttrB)) currKwargs = { "unitCell": self.unitCell, "step": self.step, "time": self.time, "extraAttrDict": self.extraAttrDict } self.testObjA = tCode.TrajStepFlexible(**currKwargs)
def createTestObjs(self): #Create the cells cells = [ uCellHelp.UnitCell(lattParams=[x for x in self.lattParams], lattAngles=[x for x in self.lattAngles]) for a in range(3) ] for idx, coords in enumerate( [self.coordsA, self.coordsB, self.coordsC]): cells[idx].cartCoords = coords #Create the trajectory self.stepA = trajHelp.TrajStepFlexible(unitCell=cells[0], step=0, time=self.times[0]) self.stepB = trajHelp.TrajStepFlexible(unitCell=cells[1], step=1, time=self.times[1]) self.stepC = trajHelp.TrajStepFlexible(unitCell=cells[2], step=2, time=self.times[2]) self.inpTraj = trajHelp.TrajectoryInMemory( [self.stepA, self.stepB, self.stepC])
def createTestObjs(self): #Create the trajectory self.cellA = uCellHelp.UnitCell(lattParams=self.lattParams, lattAngles=self.lattAngles) self.cellA.cartCoords = self.cartCoords self.trajStepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA) self.traj = trajCoreHelp.TrajectoryInMemory([self.trajStepA]) #Create two options objs self.binsA = binResHelp.BinnedResultsStandard.fromBinEdges( self.binEdgesA) self.binsB = binResHelp.BinnedResultsStandard.fromBinEdges( self.binEdgesB) self.optsA = tCode.CalcStandardWaterOrientationDistribOptions( self.binsA, self.indicesA, angleType=self.angleTypeA) self.optsB = tCode.CalcStandardWaterOrientationDistribOptions( self.binsB, self.indicesB, angleType=self.angleTypeB)
def createTestObjs(self): self.cellA = uCellHelp.UnitCell(lattParams=self.lattParamsA, lattAngles=self.lattAnglesA) self.cellA.cartCoords = self.cartCoordsA self.trajStepA = trajCoreHelp.TrajStepFlexible(unitCell=self.cellA) #Sort the bins self.binsA = binResHelp.BinnedResultsStandard.fromBinEdges( self.binEdgesA) self.binsB = binResHelp.BinnedResultsStandard.fromBinEdges( self.binEdgesB) #Sort the single binners self.binnerA = tCode._PlanarRdfBinnerFixedIndices( resBins=self.binsA, indices=self.indicesA, planeEqn=self.planeEqnA) self.binnerB = tCode._PlanarRdfBinnerFixedIndices( resBins=self.binsB, indices=self.indicesB, planeEqn=self.planeEqnB) #Create the test object self.testObj = tCode._PlanarRdfMultiBinnerFixedIndices( [self.binnerA, self.binnerB])
def _mdStepsFinalStepFunct(parserInstance): outThermoDict = parserInstance.outDict["thermo_arrays"] parserInstance.outDict["thermo_data"] = thermoDataHelp.ThermoDataStandard( outThermoDict) trajSteps = list() thermoInfo = parserInstance.outDict["thermo_arrays"] assert len(thermoInfo["step"]) == len(parserInstance.outDict["traj_geoms"]) for idx, geom in enumerate(parserInstance.outDict["traj_geoms"]): # currStep = trajHelp.TrajStepBase(unitCell=geom, step=thermoInfo["step"][idx], time=thermoInfo["time"][idx]) currStep = trajHelp.TrajStepFlexible(unitCell=geom, step=thermoInfo["step"][idx], time=thermoInfo["time"][idx]) trajSteps.append(currStep) parserInstance.outDict["trajectory"] = trajHelp.TrajectoryInMemory( trajSteps) parserInstance.outDict.pop("thermo_arrays") parserInstance.outDict.pop("traj_geoms")
def _loadStartTrajStepsArrayDataTwoStepsA(): stepA = trajHelp.TrajStepFlexible(step=1684, time=842.0) stepB = trajHelp.TrajStepFlexible(step=1687, time=843.5) return stepA, stepB