before you can change boundaries from periodic to non-periodic without breaking bonds, you have to make certain, that are are no bonds crossing periodic boundaries. as simple as that. in other words, you first have to "disentangle" your system, so that all atoms are inside the same periodic image. for example, you can try to increase your box in that dimension (without changing atom positions) until there is a sufficient separation between the periodic images.
that said, it is probably simpler to start your simulation with s p p boundaries from the very beginning, or when you are using p p p, then you need to insert some kind of barrier that prevents crossings. what is the reason to do a fully periodic simulation first?
p.s.: giacomo, this *is* a different question.