diff --git a/Framework/PythonInterface/plugins/algorithms/Abins.py b/Framework/PythonInterface/plugins/algorithms/Abins.py index 92b7568a2d2a..ce744ec8e744 100644 --- a/Framework/PythonInterface/plugins/algorithms/Abins.py +++ b/Framework/PythonInterface/plugins/algorithms/Abins.py @@ -58,7 +58,7 @@ def PyInit(self): self.declareProperty(FileProperty("PhononFile", "", action=FileAction.Load, direction=Direction.Input, - extensions=["phonon", "out", "outmol", "log"]), + extensions=["phonon", "out", "outmol", "log", "LOG"]), doc="File with the data from a phonon calculation.") self.declareProperty(FileProperty("ExperimentalFile", "", @@ -610,7 +610,7 @@ def _validate_dft_file_extension(self, filename_full_path=None, expected_file_ex # check extension of a file found_filename_ext = os.path.splitext(filename_full_path)[1] - if found_filename_ext != expected_file_extension: + if found_filename_ext.lower() != expected_file_extension: return dict(Invalid=True, Comment=msg_err + "Output from DFT program " + dft_program + " is expected." + " The expected extension of file is ." + expected_file_extension + diff --git a/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN.LOG.md5 b/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN.LOG.md5 new file mode 100644 index 000000000000..0f5dda85e56e --- /dev/null +++ b/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN.LOG.md5 @@ -0,0 +1 @@ +03c06bc4afe62ae6e224fcb2e2d525c8 diff --git a/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 b/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 new file mode 100644 index 000000000000..404bdb69b59b --- /dev/null +++ b/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 @@ -0,0 +1 @@ +8558dff4ff22e0e087220639b6e7acbc diff --git a/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN_data.txt.md5 b/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN_data.txt.md5 new file mode 100644 index 000000000000..e3eeb3cd4596 --- /dev/null +++ b/Testing/Data/UnitTest/BENZENE4_g03_win_LoadGAUSSIAN_data.txt.md5 @@ -0,0 +1 @@ +2032778ae20e60af1de825be6248aff3 diff --git a/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN.LOG.md5 b/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN.LOG.md5 new file mode 100644 index 000000000000..2621b1b65cb5 --- /dev/null +++ b/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN.LOG.md5 @@ -0,0 +1 @@ +149d08e3ec152b17663792ef7f3bf59b diff --git a/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 b/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 new file mode 100644 index 000000000000..06ed721499b5 --- /dev/null +++ b/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 @@ -0,0 +1 @@ +b102805ec68153e4279ff4546ee92a5b diff --git a/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN_data.txt.md5 b/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN_data.txt.md5 new file mode 100644 index 000000000000..3431a1585dad --- /dev/null +++ b/Testing/Data/UnitTest/BENZENE4_g09_win_LoadGAUSSIAN_data.txt.md5 @@ -0,0 +1 @@ +ee3349c525b6601afc84643acc49fdc8 diff --git a/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN.log.md5 b/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN.log.md5 new file mode 100644 index 000000000000..85110264ad91 --- /dev/null +++ b/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN.log.md5 @@ -0,0 +1 @@ +689a5221e1843b715ddf4430dc692026 diff --git a/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 b/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 new file mode 100644 index 000000000000..c09576016aed --- /dev/null +++ b/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN_atomic_displacements_data_0.txt.md5 @@ -0,0 +1 @@ +98450f7b27e05c8a50232f2ffb85ec03 diff --git a/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN_data.txt.md5 b/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN_data.txt.md5 new file mode 100644 index 000000000000..a2625c0bac45 --- /dev/null +++ b/Testing/Data/UnitTest/C6H5Cl_LoadGAUSSIAN_data.txt.md5 @@ -0,0 +1 @@ +26850832776754a46affe765b25ca483 diff --git a/scripts/AbinsModules/GeneralLoadDFTTester.py b/scripts/AbinsModules/GeneralLoadDFTTester.py index 86b061a782e8..75fd3ec68f04 100644 --- a/scripts/AbinsModules/GeneralLoadDFTTester.py +++ b/scripts/AbinsModules/GeneralLoadDFTTester.py @@ -61,17 +61,27 @@ def _check_reader_data(self, correct_data=None, data=None, filename=None, extens self.assertEqual(correct_data["attributes"]["advanced_parameters"], data["attributes"]["advanced_parameters"]) self.assertEqual(correct_data["attributes"]["hash"], data["attributes"]["hash"]) self.assertEqual(correct_data["attributes"]["DFT_program"], data["attributes"]["DFT_program"]) - self.assertEqual(AbinsModules.AbinsTestHelpers.find_file(filename + "." + extension), - data["attributes"]["filename"]) + + try: + self.assertEqual(AbinsModules.AbinsTestHelpers.find_file(filename + "." + extension), + data["attributes"]["filename"]) + except AssertionError: + self.assertEqual(AbinsModules.AbinsTestHelpers.find_file(filename + "." + extension.upper()), + data["attributes"]["filename"]) # check datasets self.assertEqual(True, np.allclose(correct_data["datasets"]["unit_cell"], data["datasets"]["unit_cell"])) - def _check_loader_data(self, correct_data=None, input_dft_filename=None, extension=None): + def _check_loader_data(self, correct_data=None, input_dft_filename=None, extension=None, loader=None): + + try: + read_filename = AbinsModules.AbinsTestHelpers.find_file(input_dft_filename + "." + extension) + dft_loader = loader(input_dft_filename=read_filename) + except ValueError: + read_filename = AbinsModules.AbinsTestHelpers.find_file(input_dft_filename + "." + extension.upper()) + dft_loader = loader(input_dft_filename=read_filename) - loader = AbinsModules.LoadDMOL3( - input_dft_filename=AbinsModules.AbinsTestHelpers.find_file(input_dft_filename + "." + extension)) - loaded_data = loader.load_formatted_data().extract() + loaded_data = dft_loader.load_formatted_data().extract() # k points correct_items = correct_data["datasets"]["k_points_data"] @@ -96,7 +106,7 @@ def _check_loader_data(self, correct_data=None, input_dft_filename=None, extensi self.assertEqual(True, np.allclose(np.array(correct_atoms["atom_%s" % item]["coord"]), atoms["atom_%s" % item]["coord"])) - def _check(self, name=None, loader=None): + def check(self, name=None, loader=None): extension = self._loaders_extensions[str(loader)] @@ -110,7 +120,7 @@ def _check(self, name=None, loader=None): self._check_reader_data(correct_data=correct_data, data=data, filename=name, extension=extension) # check loaded data - self._check_loader_data(correct_data=correct_data, input_dft_filename=name, extension=extension) + self._check_loader_data(correct_data=correct_data, input_dft_filename=name, extension=extension, loader=loader) def _read_dft(self, loader=None, filename=None, extension=None): """ @@ -120,13 +130,17 @@ def _read_dft(self, loader=None, filename=None, extension=None): :returns: phonon data """ # 1) Read data - filename = AbinsModules.AbinsTestHelpers.find_file(filename=filename + "." + extension) - dft_reader = loader(input_dft_filename=filename) + try: + read_filename = AbinsModules.AbinsTestHelpers.find_file(filename=filename + "." + extension) + ab_initio_reader = loader(input_dft_filename=read_filename) + except ValueError: + read_filename = AbinsModules.AbinsTestHelpers.find_file(filename=filename + "." + extension.upper()) + ab_initio_reader = loader(input_dft_filename=read_filename) - data = self._get_reader_data(dft_reader=dft_reader) + data = self._get_reader_data(dft_reader=ab_initio_reader) # test validData method - self.assertEqual(True, dft_reader._clerk._valid_hash()) + self.assertEqual(True, ab_initio_reader._clerk._valid_hash()) return data diff --git a/scripts/AbinsModules/LoadGAUSSIAN.py b/scripts/AbinsModules/LoadGAUSSIAN.py index 97cca379139b..1b165c21bfba 100644 --- a/scripts/AbinsModules/LoadGAUSSIAN.py +++ b/scripts/AbinsModules/LoadGAUSSIAN.py @@ -7,7 +7,7 @@ class LoadGAUSSIAN(AbinsModules.GeneralDFTProgram): """ - Class for loading GAUSSIAN DFT vibrational data. + Class for loading GAUSSIAN ab initio vibrational data. """ def __init__(self, input_dft_filename): """ @@ -160,11 +160,12 @@ def _read_atomic_disp_block(self, file_obj=None, disp=None): :param file_obj: file object from which we read :param disp: list with x coordinates which we update [num_freq, num_atoms, dim] """ - sub_block_start = "Atom AN X Y Z X Y Z X Y Z" + sub_block_start = "X Y Z X Y Z X Y Z" self._parser.find_first(file_obj=file_obj, msg=sub_block_start) num_atom = 0 - line_size = len(sub_block_start.split()) + # Atom AN X Y Z X Y Z X Y Z + line_size = len(sub_block_start.split()) + 2 freq_per_line = sub_block_start.count("X") l = file_obj.readline().split() diff --git a/scripts/test/AbinsLoadCASTEPTest.py b/scripts/test/AbinsLoadCASTEPTest.py index 6865d4416949..b7160857f283 100644 --- a/scripts/test/AbinsLoadCASTEPTest.py +++ b/scripts/test/AbinsLoadCASTEPTest.py @@ -27,7 +27,7 @@ def tearDown(self): _gamma_sum = "squaricn_sum_LoadCASTEP" def test_gamma_sum_correction(self): - self._check(name=self._gamma_sum, loader=AbinsModules.LoadCASTEP) + self.check(name=self._gamma_sum, loader=AbinsModules.LoadCASTEP) # =================================================================================== # | Use case: Gamma point calculation and no sum correction for Gamma point | @@ -35,7 +35,7 @@ def test_gamma_sum_correction(self): _gamma_no_sum = "squaricn_no_sum_LoadCASTEP" def test_gamma_no_sum_correction(self): - self._check(name=self._gamma_no_sum, loader=AbinsModules.LoadCASTEP) + self.check(name=self._gamma_no_sum, loader=AbinsModules.LoadCASTEP) # =================================================================================== # | Use case: more than one k-point and sum correction | @@ -43,7 +43,7 @@ def test_gamma_no_sum_correction(self): _many_k_sum = "Si2-phonon_LoadCASTEP" def test_sum_correction_single_crystal(self): - self._check(name=self._many_k_sum, loader=AbinsModules.LoadCASTEP) + self.check(name=self._many_k_sum, loader=AbinsModules.LoadCASTEP) # =================================================================================== # | Use case: more than one k-point without sum correction | @@ -52,7 +52,7 @@ def test_sum_correction_single_crystal(self): _many_k_no_sum = "Si2-sc_LoadCASTEP" def test_no_sum_correction_single_crystal(self): - self._check(name=self._many_k_no_sum, loader=AbinsModules.LoadCASTEP) + self.check(name=self._many_k_no_sum, loader=AbinsModules.LoadCASTEP) if __name__ == '__main__': unittest.main() diff --git a/scripts/test/AbinsLoadCRYSTALTest.py b/scripts/test/AbinsLoadCRYSTALTest.py index d028480cf724..e625f9a37860 100644 --- a/scripts/test/AbinsLoadCRYSTALTest.py +++ b/scripts/test/AbinsLoadCRYSTALTest.py @@ -28,15 +28,15 @@ def tearDown(self): _phonon_dispersion_v2 = "MgO-222-DISP_LoadCRYSTAL" def test_gamma_crystal(self): - self._check(name=self._gamma_crystal, loader=AbinsModules.LoadCRYSTAL) - self._check(name=self._set_crystal, loader=AbinsModules.LoadCRYSTAL) + self.check(name=self._gamma_crystal, loader=AbinsModules.LoadCRYSTAL) + self.check(name=self._set_crystal, loader=AbinsModules.LoadCRYSTAL) def test_molecule(self): - self._check(name=self._molecule, loader=AbinsModules.LoadCRYSTAL) + self.check(name=self._molecule, loader=AbinsModules.LoadCRYSTAL) def test_phonon_dispersion_crystal(self): - self._check(name=self._phonon_dispersion_v1, loader=AbinsModules.LoadCRYSTAL) - self._check(name=self._phonon_dispersion_v2, loader=AbinsModules.LoadCRYSTAL) + self.check(name=self._phonon_dispersion_v1, loader=AbinsModules.LoadCRYSTAL) + self.check(name=self._phonon_dispersion_v2, loader=AbinsModules.LoadCRYSTAL) if __name__ == '__main__': unittest.main() diff --git a/scripts/test/AbinsLoadDMOL3Test.py b/scripts/test/AbinsLoadDMOL3Test.py index 8c0d1a9afe43..5c7a91ef1103 100644 --- a/scripts/test/AbinsLoadDMOL3Test.py +++ b/scripts/test/AbinsLoadDMOL3Test.py @@ -17,8 +17,8 @@ def tearDown(self): _gamma_no_h_dmol3 = "Na2SiF6_LoadDMOL3" def test_gamma_dmol3(self): - self._check(name=self._gamma_dmol3, loader=AbinsModules.LoadDMOL3) - self._check(name=self._gamma_no_h_dmol3, loader=AbinsModules.LoadDMOL3) + self.check(name=self._gamma_dmol3, loader=AbinsModules.LoadDMOL3) + self.check(name=self._gamma_no_h_dmol3, loader=AbinsModules.LoadDMOL3) if __name__ == '__main__': unittest.main() diff --git a/scripts/test/AbinsLoadGAUSSIANTest.py b/scripts/test/AbinsLoadGAUSSIANTest.py index 8029d7ff8217..d2d6d889bd7e 100644 --- a/scripts/test/AbinsLoadGAUSSIANTest.py +++ b/scripts/test/AbinsLoadGAUSSIANTest.py @@ -11,12 +11,29 @@ def tearDown(self): # *************************** USE CASES ******************************************** # =================================================================================== - # | Use cases: molecular calculation for GAUSSIAN | + # | Use cases: molecular calculation for GAUSSIAN03 Hartree Fock, Unix | # =================================================================================== - _molecule_gaussian = "C6H5Cl-LoadGAUSSIAN" + _gaussian_system1 = "C6H5Cl_LoadGAUSSIAN" + + def test_gaussian_1(self): + self.check(name=self._gaussian_system1, loader=AbinsModules.LoadGAUSSIAN) + + # =================================================================================== + # | Use cases: molecular calculation for GAUSSIAN03 DFT, Win | + # =================================================================================== + _gaussian_system2 = "BENZENE4_g03_win_LoadGAUSSIAN" + + def test_gaussian_2(self): + self.check(name=self._gaussian_system2, loader=AbinsModules.LoadGAUSSIAN) + + # =================================================================================== + # | Use cases: molecular calculation for GAUSSIAN09 DFT, Win | + # =================================================================================== + _gaussian_system3 = "BENZENE4_g09_win_LoadGAUSSIAN" + + def test_gaussian_3(self): + self.check(name=self._gaussian_system3, loader=AbinsModules.LoadGAUSSIAN) - def test_molecule_gaussian(self): - self._check(name=self._molecule_gaussian, loader=AbinsModules.LoadGAUSSIAN) if __name__ == '__main__': unittest.main()