Exemplo n.º 1
0
    def test_read_reaction_comments_degeneracy(self):
        """
        Test that the degeneracy is picked up from reading reaction comments.

        Also checks that reaction rate was not modified in the process.
        """
        for index, comment in enumerate(self.comments_list):
            # Clear any leftover kinetics comments
            self.reaction.kinetics.comment = ''
            previous_rate = self.reaction.kinetics.A.value_si
            new_rxn = read_reaction_comments(self.reaction, comment)
            new_rate = new_rxn.kinetics.A.value_si

            self.assertEqual(new_rxn.degeneracy, self.degeneracy_list[index],
                             'wrong degeneracy was stored')
            self.assertEqual(previous_rate, new_rate)

            # Check that the comment only appears once in the kinetics comment
            if new_rxn.degeneracy != 1:
                self.assertEqual(
                    new_rxn.kinetics.comment.count(
                        'Multiplied by reaction path degeneracy {}'.format(
                            new_rxn.degeneracy)), 1,
                    'Reaction degeneracy comment duplicated while reading Chemkin comments'
                )
            else:
                self.assertTrue('Multiplied by reaction path degeneracy' not in
                                new_rxn.kinetics.comment)
Exemplo n.º 2
0
    def test_read_reaction_comments_family(self):
        """
        Test that the family is picked up from reading reaction comments.
        """
        for index, comment in enumerate(self.comments_list):
            new_rxn = read_reaction_comments(self.reaction, comment)

            self.assertEqual(new_rxn.family, self.family_list[index], 'wrong reaction family stored')
Exemplo n.º 3
0
    def test_read_reaction_comments_template(self):
        """
        Test that the template is picked up from reading reaction comments.
        """
        for index, comment in enumerate(self.comments_list):
            new_rxn = read_reaction_comments(self.reaction, comment)

            # only check template if meant to find one
            if self.template_list[index]:
                self.assertTrue(new_rxn.template,
                                'The template was not saved from the reaction comment {}'.format(comment))
                self.assertEqual(frozenset(new_rxn.template), frozenset(self.template_list[index]),
                                 'The reaction template does not match')
            else:
                self.assertFalse(new_rxn.template)