def setUp(self): testExpA = [1e-5, 2.0, 3.0 , 1e-6, 3.0] testCoeffR0_A = [2.0 , 3.0, 0.1 , 5.0, 1e-5] testCoeffR1_A = [1.0 , 6.0, 0.2 , 4.0, 2.0] testCoeffR2_A = [0.0 , 2.0, 1e-6, 2.0, 3.0] self.testStructA = tCode.GauPolyBasis( testExpA, [testCoeffR0_A, testCoeffR1_A, testCoeffR2_A] ) self.expOutputStructA = tCode.GauPolyBasis( [2.0], [ [3.0], [6.0], [2.0] ] )
def createTestObjs(self): angMomTemp = 0 self.gauObjA = parseGau.GauPolyBasis( self.exponentsA, [self.coeffsA] ) self.gauObjB = parseGau.GauPolyBasis( self.exponentsB, [self.coeffsB] ) self.cp2kExpSetA = tCode.getCP2KExponentSetFromGauPolyBasis(self.gauObjA, angMomTemp) self.cp2kExpSetB = tCode.getCP2KExponentSetFromGauPolyBasis(self.gauObjB, angMomTemp) expSetListA = [self.cp2kExpSetA, self.cp2kExpSetB] self.cp2kBasisSetA = tCode.BasisSetCP2K(self.eleName, self.basisNames, expSetListA)
def testExpectedForTestInput(self): testCoeffsA = [3, 4] expGauPolyBas = parseGau.GauPolyBasis(self.exponentsA, [testCoeffsA], label=self.angMomA) expOutput = self.fixedOrbExpansions + [expGauPolyBas] actOutput = self.testObjA(testCoeffsA) self.assertEqual(expOutput, actOutput)
def testParseNlPP(self): expNlPP = list() expExponentsA = [1.4174540372986133008] expCoeffsA = [ [-0.2826563852303170532], [-1.595515250025759002] ] expExponentsB = [1.4174540055315427711] expCoeffsB = [ [-2.4343440773146363121], [0.92424384058112241114] ] expExponentsC = [0.99985718149534019705] expCoeffsC = [[1.8374666607470948598]] expNlA = tCode.GauPolyBasis( expExponentsA, expCoeffsA ) expNlB = tCode.GauPolyBasis ( expExponentsB, expCoeffsB ) expNlC = tCode.GauPolyBasis ( expExponentsC, expCoeffsC ) expNlAll = [expNlA, expNlB, expNlC] actNlAll = tCode.parseGauFile(self.filePathGauR1_A)["nlpp"] for exp,act in itertools.zip_longest( expNlAll, actNlAll ): self.assertTrue( exp==act )
def testR1FitParams_DenAndNeutAtom(self): expDenExp = (0.25977874512795540163, 1.189557405762461384) expDenCoeffs_R0 = (0.02679475556046136131, -0.026859074525597253363) expDenCoeffs_R1 = (0.0046827657367609657954, -0.027478265238950479177) expNeutAtomExp = (0.34263537115218700713, 1.3551837469820726678) expNeutAtomCoeffs_R0 = (-2.0638099246154166799, -7.4099430193128172917) expNeutAtomCoeffs_R1 = (0.029208685956966910086, 0.20618555433380203468) expDenObj = tCode.GauPolyBasis( expDenExp, [expDenCoeffs_R0, expDenCoeffs_R1] ) expNaObj = tCode.GauPolyBasis( expNeutAtomExp, [expNeutAtomCoeffs_R0, expNeutAtomCoeffs_R1] ) parsedFile = tCode.parseGauFile(self.filePathGauR1_A) actualDensity = parsedFile["density"] actualNeutAtom = parsedFile["neutAtom".lower()] self.assertTrue( actualDensity==expDenObj ) self.assertTrue( actualNeutAtom==expNaObj )
def testForDensityR1Powers(self): expResults = [0.0011548514, 0.0077382712, 0.0147058341] testDistances = [0.5,1.0,1.5] testExponents = [0.259778745127955,1.18955740576246] testCoeffsR0 = [0.0267947555604614, -0.0268590745255972] testCoeffsR1 = [0.00468276573676097, -0.0274782652389505] polyBas = tCode.GauPolyBasis(testExponents,[testCoeffsR0,testCoeffsR1]) createdFunct = polyBas.toGaussFunct() actResults = [createdFunct(x) for x in testDistances] print("actResults = {}".format(actResults)) print("expResults = {}".format(expResults)) for exp,act in itertools.zip_longest(expResults, actResults): self.assertAlmostEqual(exp, act)
def testExpectedForTestInputA(self): testCoeffsA = [3, 4] expGauPolyBas = parseGau.GauPolyBasis(self.exponentsA, [testCoeffsA], label=self.angMomA) actGauPolyBas = self.testObjA(testCoeffsA) self.assertEqual(expGauPolyBas, actGauPolyBas)
def createTestObjs(self): self.testObjA = parseGau.GauPolyBasis( self.exponentsA, [self.coeffsA] ) self.testObjB = parseGau.GauPolyBasis( self.exponentsA, [self.coeffsB] ) self.testObjC = parseGau.GauPolyBasis( self.exponentsB, [self.coeffsA] ) self.testOrbsSetA = [self.testObjA, self.testObjB] self.testOrbsSetB = [self.testObjA, self.testObjB, self.testObjC]
def createTestObjs(self): self.testBasisTwoPoly = parseGau.GauPolyBasis([1], [[1],[2]]) self.testBasisA = parseGau.GauPolyBasis( self.expA, [self.coeffA] )
def __call__(self, coeffs): mapper = FitCoeffsToBasisFunctionExponentsAndCoeffsMixedOptStandard(self.fixedCoeffs, self.fixedExponents) exponents, outCoeffs = mapper(coeffs) outFunct = parseGau.GauPolyBasis(exponents, [outCoeffs], label=self.angMom) return outFunct
def __call__(self, coeffs): newBasisFunct = parseGau.GauPolyBasis(self.exponents, [coeffs], label=self.angMom) outObj = self.fixedOrbExpansion + [newBasisFunct] return outObj
def __call__(self, coeffs): return parseGau.GauPolyBasis(self.exponents, [coeffs], label=self.angMom)
def createTestObjs(self): self.basisObjA = parseGau.GauPolyBasis(self.exponentsA, self.coeffsA) self.testObjA = tCode.BasisFunctSelfOverlapAtDistWorkflow( self.basisObjA, self.angMom, self.distA)