Esempio n. 1
0
 def testTplDumpMismatch(self):
     try:
         with capture_stderr(evbdump2data.main, ["-c", TPL_DUMP_MISMATCH_INI]) as output:
             self.assertTrue("listed number of atoms (214084) does not equal the number of atoms in the "
                             "template data file (1429)" in output)
     finally:
         silent_remove(REPROD_TPL)
Esempio n. 2
0
 def testIncompDump(self):
     try:
         with capture_stderr(main, ["-c", INCOMP_DUMP_INI_PATH]) as output:
             self.assertTrue("WARNING" in output)
         self.assertFalse(diff_lines(DEF_GOFR_INCOMP_OUT, GOOD_HO_GOFR_OUT_PATH))
     finally:
         silent_remove(DEF_GOFR_INCOMP_OUT, disable=DISABLE_REMOVE)
Esempio n. 3
0
 def testDefInp(self):
     test_input = ["-c", DEF_INI, "-f", DEF_INPUT]
     try:
         main(test_input)
         self.assertFalse(diff_lines(DEF_OUT, GOOD_OUT))
     finally:
         silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
Esempio n. 4
0
 def testWaterMolCombine(self):
     # Should skip the timestep with only 1 state
     try:
         main(["-c", WATER_MOL_COMB_INI])
         self.assertFalse(diff_lines(WATER_MOL_COMB_OUT, GOOD_WATER_MOL_COMB_OUT))
     finally:
         silent_remove(WATER_MOL_COMB_OUT)
Esempio n. 5
0
 def testGlu(self):
     try:
         data2pdb.main(["-c", GLU_INI])
         self.assertFalse(diff_lines(GLU_OUT, GOOD_GLU_OUT))
     finally:
         silent_remove(PDB_TPL_OUT)
         silent_remove(GLU_OUT)
Esempio n. 6
0
 def testDefInp(self):
     try:
         with capture_stdout(main, ["-f", DEF_INPUT, "-c", DEF_INI]) as output:
             self.assertTrue("Keeping 2 of 4 rows based on filtering criteria" in output)
         self.assertFalse(diff_lines(CSV_OUT, GOOD_CSV_OUT))
     finally:
         silent_remove(CSV_OUT)
Esempio n. 7
0
 def testDefInp(self):
     try:
         with capture_stdout(main, ["-f", DEF_INPUT]) as output:
             self.assertTrue(GOOD_OUT in output)
             self.assertFalse(diff_lines(CSV_OUT, GOOD_CSV_OUT))
     finally:
         silent_remove(CSV_OUT, disable=DISABLE_REMOVE)
 def testCheckCharge(self):
     try:
         with capture_stdout(main, ["-c", CHECK_CHARGE_INI]) as output:
             self.assertFalse("total charge" in output)
     finally:
         silent_remove(VMD_OUT)
         silent_remove(WATER_OUT)
Esempio n. 9
0
 def testEmreAddElements(self):
     # As above, but a larger/different PDB
     try:
         main(["-c", EMRE_ADD_ELEMENT_INI])
         self.assertFalse(diff_lines(EMRE_ADD_ELEMENT_OUT, GOOD_EMRE_ADD_ELEMENT_OUT))
     finally:
         silent_remove(EMRE_ADD_ELEMENT_OUT)
Esempio n. 10
0
 def testMaxTimestepsCalcHIJ(self):
     try:
         with capture_stdout(main, ["-c", HIJ_INI]) as output:
             self.assertTrue("Reached the maximum timesteps" in output)
         self.assertFalse(diff_lines(HIJ_OUT, GOOD_HIJ_OUT))
     finally:
         silent_remove(HIJ_OUT, disable=DISABLE_REMOVE)
Esempio n. 11
0
 def testAddNothing(self):
     # this first test does not really doing anything, and warns the user
     try:
         with capture_stderr(main, [INPUT_PATH]) as output:
             self.assertTrue("Return file will be the same as the input" in output)
         self.assertFalse(diff_lines(INPUT_PATH, DEF_OUT_PATH))
     finally:
         silent_remove(DEF_OUT_PATH)
