dia_to_sml: copy code across from modeling