コード例 #1
0
    def _createWorkFlowCoordinator(self):
        allObjs = list()
        for x in self.interObjs:
            cellDims = x.cellDims
            interStruct = x.getInterStructFromRefDataStruct(self.refData)
            refStruct = self._getRefGeom(x)  #Should be the same for all really
            refStruct = supCell.superCellFromUCell(refStruct, cellDims)
            startFolder = self.workFolder
            modOptDict = self.optDict
            platoComm = self.platoComm
            relaxed = x.relaxed
            interType = x.interstitType
            runCalcs = x.runCalcs
            currObj = createWFlows.CreateInterstitialWorkFlow(
                refStruct,
                interStruct,
                startFolder,
                modOptDict,
                platoComm,
                relaxed=relaxed,
                cellDims=cellDims,
                interType=interType,
                genPreShellComms=runCalcs,
                eType=self.eType)()
            allObjs.append(currObj)

        workFlowCoord = wFlowCoordinator.WorkFlowCoordinator(
            allObjs, nCores=self.nCores, quietPreShellComms=False)
        return workFlowCoord
コード例 #2
0
def createWorkFlowCoordinator(eleInfoStructs, methodStrs, eos, baseFolder,
                              nCores):
    allWorkFlows = list()
    for eleStr in eleInfoStructs.keys():
        currEleInfo = eleInfoStructs[eleStr]
        for methodStr in methodStrs:
            currWorkFlows = _createWorkFlowsFromElementInfoAndMethodStr(
                currEleInfo, methodStr, eos, baseFolder)
            allWorkFlows.extend(currWorkFlows)

    wFlowCoord = wFlowCoordinator.WorkFlowCoordinator(allWorkFlows,
                                                      nCores=nCores)
    wFlowCoord.quietPreShellComms = False
    return wFlowCoord
コード例 #3
0
def fitAnalyticFormToStartIntegrals(
    coeffTableConverter,
    intIdx=0,
    method=None,
    objFunct="rmsd",
    optKwargs=None,
):
    """ Fits the required analytical form directly to a set of tabulated integrals
	
	Args:
		coeffTableConverter: CoeffTableConverter object, this contains all functional forms as well as the current integral tables
		intIdx: The index of the integral table in coeffTableConverter, call a higher level function if you want ALL fitted
		objFunct(str): str denoting type of objective function to use. "rmsd"=root mean sqr dev, "absdev"=absolute deviations
		optKwargs(dict): Any keyword arguments you want to pass to carryOutOptimisationBasicOptions (at time of writing they go straight to scipy optimiser
	
	Returns
		Nothing. Works in place.

	"""

    if optKwargs is None:
        optKwargs = dict()

    #Optimisation Step - we dont need to write the output tables until the end
    origWriteFunct = copy.deepcopy(coeffTableConverter._writeTables)
    copiedTableConv = copy.deepcopy(coeffTableConverter)
    copiedTableConv._writeTables = lambda: None

    workFlow = _createWorkflowCompareTwoSetsTabulatedIntegrals(
        copiedTableConv, intIdx, objFunctStr=objFunct)
    workFlowCoordinator = wFlow.WorkFlowCoordinator([workFlow])

    objFunctCalcultor = _createObjFunctionCalculator()

    objectiveFunction = runOpts.ObjectiveFunction(copiedTableConv,
                                                  workFlowCoordinator,
                                                  objFunctCalcultor)
    fitRes = runOpts.carryOutOptimisationBasicOptions(objectiveFunction,
                                                      method=method,
                                                      **optKwargs)

    #Write the tables; this would usually be done automatically at each step as part of the update step
    coeffTableConverter.coeffs = copiedTableConv.coeffs
    coeffTableConverter.writeTables()

    return fitRes
コード例 #4
0
 def testCorrectOutputNamespaceTwoWorkFlows(self):
     expNamespace = SimpleNamespace(hcp_v0=1, fcc_v0=2, bcc_v0=3)
     testCoord = tCode.WorkFlowCoordinator([self.workFlowA, self.workFlowB])
     testCoord.run()
     actNamespace = testCoord.propertyValues
     self.assertEqual(expNamespace, actNamespace)
コード例 #5
0
 def testRaisesForDuplicatedFolderBetweenWorkflows_addition(self):
     testCoord = tCode.WorkFlowCoordinator([self.workFlowA])
     with self.assertRaises(ValueError):
         testCoord.addWorkFlow(self.workFlowA)
コード例 #6
0
 def testRaisesForDuplicatedPropertyBetweenWorkflowsInitiation(self):
     self.workFlowB.namespaceAttrs[0] = self.workFlowA.namespaceAttrs[0]
     workFlows = [self.workFlowA, self.workFlowB]
     with self.assertRaises(ValueError):
         tCode.WorkFlowCoordinator(workFlows)
コード例 #7
0
 def testRaisesForDuplicatedFolderBetweenWorkflows_Initiation(self):
     self.workFlowB.workFolder = self.workFlowA.workFolder
     workFlows = [self.workFlowA, self.workFlowB]
     with self.assertRaises(ValueError):
         tCode.WorkFlowCoordinator(workFlows)