def testExpectedGeomConstriantsReturned(self): expAtomicConstraints = geomConstrHelp.AtomicPositionConstraints( atomicCartConstraints=self._getAllExpectedAtomicGeomConstraints()) expCellConstraints = geomConstrHelp.CellConstraints([True, True, True], [True, True, True]) expConstraintObj = geomConstrHelp.GeomConstraints( expAtomicConstraints, expCellConstraints) actConstraintObj = self.testObjA.getGeomConstraints(self.testCellA) self.assertEqual(expConstraintObj, actConstraintObj)
def testRaisesWhenOnlyLattParamsFixed(self): cellConstrs = geomConstr.CellConstraints.initWithNoConstraints() cellConstrs.lattParamsToFix = [True, True, True] atomicPosConstraints = geomConstr.AtomicPositionConstraints.initWithNoConstraints( ) self.testConstrObj = geomConstr.GeomConstraints( atomicPosConstraints, cellConstrs) with self.assertRaises(ValueError): self.runTestFunct()
def testRaisesWhenSomeLattParamsMixOfTrueAndFalse(self): cellConstrs = geomConstr.CellConstraints.initWithNoConstraints() cellConstrs.lattParamsToFix = [True, True, False] cellConstrs.anglesToFix = [True, True, True] atomicPosConstraints = geomConstr.AtomicPositionConstraints.initWithNoConstraints( ) self.testConstrObj = geomConstr.GeomConstraints( atomicPosConstraints, cellConstrs) with self.assertRaises(ValueError): self.runTestFunct()
def testFullCellConstraintsPresent(self): allCellConstraints = [True, True, True] cellConstraints = geomConstr.CellConstraints(allCellConstraints, allCellConstraints) atomicPosConstraints = geomConstr.AtomicPositionConstraints.initWithNoConstraints( ) self.testConstrObj = geomConstr.GeomConstraints( atomicPosConstraints, cellConstraints) expDict = {"runtype": "geo_opt"} actDict = self.runTestFunct() self.assertEqual(expDict, actDict)
def createTestObjs(self): self.cellConstrA = geomConstraints.CellConstraints( self.anglesToFix, self.lattParamsToFix) self.atomicPosConstraints = mock.Mock() self.testObjA = geomConstraints.GeomConstraints( self.atomicPosConstraints, self.cellConstrA)
def testTwoUnequalCompareUnequal_diffAtomicPositionConstraints(self): atPosConstrA, atPosConstrB = mock.Mock(), mock.Mock() objA = tCode.GeomConstraints(atPosConstrA, self.cellConstraints) objB = tCode.GeomConstraints(atPosConstrB, self.cellConstraints) self.assertNotEqual(objA,objB)
def testTwoUnequalCompareUnequal_diffCellConstraints(self): cellConstrA, cellConstrB = mock.Mock(), mock.Mock() objA = tCode.GeomConstraints(self.atomicPositionsConstraints, cellConstrA) objB = tCode.GeomConstraints(self.atomicPositionsConstraints, cellConstrB) self.assertNotEqual(objA,objB)
def createTestObjs(self): self.atomicPositionsConstraints.constraintsPresent = self.atomicPosConstraintsPresent self.cellConstraints.constraintsPresent = self.cellConstraintsPresent self.testObjA = tCode.GeomConstraints(self.atomicPositionsConstraints, self.cellConstraints)