Esempio n. 12
0
 def testSpecOverwrite(self):
     try:
         main([str(EXP_TEMP), "-o"])
         self.assertFalse(diff_lines(ORIG_WHAM_OUT, GOOD_ORIG_WHAM_OUT))
         self.assertFalse(diff_lines(SHORT_WHAM_OUT, GOOD_SHORT_WHAM_OUT))
     finally:
         silent_remove(ORIG_WHAM_OUT, disable=DISABLE_REMOVE)
         silent_remove(SHORT_WHAM_OUT, disable=DISABLE_REMOVE)
Esempio n. 13
0
 def testGood(self):
     try:
         main([PB_GOOD])
         self.assertEqual(2, len(diff_lines(PB_GOOD_XYZ, PB_REF_XYZ, delimiter=" ")))
         self.assertEqual(0, len(diff_lines(PB_GOOD_LOG, PB_REF_LOG)))
     finally:
         silent_remove(PB_GOOD_LOG)
         silent_remove(PB_GOOD_XYZ)
Esempio n. 14
0
 def testDefInpWithBuffer(self):
     try:
         with capture_stdout(main, ["-f", DEF_INPUT, "-b", "6"]) as output:
             self.assertTrue('Max plus 6.0 buffer:'
                             '        17.891000        21.605000        24.314000' in output)
             self.assertFalse(diff_lines(CSV_OUT, GOOD_CSV_BUFFER_OUT))
     finally:
         silent_remove(CSV_OUT, disable=DISABLE_REMOVE)
Esempio n. 15
0
 def testBadInput(self):
     # Test what happens when cannot convert a value to float
     try:
         with capture_stderr(main, ["-f", BAD_INPUT]) as output:
             self.assertTrue("could not be converted to a float" in output)
             self.assertFalse(diff_lines(BAD_INPUT_OUT, GOOD_BAD_INPUT_OUT))
     finally:
         silent_remove(BAD_INPUT_OUT, disable=DISABLE_REMOVE)
Esempio n. 16
0
 def testGluBadDump(self):
     # main(["-c", GLU_BAD_DATA_INI])
     try:
         with capture_stderr(main, ["-c", GLU_BAD_DATA_INI]) as output:
             self.assertTrue("Problems reading data: Unexpected line in file tests/test_data/evbd2d/glu_bad.dump: "
                             "ITEM: XYZ MS id mol type q x y z" in output)
     finally:
         silent_remove(REPROD_TPL)
Esempio n. 17
0
 def testNoHydData(self):
     """
     Because the types do not match the data file, did not find the molecules desired.
     """
     evbdump2data.main(["-c", GLU_BAD_ATOM_TYPE_INI])
     with capture_stderr(evbdump2data.main, ["-c", GLU_BAD_ATOM_TYPE_INI]) as output:
         self.assertTrue("Check the data file" in output)
     silent_remove(REPROD_TPL)
Esempio n. 18
0
 def testBinMax(self):
     # In this input, one big has more than the max and one less
     test_input = ["-f", BIN_INPUT, "-c", BIN_MAX_INI]
     try:
         main(test_input)
         # self.assertFalse(diff_lines(DEF_BIN_OUT, GOOD_BIN_MAX_OUT))
     finally:
         silent_remove(DEF_BIN_OUT, disable=DISABLE_REMOVE)
Esempio n. 19
0
 def testBinMax2(self):
     # In this input, both bins have more than the max entries
     test_input = ["-f", BIN_INPUT, "-c", BIN_MAX2_INI]
     try:
         main(test_input)
         self.assertFalse(diff_lines(DEF_BIN_OUT, GOOD_BIN_MAX2_OUT))
     finally:
         silent_remove(DEF_BIN_OUT, disable=DISABLE_REMOVE)
Esempio n. 20
0
 def testSortFromLammps(self):
     try:
         main(["-c", SORT_FROM_LAMMPS_INI])
         self.assertFalse(diff_lines(SORT_FROM_LAMMPS, SORT_FROM_LAMMPS_GOOD))
         self.assertFalse(diff_lines(SELECT_FROM_LAMMPS, SELECT_FROM_LAMMPS_GOOD))
     finally:
         silent_remove(SORT_FROM_LAMMPS, disable=DISABLE_REMOVE)
         silent_remove(SELECT_FROM_LAMMPS, disable=DISABLE_REMOVE)
