working verision of modify_3D_structure.py