def testWriteFormat4File(self): outputPath = self.bdtFile #Needs to be the same or parsed atom identities are wrong expectedVals = tData.loadTestBdtFileAExpectedVals_format4() tCode.writeBdtFileFormat4(expectedVals, outputPath) actualVals = tCode.parseBdtForm4(outputPath) for key in expectedVals: self.assertTrue(actualVals[key] == expectedVals[key])
def setUp(self): self.expData = tData.loadTestBdtFileAExpectedVals_format4() self.dirPath = os.path.abspath( os.path.join(os.getcwd(), "fake_model_folder")) createFakeModelFolderEnvironment(self.dirPath) self.createdIntegHolder = tCode.createIntegHolderFromModelFolderPath( self.dirPath)
def setUp(self): self.integDict = { k.lower(): v for k, v in tData.loadTestBdtFileAExpectedVals_format4().items() } self.expectedIntegalsSubtraction = copy.deepcopy( self.integDict["pairpot"][0]) self.expectedIntegalsSubtraction.integrals[:, 1] = [ 2.00000000, -0.00500000, -0.00000066 ]
def setUp(self): self.atomPairNames = [("Mg", "Mg")] self.integDicts = [{ k.lower(): v for k, v in tData.loadTestBdtFileAExpectedVals_format4().items() }] self.testObjA = tCode.IntegralsHolder(self.atomPairNames, self.integDicts) self.expGetPairPot = copy.deepcopy(self.integDicts[0]["pairpot"][0]) self.expGetPairPot.integrals[:, 1] = [ 6.224678330, -0.010034643, -0.000000300 ] self.expGetHopPpPi = copy.deepcopy(self.integDicts[0]["hopping"][-1]) hopCorrVals = [-0.02, -0.023, -0.000045] for idx in range(len(self.expGetHopPpPi.integrals)): self.expGetHopPpPi.integrals[idx, 1] += hopCorrVals[idx]
def setUp(self): self.atomPairNames = [("Xa", "Xb")] self.integDicts = [{ k.lower(): v for k, v in tData.loadTestBdtFileAExpectedVals_format4().items() }] self.integDicts[0]["PairPotCorrection0".lower( )][0].integrals[:, 1] = 0 #no PP Correction, means it will equal any change i make in total PP #Write integrals to file self.outFileA = "Xa_Xb.bdt" #Needs to match the atomPairNames parseTbint.writeBdtFileFormat4(self.integDicts[0], self.outFileA) integHolder = tCode.IntegralsHolder(self.atomPairNames, copy.deepcopy(self.integDicts)) integInfo = createIntegTableInfoXaXbPairPot(os.getcwd()) mockedAnalyticalRepr = mock.Mock() mockedAnalyticalRepr.evalAtListOfXVals = lambda x: [0 for a in x] self.testObj = tCode.CoeffsTablesConverter([mockedAnalyticalRepr], [integInfo], integHolder)
def testParseBdtForm4_usingInterfaceFunct(self): expectedVals = tData.loadTestBdtFileAExpectedVals_format4() actualVals = tCode.getIntegralsFromBdt(self.bdtFile) for key in expectedVals: self.assertTrue(actualVals[key] == expectedVals[key])
def createFakeModelFolderEnvironment(workFolder): pathlib.Path(workFolder).mkdir(exist_ok=True, parents=False) allData = tData.loadTestBdtFileAExpectedVals_format4() outFilePath = os.path.join(workFolder, "Xa_Xb.bdt") parseTbint.writeBdtFileFormat4(allData, outFilePath)