Collapse and crystallization in amorphous matrices with encapsulated compounds