# Extract quantum numbers from a string of second quantized operators within the SNEG library

I have been exploring the SNEG library. Suppose that after a series of computations I obtain the output:

$$c_{i,j}^\dagger c_{x,y}^\dagger.$$

How can the quantum numbers $$\{i,j\}$$ and $$\{x,y\}$$ be extracted (computationally) from this expression? For example, if the quantum numbers correspond to angular momentum, I would like to write an automated procedure to compute Clebsh-Gordan coefficients.

The simplest code to generate such an output is as follows.

Get["http://nrgljubljana.ijs.si/sneg/sneg.m"]
snegfermionoperators[c]
nc[c[CR, i, j], c[CR, x, y]]

• What would the actual output be? You show the tex formatted expression, but no actual code output. Please give an example of the sort of output you will be working with, in a code block that can be copy and pasted. Thanks! Jan 8, 2022 at 3:16
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Jan 8, 2022 at 4:53
• Replace[Extract[YourExpression, {{1, 2}, {2, 2}}], head_[arg__] :> List[arg], {0, Infinity}] works for the expression you gave, I think. Unless I misunderstood what you are after which may as well be the case since I'm not familiar with any of the maths that you are talking about :) Jan 9, 2022 at 23:58
• The comment provided by @amator2357 solves the problem. Thanks! Jan 11, 2022 at 15:05