Example #1
0
  def test_ethanol_common(self):
    """
      Check function to calculate common neighbours
    """

    castep_file = open("%s.castep" % self.calc1_path).read()

    bonds = BondsResult.load(castep_file).next()

    self.assertTrue(('C',2) in bonds.common(('C',1),('O',1)))
    self.assertTrue(('O',1) in bonds.common(('H',6),('C',2)))
Example #2
0
  def test_ethanol_bond_result(self):
    """
      Check BondsResult is doing its job.
    """

    #c = cell.Cell(open("%s.cell" % self.calc1_path).read())
    castep_file = open("%s.castep" % self.calc1_path).read()

    bonds = BondsResult.load(castep_file).next()

    self.assertEqual(len(bonds.bonds), 8)
    self.assertEqual(len(bonds.index[('C',1)]), 4)
    self.assertEqual(len(bonds.index[('C',2)]), 4)
    self.assertEqual(len(bonds.index[('O',1)]), 2)
    self.assertEqual(len(bonds.index[('H',1)]), 1)
    self.assertEqual(len(bonds.index[('H',2)]), 1)
    self.assertEqual(len(bonds.index[('H',3)]), 1)
    self.assertEqual(len(bonds.index[('H',4)]), 1)
    self.assertEqual(len(bonds.index[('H',5)]), 1)
    self.assertEqual(len(bonds.index[('H',6)]), 1)