diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc index d3a0aa4f1d1f89cf92ed147cbd00f3d194433d0b..8d3afe053b3bd72a58321d9a8128785c4879b221 100644 --- a/modules/io/src/mol/mmcif_writer.cc +++ b/modules/io/src/mol/mmcif_writer.cc @@ -559,12 +559,26 @@ namespace { int num_mon_ids = info.mon_ids.size(); for(auto res: res_list) { int num = res.GetNumber().GetNum(); + char ins_code = res.GetNumber().GetInsCode(); if(num < 1) { std::stringstream ss; - ss << "Cannot perform resnum based alignment with invalid resnum in "; - ss << "residue " << res; + ss << "Try to construct resnum based alignments. Negative residue "; + ss << "numbers are not allowed in this case. Got: "; + ss << num << " in residue " << res; + ss << ". You may set mmcif_conform flag to False to write something "; + ss << "but be aware of the consequences..."; throw ost::io::IOException(ss.str()); - } else if (num > num_mon_ids) { + } + if(ins_code != '\0') { + std::stringstream ss; + ss << "Try to construct resnum based alignments. Insertion codes "; + ss << "are not allowed in this case. Got: "; + ss << ins_code << " in residue " << res; + ss << ". You may set mmcif_conform flag to False to write something "; + ss << "but be aware of the consequences..."; + throw ost::io::IOException(ss.str()); + } + if (num > num_mon_ids) { ++n_beyond; } else { if(info.mon_ids[num-1] == "-") {