lpxz: I add the automatic construction of SM from code