Is there a program or a website able to perform all Wick contractions for a given expression?

Imagine I have an expression of the type:

$$\langle \phi_{x_1} \phi_{x_1} \phi_{x_2} \phi_{x_2} \phi_{z_1} \phi_{z_1} A_{z_1} \phi_{z_2} \phi_{z_2} A_{z_2} \phi_{z_3} \phi_{z_3} A_{z_3} \phi_{z_4} \phi_{z_4} A_{z_4} \rangle \tag{1}$$

with $$\phi_{x_i}:= \phi(x_i)$$, and I would like to know all the ways to Wick contract that are possible. Is there a program or some online calculator that can do that, starting from an expression like $$(1)$$?

Added: and it would be so great if it could also allow to remove self-energy contractions from the results!

Before answering, please see our policy on resource recommendation questions. Please write substantial answers that detail the style, content, and prerequisites of the book, paper or other resource. Explain the nature of the resource so that readers can decide which one is best suited for them rather than relying on the opinions of others. Answers containing only a reference to a book or paper will be removed!

• What does $\phi_{z_1}$ mean? – G. Smith Aug 26 at 0:37
• @G.Smith I have added some detail in the post. It means a scalar field at position $z_1$. – Jxx Aug 26 at 9:50
• Are we to also assume that $\phi_1$ and $\phi_2$ are different from $\phi$? – probably_someone Aug 26 at 11:44
• @probably_someone No, those are the same fields at different points (I've edited the post again). But my question would still be the same regardless of which fields are in $(1)$, I only wanted to give an example of an expectation value where it is tedious to do Wick contractions manually. – Jxx Aug 26 at 11:52

Although not being exactly conceived in the way that I intended in the question, the program FeynArts for Mathematica does exactly what I need with Feynman graphs. You can give Feynman rules, and use the function ExcludeTopologies for keeping only the vertices in which you are interested. In my example above I would exclude all vertices except the 3-point couplings between one $$A$$ and two $$\phi$$'s, and ask FeynArts for all 1-loop graphs. The result is the same as taking all the possible (connected) Wick contractions of $$(1)$$. The ExcludeTopologies feature can also be used for excluding self-energy graphs as well as tadpoles.