How to retrive all formula for materials without specific element at a fixed spacegroup?

I want to screen all components at a fixed atomical ratio with a same spacegroup.
For example, spacegroup:cmcm, the ratio: 1:1:1. the element is all.
How can I do that with pymatgen?

There are two things you want to use in conjunction here. The first is that you want to fix the spacegroup which you can do by filtering for spacegroup with a query string like this:
{"spacegroup.number": 2}
If you want multiple spacegroups you can use something like this:
{"spacegroup.number": {"$in": [2,3]}}

The second part is fixing the ratio of three elements to 1:1:1, you can use our anonymized formulas like this:
{"formula_anonymous": "ABC"}

Together the mpquery would look like this:
{"spacegroup.number": {"$in": [2,3]}, "formula_anonymous": "ABC"}

This is something you would query Materials Project using the MPRester in pymatgen or directly on the website.

OKļ¼Œthank you very much. And I found another way, which is used by spacegroup.symbol,nelements and nsites. I have tried both ways, and obtained the same results.
Sharing this method with you. Ha~~