Skip to content

Commit 347566a

Browse files
committed
mmcif: reading TLS: don't require _pdbx_refine_tls.pdbx_refine_id
because this item makes no sense and it's absent in mmcif from Refmac
1 parent 7b8d47b commit 347566a

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/mmcif.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -606,26 +606,31 @@ Structure make_structure_from_block(const cif::Block& block_) {
606606
}
607607

608608
for (auto row : block.find("_pdbx_refine_tls.", {
609-
"pdbx_refine_id", "id",
609+
"id", "?pdbx_refine_id",
610610
"T[1][1]", "T[2][2]", "T[3][3]", "T[1][2]", "T[1][3]", "T[2][3]",
611611
"L[1][1]", "L[2][2]", "L[3][3]", "L[1][2]", "L[1][3]", "L[2][3]",
612612
"S[1][1]", "S[1][2]", "S[1][3]",
613613
"S[2][1]", "S[2][2]", "S[2][3]",
614614
"S[3][1]", "S[3][2]", "S[3][3]",
615615
"origin_x", "origin_y", "origin_z"})) {
616-
if (RefinementInfo* ref = get_by_id(st.meta.refinement, row.str(0))) {
617-
ref->tls_groups.emplace_back();
618-
TlsGroup& tls = ref->tls_groups.back();
619-
tls.id = row.str(1);
620-
tls.T = get_smat33<double>(row, 2);
621-
tls.L = get_smat33<double>(row, 8);
622-
for (int i = 0; i < 3; ++i)
623-
for (int j = 0; j < 3; ++j)
624-
tls.S[i][j] = cif::as_number(row[14+3*i+j]);
625-
tls.origin.x = cif::as_number(row[23]);
626-
tls.origin.y = cif::as_number(row[24]);
627-
tls.origin.z = cif::as_number(row[25]);
628-
}
616+
if (st.meta.refinement.empty())
617+
break;
618+
RefinementInfo* ref = nullptr;
619+
if (row.has(1))
620+
ref = get_by_id(st.meta.refinement, row.str(1));
621+
if (!ref)
622+
ref = &st.meta.refinement[0];
623+
ref->tls_groups.emplace_back();
624+
TlsGroup& tls = ref->tls_groups.back();
625+
tls.id = row.str(0);
626+
tls.T = get_smat33<double>(row, 2);
627+
tls.L = get_smat33<double>(row, 8);
628+
for (int i = 0; i < 3; ++i)
629+
for (int j = 0; j < 3; ++j)
630+
tls.S[i][j] = cif::as_number(row[14+3*i+j]);
631+
tls.origin.x = cif::as_number(row[23]);
632+
tls.origin.y = cif::as_number(row[24]);
633+
tls.origin.z = cif::as_number(row[25]);
629634
}
630635
for (auto row : block.find("_pdbx_refine_tls_group.", {
631636
"refine_tls_id", "?beg_auth_asym_id", "?beg_auth_seq_id", "?beg_PDB_ins_code",

src/to_mmcif.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,9 @@ void update_mmcif_block(const Structure& st, cif::Block& block, MmcifOutputGroup
12001200
add_cif_atoms(st, block, groups.group_pdb, groups.auth_all);
12011201

12021202
if (groups.tls && st.meta.has_tls()) {
1203+
// pdbx_refine_id doesn't make sense here, but it's required
1204+
// by the mmCIF spec. In joint refinement, TLS constraints can't be
1205+
// specific to a dataset, because they constrain the shared model.
12031206
cif::Loop& loop = block.init_mmcif_loop("_pdbx_refine_tls.", {
12041207
"id", "pdbx_refine_id",
12051208
"origin_x", "origin_y", "origin_z",

0 commit comments

Comments
 (0)