diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc index d682b13ff7fa5954cba79e3d0aef5562e6edecd5..728c45c34d60f511a8962c6d88300f3b652b383e 100644 --- a/modules/io/src/mol/mmcif_writer.cc +++ b/modules/io/src/mol/mmcif_writer.cc @@ -1402,35 +1402,15 @@ int MMCifWriterEntity::GetAsymIdx(const String& asym_id) const { MMCifWriter::MMCifWriter(const String& filename, const IOProfile& profile): StarWriter(filename), - profile_(profile) { } + profile_(profile), + structure_set_(false) { } void MMCifWriter::SetStructure(const ost::mol::EntityHandle& ent, bool mmcif_conform) { - // tabula rasa - if(atom_type_) { - atom_type_.reset(); - } - if(atom_site_) { - atom_site_.reset(); - } - if(pdbx_poly_seq_scheme_) { - pdbx_poly_seq_scheme_.reset(); - } - if(entity_) { - entity_.reset(); - } - if(struct_asym_) { - struct_asym_.reset(); - } - if(entity_poly_) { - entity_poly_.reset(); - } - if(entity_poly_seq_) { - entity_poly_seq_.reset(); - } - if(chem_comp_) { - chem_comp_.reset(); + if(structure_set_) { + throw ost::io::IOException("SetStructure can be called only once on a " + "given MMCifWriter instance"); } atom_type_ = Setup_atom_type_ptr(); @@ -1483,6 +1463,8 @@ void MMCifWriter::SetStructure(const ost::mol::EntityHandle& ent, this->Push(pdbx_poly_seq_scheme_); this->Push(atom_type_); this->Push(atom_site_); + + structure_set_ = true; } }} // ns diff --git a/modules/io/src/mol/mmcif_writer.hh b/modules/io/src/mol/mmcif_writer.hh index 8a5986387a9549c06af4d9214f2a117c323e105a..3285306bd37d6249d458cdbbfcef35d75f727c43 100644 --- a/modules/io/src/mol/mmcif_writer.hh +++ b/modules/io/src/mol/mmcif_writer.hh @@ -86,6 +86,7 @@ private: StarWriterLoopPtr entity_poly_; StarWriterLoopPtr entity_poly_seq_; StarWriterLoopPtr chem_comp_; + bool structure_set_; }; }} // ns