Esempio n. 21
0
 def testNoMinNonFloat(self):
     # Tests both handling when no min section is specified and non-floats in the file to be analyzed
     test_input = ["-f", NON_FLOAT_INPUT, "-c", NO_MIN_INI]
     try:
         main(test_input)
         self.assertFalse(diff_lines(NON_FLOAT_OUT, GOOD_NON_FLOAT_OUT))
     finally:
         silent_remove(NON_FLOAT_OUT)
Esempio n. 22
0
 def testCompDihAlt(self):
     # Test it is okay with sections in the 1st but not 2nd file
     with capture_stderr(main, ["-c", COMP_DIH_ALT_INI]) as output:
         self.assertTrue("WARNING:  Skipping section" in output)
     try:
         self.assertFalse(diff_lines(COMP_DIH_ALT_OUT, COMP_DIH_ALT_OUT_GOOD))
     finally:
         silent_remove(COMP_DIH_ALT_OUT, disable=DISABLE_REMOVE)
Esempio n. 23
0
 def testReorderAtoms(self):
     try:
         with capture_stdout(main, ["-c", DEF_INI]) as output:
             for message in WATER_OUT_OF_ORDER_MESSAGES:
                 self.assertFalse(message in output)
         self.assertFalse(diff_lines(DEF_OUT, GOOD_OUT))
     finally:
         silent_remove(DEF_OUT)
Esempio n. 24
0
 def testDupCol(self):
     test_input = ["-f", DUP_COL_CMP_LIST]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertFalse(diff_lines(DEF_OUT, GOOD_OUT))
         self.assertTrue("Non-unique column" in output)
     silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
Esempio n. 25
0
 def testWaterMol(self):
     try:
         main(["-c", WATER_MOL_INI])
         self.assertFalse(diff_lines(WATER_MOL_OUT1, GOOD_WATER_MOL_OUT1))
         self.assertFalse(diff_lines(WATER_MOL_OUT2, GOOD_WATER_MOL_OUT2))
     finally:
         silent_remove(WATER_MOL_OUT1, disable=DISABLE_REMOVE)
         silent_remove(WATER_MOL_OUT2, disable=DISABLE_REMOVE)
Esempio n. 26
0
 def testCheckWaterOrder(self):
     try:
         # main(["-c", CHECK_WATER_ORDER_INI])
         with capture_stderr(main, ["-c", CHECK_WATER_ORDER_INI]) as output:
             for message in WATER_OUT_OF_ORDER_MESSAGES:
                 self.assertTrue(message in output)
             self.assertLess(len(output), 650)
     finally:
         silent_remove(DEF_OUT)
Esempio n. 27
0
 def testCiInfo(self):
     try:
         main(["-c", CI_INI])
         self.assertFalse(diff_lines(DEF_CI_OUT1, GOOD_CI_OUT1))
         self.assertEquals(1, len(diff_lines(DEF_CI_OUT2, BAD_CI_OUT2)))
         self.assertFalse(diff_lines(DEF_CI_OUT2, GOOD_CI_OUT2))
     finally:
         silent_remove(DEF_CI_OUT1)
         silent_remove(DEF_CI_OUT2)
Esempio n. 28
0
 def testAddElemReadDict(self):
     # There will be a missing element because of a missing key in the specified dictionary
     try:
         # main(["-c", READ_ELEM_DICT_INI])
         with capture_stderr(main, ["-c", READ_ELEM_DICT_INI]) as output:
             self.assertTrue("Please add atom type" in output)
         self.assertFalse(diff_lines(ADD_ELEMENT_OUT, GOOD_READ_ELEM_OUT))
     finally:
         silent_remove(ADD_ELEMENT_OUT)
Esempio n. 29
0
 def testAddElemReadDictNoOverwrite(self):
     # Make sure preserves the element from the original pdb even though not in the read dict
     try:
         # main(["-c", READ_ELEM_DICT_KEEP_ELEM_INI])
         with capture_stderr(main, ["-c", READ_ELEM_DICT_KEEP_ELEM_INI]) as output:
             self.assertTrue("Please add atom type" in output)
         self.assertFalse(diff_lines(DEF_OUT, GOOD_ADD_ELEMENT_OUT))
     finally:
         silent_remove(DEF_OUT)
