Skip to content

Conversation

@jodavies
Copy link
Collaborator

@jodavies jodavies commented Jan 8, 2026

Here are a few fixes for the (interface to) grcc.

  1. Don't print symmetry factors in the output for TopologiesOnly_ mode.
  2. Don't allow numbers for couplings in Vertex definitions. It produces an empty argument ,, in the node_ output, and anyway crashes for quartic vertices. The manual will need an update to reflect this, but it will be re-written as a separate PR.
  3. Don't allow negative coupling powers, these were silently ignored before by discarding the sign.

The manual (currently) states that "The coupling constant is either
the number 1, or a (product of) symbol(s) to an integer power. If
the symbols have not been declared before they will be declared
during the reading of the vertex declaration.".

However, "1" causes empty arguments to be printed in node_ functions,
numbers other than "1" are accepted, and it doesn't work at all for
vertices with four or more legs.

Since the user can modify the couplings as they wish after diagram
generation with replace_ etc, demand symbols in the Vertex definition.
These are not accepted by grcc.cc anyway, so print a more useful
error and terminate.
@coveralls
Copy link

coveralls commented Jan 8, 2026

Coverage Status

coverage: 53.336% (-0.004%) from 53.34%
when pulling f48061b on jodavies:grcc-fixes
into 73a6a14 on form-dev:master.

If compiling as part of FORM, call FORM's Terminate rather than exit.
@tueda
Copy link
Collaborator

tueda commented Jan 9, 2026

As far as I understand, MesPrint is not thread-safe. It might be better to call M(UN)LOCK(ErrorMessageLock) inside grcc_fprintf to acquire the lock.

Ideally, the lock should be taken by the caller at a higher level, but doing so would likely be too cumbersome and undermine the goal of keeping this a thin wrapper.

@jodavies
Copy link
Collaborator Author

jodavies commented Jan 9, 2026

Ah yes, I forgot to include the locks. I'll add them in. There are also various error messages which are split over multiple calls of fprintf, where the first has no newline, which via MesPrint will go onto multiple lines. This could be improved by consolidating them into a single function call, but maybe we don't care so much about the formatting, as along as the information is at least in the log file.

When compiling under FORM, we can format the output with vsnprintf,
and then just give the formatted string to MesPrint, such that it ends
up in the FORM log file.

When compiling without FORM, just forward the format string and the
args to vfprintf, which prints them as previously.
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 this pull request may close these issues.

3 participants