SMS: Structural information theory