Please read and follow the forum guidelines posted here: Please Read This First: Guidelines and Suggestions for posting LAMMPS questions
Those state that you should always provide information about which LAMMPS version you are using and what platform you are running on, and how you configure/compiled it in case you compiled it yourself.
When I add this to the peptide example, I get the following error:
ERROR: Variable is_monomer: Variable formula compute cannot be invoked before initialization by a run (src/variable.cpp:1737)
Last command: group monomers variable is_monomer
Even if placed after the run, so you are not providing sufficient information here or else you should get the same error. Or you are using an older version of LAMMPS that does not print an error but should.