39 for (
const std::string& s :
st.raw_remarks) {
46 mmdb::PModel
model2 = mmdb::newModel();
50 mmdb::PChain
chain2 =
model2->CreateChain(chain.name.c_str());
51 for (
const Residue& res : chain.residues) {
52 const char icode[2] = {res.seqid.icode,
'\0'};
53 mmdb::PResidue res2 =
chain2->GetResidueCreate(res.name.c_str(),
57 for (
const Atom& atom : res.atoms) {
58 mmdb::PAtom
atom2 = mmdb::newAtom();
59 const char altloc[2] = {atom.altloc,
'\0'};
60 std::string padded_name = atom.padded_name();
62 if (padded_name.size() < 4)
63 padded_name.resize(4,
' ');
64 atom2->SetAtomName(0, atom.serial, padded_name.c_str(),
65 altloc, res.segment.c_str(), atom.element.uname());
66 atom2->Het = res.het_flag ==
'H';
67 atom2->SetCharge(atom.charge);
68 atom2->SetCoordinates(atom.pos.x, atom.pos.y, atom.pos.z,
69 atom.occ, atom.b_iso);
70 if (atom.aniso.nonzero()) {
71 atom2->u11 = atom.aniso.u11;
72 atom2->u22 = atom.aniso.u22;
73 atom2->u33 = atom.aniso.u33;
74 atom2->u12 = atom.aniso.u12;
75 atom2->u13 = atom.aniso.u13;
76 atom2->u23 = atom.aniso.u23;
77 atom2->WhatIsSet |= mmdb::ASET_Anis_tFSigma;
83 (&res == &chain.residues.back() ||
85 mmdb::PAtom
atom2 = mmdb::newAtom();
87 atom2->serNum = res.atoms.back().serial + 1;
96 st.cell.alpha,
st.cell.beta,
st.cell.gamma, 1);
97 manager->SetSpaceGroup(
st.spacegroup_hm.c_str());
99 auto z =
st.info.find(
"_cell.Z_PDB");
100 if (z !=
st.info.end() && !z->second.empty()) {
101 cryst->Z = std::atoi(z->second.c_str());
102 cryst->WhatIsSet |= mmdb::CSET_ZValue;
104 if (
st.has_origx && !
st.origx.is_identity()) {
106 cryst->WhatIsSet |= mmdb::CSET_OrigMatrix;
108 if (
st.cell.explicit_matrices) {
110 cryst->WhatIsSet |= mmdb::CSET_ScaleMatrix;
112 if (!
st.ncs.empty()) {
115 if (
st.info.find(
"_struct_ncs_oper.id") !=
st.info.end()) {
117 cryst->AddNCSMatrix(
m, v, 1);
119 for (
const NcsOp& op :
st.ncs) {
121 cryst->AddNCSMatrix(
m, v, op.given);