Esempio n. 30
0
 def testHO_OO_HH_OHGofR_MaxSteps(self):
     test_input = ["-c", HO_OO_HH_OH_GOFR_INI_MAX_STEPS]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stdout(main, test_input) as output:
             self.assertTrue(good_long_out_msg in output)
         self.assertFalse(diff_lines(DEF_MAX_STEPS_OUT, GOOD_HO_OO_HH_OH_GOFR_OUT_MAX_STEPS))
     finally:
         silent_remove(DEF_MAX_STEPS_OUT, disable=DISABLE_REMOVE)
Esempio n. 31
0
 def testSubsetCiInfo(self):
     with capture_stderr(main, ["-c", CI_SUBSET_INI]) as output:
         self.assertTrue("found no data from" in output)
         self.assertFalse(diff_lines(DEF_CI_SUBSET_OUT, GOOD_CI_SUBSET_OUT))
         silent_remove(DEF_CI_SUBSET_OUT, disable=DISABLE_REMOVE)
         silent_remove(DEF_CI_OUT1, disable=DISABLE_REMOVE)
         silent_remove(DEF_CI_OUT2, disable=DISABLE_REMOVE)
Esempio n. 32
0
 def testFileListToData(self):
     try:
         silent_remove(GLU_DATA_OUT)
         test_input = ["-c", MULT_2DATA_INI]
         main(test_input)
         diffs = diff_lines(GLU_DATA_OUT, GOOD_GLU_DATA_OUT)
         diffs1 = diff_lines(GLU_DATA_OUT2, GOOD_GLU_DATA_OUT2)
         for diff_list in [diffs, diffs1]:
             self.assertEqual(len(diff_list), 2)
             self.assertTrue("Created on " in diff_list[0])
     finally:
         silent_remove(GLU_DATA_OUT, disable=DISABLE_REMOVE)
         silent_remove(GLU_DATA_OUT1, disable=DISABLE_REMOVE)
         silent_remove(GLU_DATA_OUT2, disable=DISABLE_REMOVE)
Esempio n. 33
0
 def testMultiLineSepIni(self):
     # have different rows create different files
     # test that if the prefix is already used, number it
     # test if nothing common in the file base names, number it
     try:
         main(["-f", MULTI_LINE_CMP_LIST, "-s", "-l", SUB_DATA_DIR])
         self.assertFalse(diff_lines(LINE1_OUT, GOOD_LINE1_OUT))
         self.assertFalse(diff_lines(LINE2_OUT, GOOD_LINE2_OUT))
         self.assertFalse(diff_lines(LINE3_OUT, GOOD_LINE1_OUT))
         self.assertFalse(diff_lines(LINE4_OUT, GOOD_LINE1_OUT))
     finally:
         silent_remove(LINE1_OUT, disable=DISABLE_REMOVE)
         silent_remove(LINE2_OUT, disable=DISABLE_REMOVE)
         silent_remove(LINE3_OUT, disable=DISABLE_REMOVE)
         silent_remove(LINE4_OUT, disable=DISABLE_REMOVE)
Esempio n. 34
0
 def testInitialDirections(self):
     # Start multi-variable
     test_input = ["-c", DIRS_INI]
     try:
         silent_remove(BEST_PARAMS)
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stdout(main, test_input) as output:
             # this option reduced the function calls by 1 (19 to 18)
             self.assertTrue("Function evaluations: 223" in output)
             self.assertFalse(diff_lines(BEST_PARAMS, GOOD_BEST_PARAMS))
     finally:
         silent_remove(PAR_OUT, disable=DISABLE_REMOVE)
         silent_remove(SCRIPT_OUT, disable=DISABLE_REMOVE)
         silent_remove(BEST_PARAMS, disable=DISABLE_REMOVE)
