Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codegen for susy process fails with "ValueError : not enough values to unpack (expected 2, got 1)" #622

Closed
valassi opened this issue Mar 31, 2023 · 4 comments · Fixed by #624
Assignees

Comments

@valassi
Copy link
Member

valassi commented Mar 31, 2023

The codegen for a susy process fails with "ValueError : not enough values to unpack (expected 2, got 1)"

This is an issue that I just discussed with @oliviermattelaer . IIUC this had also been reported by @nscottnichols in a similar setup. Copying also @zeniheisser for info.

We had a look with Olivier. This comes from the codegen for HRDCOD=1. The issue is that the original code includes not only "parameter = value" but also "if ( condition ) parameter = value".

A first quick fix in model_handling.py could be

         parset_lines = {}
         for line in parset.split('\n'):
+            if line.startswith('if'): continue
             par, parval = line.split(' = ')

However then I get an assert in

        assert( len(pardef_lines) == len(parset_lines) ) # AV sanity check (same number of parameters)

I must look at the unmodified code and see what it gives... with HRDCOD=1 we need constexpr stuff, so the counting of parameters must be handled with care...

@valassi valassi self-assigned this Mar 31, 2023
@valassi
Copy link
Member Author

valassi commented Mar 31, 2023

I have two sort of issues now

First, the error above probably come from this code, which I find puzzling

763 if ( mdl_Mneu2 < 0 )
764 mdl_Wneu2 = -abs( mdl_Wneu2 );
765 if ( mdl_Mneu3 < 0 )
766 mdl_Wneu3 = -abs( mdl_Wneu3 );
767 if ( mdl_Mneu4 < 0 )
768 mdl_Wneu4 = -abs( mdl_Wneu4 );
769 if ( mdl_Mgo < 0 )
770 mdl_Wgo = -abs( mdl_Wgo );

What is the point of saying if ( x < 0 ) x = -abs ( x )? Is this not a tautology?!

Second, I need to understand what the slha.get_block_entry does when there are indices...

34 indices[0] = 3;
35 indices[1] = 3;
36 mdl_Ryu3x3 = slha.get_block_entry( "yu",  indices,  8.928445e-01 );

@nscottnichols
Copy link
Contributor

Just commenting to say, this is indeed the same issue I ran into with a similar setup (after Olivier's changes). You can get to the same issue generating pp_t1t1.

@valassi
Copy link
Member Author

valassi commented Apr 1, 2023

First, the error above probably come from this code, which I find puzzling

763 if ( mdl_Mneu2 < 0 )
764 mdl_Wneu2 = -abs( mdl_Wneu2 );
765 if ( mdl_Mneu3 < 0 )
766 mdl_Wneu3 = -abs( mdl_Wneu3 );
767 if ( mdl_Mneu4 < 0 )
768 mdl_Wneu4 = -abs( mdl_Wneu4 );
769 if ( mdl_Mgo < 0 )
770 mdl_Wgo = -abs( mdl_Wgo );

What is the point of saying if ( x < 0 ) x = -abs ( x )? Is this not a tautology?!

Ouf. More complex than I thought. I read it incorrectly, the code makes sense, they are two different variables M and W. So the code must be included...

In addition, code generation of that snippet is puzzling. It seems to come from super().write_set_parameters([]) with an empty list as argument?... This gives issues elsewhere

@valassi
Copy link
Member Author

valassi commented Apr 1, 2023

Ok at least this one seems easy now that I analysed it better. I just need to replace this whole function

    def write_set_parameters(self, params):
        """Write out the lines of independent parameters"""

        # For each parameter, write name = expr;

        res_strings = []
        for param in params:
            res_strings.append("%s" % param.expr)

        # Correct width sign for Majorana particles (where the width
        # and mass need to have the same sign)        
        for particle in self.model.get('particles'):
            if particle.is_fermion() and particle.get('self_antipart') and \
                   particle.get('width').lower() != 'zero':
                res_strings.append("if (%s < 0)" % particle.get('mass'))
                res_strings.append("%(width)s = -abs(%(width)s);" % \
                                   {"width": particle.get('width')})

        return "\n".join(res_strings)

valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
…o unpack (expected 2, got 1)" madgraph5#622

This comes from the following line (a parameter is set conditionally...)
DEBUG:  line =  if ( mdl_Mneu2 < 0 ) [model_handling.py at line 715]
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
…particles in export_cpp.UFOModelConverterCPP.write_set_parameters madgraph5#622
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
…l ok with no change

This completes the first "susy" patch: now susy_gg_tt can be generated correctly (but it does not build).
In practice, the main (only?) issue it addresses is madgraph5#622

Further patches (susy2 and possibly more) will attempt to fix these builds.

NB: At this stage, CODEGEN is still using the upstream mg5amcnlo without "split_nonidentical_grouping" (PR madgraph5#619 and madgraph5#272)
valassi added a commit to valassi/madgraph4gpu that referenced this issue Apr 3, 2023
…(revert to previous 11 codegen logs for easier rebasing)

Revert "[susy] ** COMPLETE SUSY (PART 1) ** regenerate five processes mad, all ok with no change"
This reverts commit acbe689.

Revert "[susy] regenerate 6 processes SA, all ok with no change"
This reverts commit 806e7d7.
valassi added a commit to mg5amcnlo/mg5amcnlo_cudacpp that referenced this issue Aug 16, 2023
…o unpack (expected 2, got 1)" madgraph5/madgraph4gpu#622

This comes from the following line (a parameter is set conditionally...)
DEBUG:  line =  if ( mdl_Mneu2 < 0 ) [model_handling.py at line 715]
valassi added a commit to mg5amcnlo/mg5amcnlo_cudacpp that referenced this issue Aug 16, 2023
valassi added a commit to mg5amcnlo/mg5amcnlo_cudacpp that referenced this issue Aug 16, 2023
valassi added a commit to mg5amcnlo/mg5amcnlo_cudacpp that referenced this issue Aug 16, 2023
valassi added a commit to mg5amcnlo/mg5amcnlo_cudacpp that referenced this issue Aug 16, 2023
valassi added a commit to mg5amcnlo/mg5amcnlo_cudacpp that referenced this issue Aug 16, 2023
…particles in export_cpp.UFOModelConverterCPP.write_set_parameters madgraph5/madgraph4gpu#622
valassi added a commit to mg5amcnlo/mg5amcnlo_cudacpp that referenced this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants