Creating Atoms object from the formula

I have an input file of molecular crystals in which I have the formula of the crystal, and then a value for how much this formula repeats itself in the unit cell.
For example
formula C6H8O2
Z 2
which is proceeded by the positions of the atoms. There are naturally 32 positions and when I try to create atoms object from this formula given the positions it gives me error that 32!=16. Is there an easy way to incorporate informations from formula and Z number to reach the correct input for ase Atoms?

Thanks in advance,

So “Z 2” means the formula must be repeated twice, as I understand.

In that case repeat the formula (as a string) twice and pass that when creating Atoms object such that the input formula has the right number of atoms.

1 Like

Tried it, works now. Thank you very much!