Esempio n. 35
0
 def testBasinHopBounds(self):
     # Try hopping + minimization
     try:
         silent_remove(SCRIPT_OUT)
         test_input = ["-c", CONV_HOP_MIN_MAX_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
             silent_remove(SCRIPT_OUT)
         with capture_stdout(main, test_input) as output:
             self.assertTrue(
                 "success condition satisfied. Number of function calls: 83"
                 in output)
     finally:
         silent_remove(PAR_OUT, disable=DISABLE_REMOVE)
         silent_remove(SCRIPT_OUT, disable=DISABLE_REMOVE)
Esempio n. 36
0
 def testNoOpt(self):
     # Testing that will run without any params specified to be optimized
     silent_remove(PAR_OUT)
     test_input = ["-c", PAR_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stderr(main, test_input) as output:
             self.assertTrue("No parameters will be optimized" in output)
         self.assertFalse(diff_lines(PAR_OUT, GOOD_PAR_OUT2))
         self.assertFalse(diff_lines(COPY_PAR, GOOD_PAR_OUT2))
     finally:
         silent_remove(PAR_OUT, disable=DISABLE_REMOVE)
         silent_remove(COPY_PAR, disable=DISABLE_REMOVE)
         silent_remove(SCRIPT_OUT, disable=DISABLE_REMOVE)
Esempio n. 37
0
 def testCollectBestWResid1(self):
     try:
         shutil.copyfile(ORIG_ALL_BEST1, ALL_BEST)
         main([
             "-c", DA_GAUSS_INI, "-f", FITEVB_OUT1, "-s", ALL_BEST, "-r",
             FIT_HIJ, FIT_REP1
         ])
         self.assertFalse(diff_lines(DEF_OUT, GOOD_INP_OUT1))
         self.assertFalse(diff_lines(ALL_BEST, GOOD_ALL_BEST1))
         self.assertFalse(diff_lines(ALL_BEST_CSV, GOOD_ALL_BEST_CSV1))
         self.assertFalse(diff_lines(ALL_BEST_DIFF, GOOD_ALL_BEST_DIFF1))
     finally:
         silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
         silent_remove(ALL_BEST, disable=DISABLE_REMOVE)
         silent_remove(ALL_BEST_CSV, disable=DISABLE_REMOVE)
         silent_remove(ALL_BEST_DIFF, disable=DISABLE_REMOVE)
Esempio n. 38
0
 def testAddSummarySuffix(self):
     try:
         shutil.copyfile(ORIG_ALL_BEST_ARQ2, ALL_BEST)
         main([
             "-c", ARQ7_INI, "-f", FITEVB_ARQ2_BEST, "-s", ALL_BEST, "-r",
             FIT_REP1, FIT_HIJ
         ])
         self.assertFalse(diff_lines(SUB_DIR_DEF_OUT, GOOD_INP_ARQ7_OUT))
         self.assertFalse(diff_lines(ALL_BEST, GOOD_ALL_BEST_ARQ7))
         self.assertFalse(
             diff_lines(SUB_DATA_ALL_BEST_CSV, GOOD_ALL_BEST_ARQ7_CSV))
         # self.assertFalse(diff_lines(SUB_ALL_BEST_DIFF, GOOD_ARQ7_PERC_DIFF))
     finally:
         silent_remove(SUB_DIR_DEF_OUT, disable=DISABLE_REMOVE)
         silent_remove(ALL_BEST, disable=DISABLE_REMOVE)
         silent_remove(SUB_DATA_ALL_BEST_CSV, disable=DISABLE_REMOVE)
         silent_remove(SUB_ALL_BEST_DIFF, disable=DISABLE_REMOVE)
Esempio n. 39
0
 def testTriangleMin(self):
     # Test stepwise minimization with multiple minimization steps
     test_input = ["-c", TRIANGLE_INI]
     try:
         silent_remove(SCRIPT_OUT)
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
             silent_remove(SCRIPT_OUT)
         with capture_stdout(main, test_input) as output:
             self.assertTrue("Resid:   34.416667 for parameters:    0.500000,   1.833333\n" in output)
             self.assertTrue("Resid:    4.496540 for parameters:    0.853871,   1.414121,  -3.133996, "
                             "  4.085879,   2.381966\n" in output)
             self.assertTrue("Function evaluations: 35\nOptimization terminated successfully. "
                             "Completed 2 of 2 minimization cycles" in output)
     finally:
             silent_remove(PAR_OUT, disable=DISABLE_REMOVE)
             silent_remove(SCRIPT_OUT, disable=DISABLE_REMOVE)
Esempio n. 40
0
 def testAtomNumTypeDict(self):
     try:
         main(["-c", GLUE_GLUP_INI])
         self.assertFalse(diff_lines(GLUP_GLUE_ATOM_NUM_DICT, GLUP_GLUE_ATOM_NUM_DICT_GOOD))
         self.assertFalse(diff_lines(GLUP_GLUE_ATOM_TYPE_DICT, GLUP_GLUE_ATOM_TYPE_DICT_GOOD))
         self.assertFalse(diff_lines(GLUP_AS_GLUE, GLUP_AS_GLUE_GOOD, delimiter=" "))
     finally:
         silent_remove(GLUP_GLUE_ATOM_NUM_DICT, disable=DISABLE_REMOVE)
         silent_remove(GLUP_GLUE_ATOM_TYPE_DICT, disable=DISABLE_REMOVE)
         silent_remove(GLUP_AS_GLUE, disable=DISABLE_REMOVE)
Esempio n. 41
0
 def testPrintQMMMNoExclude(self):
     try:
         main(["-c", QM_OUT_INI])
         self.assertFalse(diff_lines(MM_KIND_OUT, GOOD_MM_KIND_OUT))
         self.assertFalse(diff_lines(QMMM_OUT, GOOD_QM_OUT))
         self.assertFalse(diff_lines(VMD_ATOMS_OUT, GOOD_VMD_QM_ATOMS_OUT))
     finally:
         silent_remove(MM_KIND_OUT, disable=DISABLE_REMOVE)
         silent_remove(QMMM_OUT, disable=DISABLE_REMOVE)
         silent_remove(VMD_ATOMS_OUT, disable=DISABLE_REMOVE)
Esempio n. 42
0
 def testPrintQMMM(self):
     try:
         main(["-c", QMMM_OUT_INI])
         self.assertFalse(diff_lines(QMMM_PDB_OUT, QMMM_PDB_IN))
         self.assertFalse(diff_lines(QMMM_OUT, GOOD_QMMM_OUT))
         self.assertFalse(diff_lines(VMD_ATOMS_OUT, GOOD_VMD_ATOMS_OUT))
     finally:
         silent_remove(QMMM_PDB_OUT)
         silent_remove(QMMM_OUT)
         silent_remove(VMD_ATOMS_OUT)
Esempio n. 43
0
 def testHist(self):
     try:
         main(["-f", HIST_INPUT, "-n", "-d", ",", "-s"])
         for p_file in [HIST_PNG1, HIST_PNG2, HIST_PNG3]:
             self.assertGreater(os.path.getsize(p_file), 10000)
         self.assertFalse(diff_lines(HIST_OUT, GOOD_HIST_OUT))
         self.assertFalse(diff_lines(HIST_COUNT, GOOD_HIST_COUNT))
     finally:
         [
             silent_remove(o_file, disable=DISABLE_REMOVE) for o_file in [
                 HIST_PNG1,
                 HIST_PNG2,
                 HIST_PNG3,
                 HIST_OUT,
                 HIST_COUNT,
             ]
         ]
Esempio n. 44
0
 def testMoveExisting(self):
     try:
         self.assertFalse(find_backup_filenames(PB_GOOD_LOG))
         self.assertFalse(find_backup_filenames(PB_GOOD_XYZ))
         main([PB_GOOD])
         # repeated on purpose to make back-up files
         main([PB_GOOD])
         log_backs = find_backup_filenames(PB_GOOD_LOG)
         self.assertEqual(1, len(log_backs))
         xyz_backs = find_backup_filenames(PB_GOOD_XYZ)
         self.assertEqual(1, len(xyz_backs))
     finally:
         silent_remove(PB_GOOD_LOG)
         silent_remove(PB_GOOD_XYZ)
         for log_back in find_backup_filenames(PB_GOOD_LOG):
             silent_remove(log_back)
         for xyz_back in find_backup_filenames(PB_GOOD_XYZ):
             silent_remove(xyz_back)
         pass
Esempio n. 45
0
 def testNonTestedMethod(self):
     # Try alternate minimization method
     try:
         test_input = ["-c", CONV_NOT_TESTED_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
             silent_remove(SCRIPT_OUT)
         with capture_stderr(main, test_input) as output:
             self.assertTrue("Only the following optimization methods" in output)
     finally:
         silent_remove(PAR_OUT, disable=DISABLE_REMOVE)
         silent_remove(SCRIPT_OUT, disable=DISABLE_REMOVE)
Esempio n. 46
0
 def testGluDict(self):
     try:
         data2pdb.main(["-c", GLU_DICT_INI])
         self.assertFalse(diff_lines(GLU_OUT, GOOD_GLU_OUT))
         with open(DEF_DICT_OUT, 'r') as d_file:
             dict_test = json.load(d_file)
         with open(GOOD_DICT, 'r') as d_file:
             dict_good = json.load(d_file)
         self.assertEqual(dict_test, dict_good)
     finally:
         silent_remove(PDB_TPL_OUT)
         silent_remove(GLU_OUT)
         silent_remove(DEF_DICT_OUT)
Esempio n. 47
0
 def testCollectBestWResidNoInitialBest(self):
     try:
         # Ensure that this is not already a summary file
         silent_remove(ALL_BEST_STR, disable=DISABLE_REMOVE)
         main([
             "-c", DA_GAUSS_INI, "-f", FITEVB_OUT1, "-s", ALL_BEST_STR,
             "-r", FIT_HIJ, FIT_REP1
         ])
         self.assertFalse(diff_lines(DEF_OUT, GOOD_INP_OUT1))
         self.assertFalse(diff_lines(ALL_BEST_STR, GOOD_ALL_BEST_NEW))
     finally:
         silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
         silent_remove(ALL_BEST_STR, disable=DISABLE_REMOVE)
Esempio n. 48
0
 def testPrintQMMM(self):
     try:
         test_input = ["-c", QMMM_OUT_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stdout(main, test_input) as output:
             self.assertTrue("Total charge from QM atoms: -1.0" in output)
         self.assertFalse(diff_lines(QMMM_OUT, GOOD_QMMM_OUT))
         self.assertFalse(diff_lines(MM_KIND_OUT, GOOD_MM_KIND_OUT))
         self.assertFalse(diff_lines(VMD_ATOMS_OUT, GOOD_VMD_ATOMS_OUT))
     finally:
         silent_remove(QMMM_OUT, disable=DISABLE_REMOVE)
         silent_remove(MM_KIND_OUT, disable=DISABLE_REMOVE)
         silent_remove(VMD_ATOMS_OUT, disable=DISABLE_REMOVE)
 def testGoodInput(self):
     test_input = ["-l", GLU_LIST]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stdout(main, test_input) as output:
             self.assertTrue("1429         47     -0.274     -0.728     -0.387      0.470" in output)
             self.assertTrue("1429         53     -0.215      0.156      0.269      0.822" in output)
         self.assertFalse(diff_lines(GLU_SUM, GOOD_GLU_SUM))
         self.assertFalse(diff_lines(GLU_OUT1, GOOD_GLU_OUT1, delimiter=" "))
         self.assertFalse(diff_lines(GLU_OUT2, GOOD_GLU_OUT2, delimiter=" "))
     finally:
         silent_remove(GLU_SUM, disable=DISABLE_REMOVE)
         silent_remove(GLU_OUT1, disable=DISABLE_REMOVE)
         silent_remove(GLU_OUT2, disable=DISABLE_REMOVE)
Esempio n. 50
0
 def testNelderMeadMultiVar(self):
     # Try alternate minimization method for multiple variable. Did worse than Powell for multiple functions
     # Results from Powell are:
     # Current function value: 0.000000
     # Iterations: 10
     # Function evaluations: 242
     # Optimized parameters:
     # vii_0 = 2.000000
     # vij_0 = 0.000000
     # gamma = -2.000000
     try:
         test_input = ["-c", CONV_NM_MULTI_INI]
         silent_remove(SCRIPT_OUT)
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
             silent_remove(SCRIPT_OUT)
         with capture_stdout(main, test_input) as output:
             self.assertTrue("Current function value: 6.192328" in output)
             self.assertTrue("Iterations: 29" in output)
             self.assertTrue("Function evaluations: 56" in output)
     finally:
         silent_remove(PAR_OUT, disable=DISABLE_REMOVE)
         silent_remove(SCRIPT_OUT, disable=DISABLE_REMOVE)
Esempio n. 51
0
 def testMissingRadius(self):
     # Tests both providing a dictionary and not having an available radius (still prints everything, just missing
     # one radius)
     try:
         test_input = ["-c", MISSING_RADIUS_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stderr(main, test_input) as output:
             self.assertTrue(
                 "Did not find atom type 'XYZ' in the atom_type to radius dictionary"
                 in output)
         self.assertFalse(diff_lines(QMMM_OUT, GOOD_QMMM_OUT))
         self.assertFalse(diff_lines(MM_KIND_OUT, GOOD_MM_KIND_OUT))
         self.assertFalse(diff_lines(VMD_ATOMS_OUT, GOOD_VMD_ATOMS_OUT))
     finally:
         silent_remove(QMMM_OUT, disable=DISABLE_REMOVE)
         silent_remove(MM_KIND_OUT, disable=DISABLE_REMOVE)
         silent_remove(VMD_ATOMS_OUT, disable=DISABLE_REMOVE)
Esempio n. 52
0
 def testFileList(self):
     try:
         silent_remove(GLU_DATA_OUT)
         test_input = ["-c", MULT_FILE_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stdout(main, test_input) as output:
             self.assertTrue(
                 "tests/test_data/cp2k2data/glu_2.5_1.0.out energy: -283.342271788704181"
                 in output)
             self.assertTrue(
                 "tests/test_data/cp2k2data/glu_3.0_1.075.out energy: -472.455097972129295"
                 in output)
         diffs = diff_lines(GLU_DATA_OUT, GOOD_GLU_DATA_OUT)
         diffs1 = diff_lines(GLU_DATA_OUT2, GOOD_GLU_DATA_OUT2)
         for diff_list in [diffs, diffs1]:
             self.assertEquals(len(diff_list), 2)
             self.assertTrue("Created on " in diff_list[0])
     finally:
         silent_remove(GLU_DATA_OUT, disable=DISABLE_REMOVE)
         silent_remove(GLU_DATA_OUT2, disable=DISABLE_REMOVE)
Esempio n. 53
0
 def testDefault(self):
     try:
         main(["-o"])
         self.assertFalse(diff_lines(DEF_OUT, GOOD_OUT))
     finally:
         silent_remove(DEF_OUT)
Esempio n. 54
0
 def testSpecifyOutfile(self):
     try:
         main([INPUT_PATH, "-b", "../", "-e", ".txt", "-n", NEW_OUT_PATH])
         self.assertFalse(diff_lines(NEW_OUT_PATH, BOTH_OUT_PATH))
     finally:
         silent_remove(NEW_OUT_PATH)
Esempio n. 55
0
 def testWithHead075Data(self):
     try:
         main(argv=[HEAD_RAW])
         self.assertFalse(diff_lines(HEAD_STD, HEAD_PRESS))
     finally:
         silent_remove(HEAD_PRESS)
Esempio n. 56
0
 def testSerca(self):
     try:
         main(["-c", SERCA_INI])
         self.assertFalse(diff_lines(SERCA_OUT, SERCA_GOOD_OUT))
     finally:
         silent_remove(SERCA_OUT, disable=DISABLE_REMOVE)
Esempio n. 57
0
 def testAddBoth(self):
     try:
         main([INPUT_PATH, "-b", "../", "-e", ".txt"])
         self.assertFalse(diff_lines(DEF_OUT_PATH, BOTH_OUT_PATH))
     finally:
         silent_remove(DEF_OUT_PATH)
Esempio n. 58
0
 def testOHGofR(self):
     try:
         main(["-c", OH_GOFR_INI_PATH])
         self.assertFalse(diff_lines(DEF_GOFR_OUT, GOOD_OH_GOFR_OUT_PATH))
     finally:
         silent_remove(DEF_GOFR_OUT, disable=DISABLE_REMOVE)
Esempio n. 59
0
 def testMaxTimestepsCalcWatHyd(self):
     try:
         main(["-c", WAT_HYD_INI])
         self.assertFalse(diff_lines(HIJ_OUT, GOOD_WAT_HYD_OUT))
     finally:
         silent_remove(HIJ_OUT, disable=DISABLE_REMOVE)
Esempio n. 60
0
 def testSetDist(self):
     try:
         main(["-c", GLU_DIST_INI])
         self.assertFalse(diff_lines(GLU_DIST_OUT, GOOD_GLU_DIST_OUT))
     finally:
         silent_remove(GLU_DIST_OUT)