Example #1
0
 def test_lagrange_exists(self):
     Abins(AbInitioProgram=self._ab_initio_program,
           VibrationalOrPhononFile=(self._squaricn + ".phonon"),
           TemperatureInKelvin=self._temperature,
           SampleForm=self._sample_form,
           Instrument="Lagrange",
           Setting="Cu(331) (Lagrange)",
           Atoms=self._atoms,
           Scale=self._scale,
           SumContributions=self._sum_contributions,
           QuantumOrderEventsNumber=self._quantum_order_events_number,
           ScaleByCrossSection=self._cross_section_factor,
           OutputWorkspace="squaricn-lagrange")
Example #2
0
 def case_restart_diff_order(self, order=None):
     """
     The considered testing scenario looks as follows. First calculations are performed for
     self._quantum_order_event. Then calculations are performed for order (different quantum order event). In case
     order >  self._quantum_order_event then S should be calculated. Otherwise, it will be loaded from an hdf file.
     :param order: number of quantum order event for which restart should be done.
     """
     self.case_from_scratch()
     DeleteWorkspace(self._output_name)
     Abins(DFTprogram=self._dft_program, PhononFile=self._system_name + self._extension[self._dft_program],
           Temperature=self._temperature, SampleForm=self._sample_form, Instrument=self._instrument_name,
           Atoms=self._atoms, SumContributions=self._sum_contributions, Scale=self._scale,
           QuantumOrderEventsNumber=str(order), ScaleByCrossSection=self._cross_section_factor,
           OutputWorkspace=self._output_name)
    def test_good_case(self):
        good_names = [
            self._wrk_name, self._wrk_name + "_Si",
            self._wrk_name + "_Si_total"
        ]
        Abins(VibrationalOrPhononFile=self._Si2 + ".phonon",
              OutputWorkspace=self._wrk_name)
        names = mtd.getObjectNames()

        # Builtin cmp has been removed in Python 3
        def _cmp(a, b):
            return (a > b) - (a < b)

        self.assertAlmostEqual(0, _cmp(good_names, names))
Example #4
0
    def test_scale(self):
        """
        Test if scaling is correct.
        @return:
        """
        wrk_ref = Abins(
            AbInitioProgram=self._ab_initio_program,
            VibrationalOrPhononFile=self._squaricn + ".phonon",
            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")

        wrk = Abins(AbInitioProgram=self._ab_initio_program,
                    VibrationalOrPhononFile=self._squaricn + ".phonon",
                    TemperatureInKelvin=self._temperature,
                    SampleForm=self._sample_form,
                    Instrument=self._instrument_name,
                    Atoms=self._atoms,
                    SumContributions=self._sum_contributions,
                    QuantumOrderEventsNumber=self._quantum_order_events_number,
                    Scale=10,
                    ScaleByCrossSection=self._cross_section_factor,
                    OutputWorkspace="squaricn_scale")

        ref = Scale(wrk_ref, Factor=10)

        (result, messages) = CompareWorkspaces(wrk,
                                               ref,
                                               Tolerance=self._tolerance)
        self.assertEqual(result, True)
Example #5
0
 def case_from_scratch(self):
     """
     User performs calculation from scratch (not loaded from hdf file). All data is calculated.
     """
     Abins(AbInitioProgram=self._ab_initio_program,
           VibrationalOrPhononFile=self._system_name +
           self._extension[self._ab_initio_program],
           TemperatureInKelvin=self._temperature,
           SampleForm=self._sample_form,
           Instrument=self._instrument_name,
           BinWidthInWavenumber=self._bin_width,
           Atoms=self._atoms,
           SumContributions=self._sum_contributions,
           QuantumOrderEventsNumber=str(self._quantum_order_event),
           Scale=self._scale,
           ScaleByCrossSection=self._cross_section_factor,
           OutputWorkspace=self._output_name)