def test_partial_by_element(self):
        """Check results of INS spectrum resolved by elements: default should match explicit list of elements"""

        experimental_file = ""

        wrk_ref = Abins(
            AbInitioProgram=self._ab_initio_program,
            VibrationalOrPhononFile=self._squaricn + ".phonon",
            ExperimentalFile=experimental_file,
            TemperatureInKelvin=self._temperature,
            SampleForm=self._sample_form,
            Instrument=self._instrument_name,
            Atoms=self._atoms,
            Scale=self._scale,
            SumContributions=self._sum_contributions,
            QuantumOrderEventsNumber=self._quantum_order_events_number,
            ScaleByCrossSection=self._cross_section_factor,
            OutputWorkspace=self._squaricn + "_ref")

        wks_all_atoms_explicitly = Abins(
            VibrationalOrPhononFile=self._squaricn + ".phonon",
            Atoms="H, C, O",
            SumContributions=self._sum_contributions,
            QuantumOrderEventsNumber=self._quantum_order_events_number,
            OutputWorkspace="explicit")

        wks_all_atoms_default = Abins(
            VibrationalOrPhononFile=self._squaricn + ".phonon",
            SumContributions=self._sum_contributions,
            QuantumOrderEventsNumber=self._quantum_order_events_number,
            OutputWorkspace="default")

        # Python 3 has no guarantee of dict order so the workspaces in the group may be in
        # a different order on Python 3
        self.assertEqual(wks_all_atoms_explicitly.size(),
                         wks_all_atoms_default.size())
        explicit_names = wks_all_atoms_explicitly.getNames()
        for i in range(len(explicit_names)):
            explicit_name = explicit_names[i]
            default_name = "default" + explicit_name[8:]
            (result, messages) = CompareWorkspaces(explicit_name,
                                                   default_name,
                                                   Tolerance=self._tolerance)
            self.assertEqual(result, True)

        self.assertEqual(wrk_ref.size(), wks_all_atoms_default.size())
        ref_names = wrk_ref.getNames()
        for i in range(len(ref_names)):
            ref_name = ref_names[i]
            default_name = "default" + ref_name[len(self._squaricn + "_ref"):]
            (result, messages) = CompareWorkspaces(ref_name,
                                                   default_name,
                                                   Tolerance=self._tolerance)
            self.assertEqual(result, True)
    def test_partial(self):
        # By default workspaces for all atoms should be created. Test this default behaviour.

        experimental_file = ""

        wrk_ref = Abins(DFTprogram=self._dft_program,
                        PhononFile=self._squaricn + ".phonon",
                        ExperimentalFile=experimental_file,
                        Temperature=self._temperature,
                        SampleForm=self._sample_form,
                        Instrument=self._instrument_name,
                        Atoms=self._atoms,
                        Scale=self._scale,
                        SumContributions=self._sum_contributions,
                        QuantumOrderEventsNumber=self._quantum_order_events_number,
                        ScaleByCrossSection=self._cross_section_factor,
                        OutputWorkspace=self._squaricn + "_ref")

        wks_all_atoms_explicitly = Abins(PhononFile=self._squaricn + ".phonon",
                                         Atoms="H, C, O",
                                         SumContributions=self._sum_contributions,
                                         QuantumOrderEventsNumber=self._quantum_order_events_number,
                                         OutputWorkspace="explicit")

        wks_all_atoms_default = Abins(PhononFile=self._squaricn + ".phonon",
                                      SumContributions=self._sum_contributions,
                                      QuantumOrderEventsNumber=self._quantum_order_events_number,
                                      OutputWorkspace="default")

        # Python 3 has no guarantee of dict order so the workspaces in the group may be in
        # a different order on Python 3
        self.assertEqual(wks_all_atoms_explicitly.size(), wks_all_atoms_default.size())
        explicit_names = wks_all_atoms_explicitly.getNames()
        for i in range(len(explicit_names)):
            explicit_name = explicit_names[i]
            default_name = "default" + explicit_name[8:]
            (result, messages) = CompareWorkspaces(explicit_name, default_name,
                                                   Tolerance=self._tolerance)
            self.assertEqual(result, True)

        self.assertEqual(wrk_ref.size(), wks_all_atoms_default.size())
        ref_names = wrk_ref.getNames()
        for i in range(len(ref_names)):
            ref_name = ref_names[i]
            default_name = "default" + ref_name[len(self._squaricn + "_ref"):]
            (result, messages) = CompareWorkspaces(ref_name, default_name,
                                                   Tolerance=self._tolerance)
            self.assertEqual(result, True)
    def test_partial(self):
        # By default workspaces for all atoms should be created. Test this default behaviour.

        experimental_file = ""

        wrk_ref = Abins(AbInitioProgram=self._ab_initio_program,
                        VibrationalOrPhononFile=self._squaricn + ".phonon",
                        ExperimentalFile=experimental_file,
                        TemperatureInKelvin=self._temperature,
                        SampleForm=self._sample_form,
                        Instrument=self._instrument_name,
                        Atoms=self._atoms,
                        Scale=self._scale,
                        SumContributions=self._sum_contributions,
                        QuantumOrderEventsNumber=self._quantum_order_events_number,
                        ScaleByCrossSection=self._cross_section_factor,
                        OutputWorkspace=self._squaricn + "_ref")

        wks_all_atoms_explicitly = Abins(VibrationalOrPhononFile=self._squaricn + ".phonon",
                                         Atoms="H, C, O",
                                         SumContributions=self._sum_contributions,
                                         QuantumOrderEventsNumber=self._quantum_order_events_number,
                                         OutputWorkspace="explicit")

        wks_all_atoms_default = Abins(VibrationalOrPhononFile=self._squaricn + ".phonon",
                                      SumContributions=self._sum_contributions,
                                      QuantumOrderEventsNumber=self._quantum_order_events_number,
                                      OutputWorkspace="default")

        # Python 3 has no guarantee of dict order so the workspaces in the group may be in
        # a different order on Python 3
        self.assertEqual(wks_all_atoms_explicitly.size(), wks_all_atoms_default.size())
        explicit_names = wks_all_atoms_explicitly.getNames()
        for i in range(len(explicit_names)):
            explicit_name = explicit_names[i]
            default_name = "default" + explicit_name[8:]
            (result, messages) = CompareWorkspaces(explicit_name, default_name,
                                                   Tolerance=self._tolerance)
            self.assertEqual(result, True)

        self.assertEqual(wrk_ref.size(), wks_all_atoms_default.size())
        ref_names = wrk_ref.getNames()
        for i in range(len(ref_names)):
            ref_name = ref_names[i]
            default_name = "default" + ref_name[len(self._squaricn + "_ref"):]
            (result, messages) = CompareWorkspaces(ref_name, default_name,
                                                   Tolerance=self._tolerance)
            self.assertEqual(result, True)