5723 mDatablock.set_validator(result.get_validator());
5732 ParsePrimaryStructure();
5735 ConstructEntities();
5739 ParseSecondaryStructure();
5740 ParseConnectivtyAnnotation();
5741 ParseMiscellaneousFeatures();
5742 ParseCrystallographic();
5743 ParseCoordinateTransformation();
5745 uint32_t modelNr = 1;
5746 bool hasAtoms =
false;
5748 while (mRec->is(
"MODEL ")
or mRec->is(
"ATOM ")
or mRec->is(
"HETATM"))
5751 if (mRec->is(
"MODEL "))
5755 modelNr = vI(11, 14);
5760 hasAtoms = hasAtoms
or mRec->is(
"ATOM ")
or mRec->is(
"HETATM");
5762 ParseCoordinate(modelNr);
5766 Match(
"ENDMDL",
true);
5772 throw std::runtime_error(
"Either the PDB file has no atom records, or the field " + std::string(mRec->mName) +
" is not at the correct location");
5774 for (
auto e : mAtomTypes)
5775 getCategory(
"atom_type")->emplace({
5779 getCategory(
"atom_type")->reorder_by_index();
5788 auto r = FindRecord(
"REMARK 3");
5790 if (r !=
nullptr and Remark3Parser::parse(mExpMethod, r, mDatablock))
5793 auto exptl = getCategory(
"exptl");
5797 {
"entry_id", mStructureID },
5798 {
"method", mExpMethod },
5799 {
"crystals_number", mRemark200[
"NUMBER OF CRYSTALS USED"] } });
5803 catch (
const std::exception &ex)
5806 std::cerr <<
"Error parsing REMARK 3" << std::endl;
5836 using namespace cif::literals;
5838 auto &atom_site = *getCategory(
"atom_site");
5840 for (
auto r : getCategory(
"struct_conn")->
find(
"pdbx_dist_value"_key == 0
or "pdbx_dist_value"_key == cif::null))
5842 const auto &[asym1, seq1, atom1, symm1, asym2, seq2, atom2, symm2] = r.get<std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string>(
5843 "ptnr1_label_asym_id",
"ptnr1_label_seq_id",
"ptnr1_label_atom_id",
"ptnr1_symmetry",
5844 "ptnr2_label_asym_id",
"ptnr2_label_seq_id",
"ptnr2_label_atom_id",
"ptnr2_symmetry");
5850 auto a1 = atom_site.find1(
"label_asym_id"_key == asym1 and
"label_seq_id"_key == seq1 and
"label_atom_id"_key == atom1);
5851 auto a2 = atom_site.find1(
"label_asym_id"_key == asym2 and
"label_seq_id"_key == seq2 and
"label_atom_id"_key == atom2);
5853 if (not a1
or not a2)
5854 throw std::runtime_error(
"cannot find atom");
5856 const auto &[x1, y1, z1] = a1.get<float, float,
float>(
"cartn_x",
"cartn_y",
"cartn_z");
5857 const auto &[x2, y2, z2] = a2.get<float, float,
float>(
"cartn_x",
"cartn_y",
"cartn_z");
5859 if ((symm1.empty()
or symm1 ==
"1_555") and (symm2.empty()
or symm2 ==
"1_555"))
5861 (x1 - x2) * (x1 - x2) +
5862 (y1 - y2) * (y1 - y2) +
5863 (z1 - z2) * (z1 - z2)
5866 std::cerr <<
"Cannot calculate distance for link since one of the atoms is in another dimension" << std::endl;
5868 catch (std::exception &ex)
5871 std::cerr <<
"Error finding atom for LINK distance calculation: " << ex.what() << std::endl;
5877 result.emplace_back(std::move(mDatablock));
5879 catch (
const std::exception &ex)
5883 std::cerr <<
"Error parsing PDB";
5884 if (mRec !=
nullptr)
5885 std::cerr <<
" at line " << mRec->mLineNr;
5886 std::cerr << std::endl;
void sqrt(Image< double > &op)
std::vector< SelLine >::iterator find(std::vector< SelLine > &text, const std::string &img_name)
TYPE distance(struct Point_T *p, struct Point_T *q)