Example #1
0
    def testMultiLogFile(self):
        log = LogFile(os.path.join(EXAMPLES_DIR, MULTI_STYLE_EXAMPLE_LOG))
        self.assertEqual(len(log.runs), 2)
        run0 = log.runs[0]
        run1 = log.runs[1]

        self.assertEqual(len(run0.keys()), 15)
        self.assertIn("Step", run0)
        self.assertIn("CPU", run0)
        self.assertIn("TotEng", run0)
        self.assertIn("KinEng", run0)
        self.assertIn("Temp", run0)
        self.assertIn("PotEng", run0)
        self.assertIn("E_bond", run0)
        self.assertIn("E_angle", run0)
        self.assertIn("E_dihed", run0)
        self.assertIn("E_impro", run0)
        self.assertIn("E_vdwl", run0)
        self.assertIn("E_coul", run0)
        self.assertIn("E_long", run0)
        self.assertIn("Press", run0)
        self.assertIn("Volume", run0)

        for k in run0:
            self.assertEqual(len(run0[k]), 51)

        self.assertEqual(run0["Step"], list(range(0, 255000, 5000)))
Example #2
0
 def testDefaultLogFile(self):
     log = LogFile(os.path.join(EXAMPLES_DIR, DEFAULT_STYLE_EXAMPLE_LOG))
     self.assertEqual(len(log.runs), 1)
     run = log.runs[0]
     self.assertEqual(len(run.keys()), 6)
     self.assertIn("Step", run)
     self.assertIn("Temp", run)
     self.assertIn("E_pair", run)
     self.assertIn("E_mol", run)
     self.assertIn("TotEng", run)
     self.assertIn("Press", run)
     self.assertEqual(len(run["Step"]), 6)
     self.assertEqual(len(run["Temp"]), 6)
     self.assertEqual(len(run["E_pair"]), 6)
     self.assertEqual(len(run["E_mol"]), 6)
     self.assertEqual(len(run["TotEng"]), 6)
     self.assertEqual(len(run["Press"]), 6)
     self.assertEqual(log.runs[0]["Step"], [0, 50, 100, 150, 200, 250])
Example #3
0
 def testLogFileNotFound(self):
     with self.assertRaises(FileNotFoundError):
         LogFile('test.log')