Default value for b_iso_or_equiv, better sorting of atoms

This commit is contained in:
Maarten L. Hekkelman
2025-04-09 15:12:11 +02:00
parent 89a3ea4e24
commit 2f3514689d
2 changed files with 11 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
Version 8.0.1
- Fix cif::mm::structure::cleanup_empty_categories, removed too much
- Add default value for B_iso_or_equiv in residue::create_new_atom
Version 8.0.0
- A dictionary is for a datablock and a file can have

View File

@@ -376,6 +376,7 @@ atom residue::create_new_atom(atom_type inType, const std::string &inAtomID, poi
{ "auth_comp_id", m_compound_id },
{ "auth_seq_id", m_auth_seq_id },
{ "occupancy", 1.0f, 2 },
{ "B_iso_or_equiv", 20.0f },
{ "pdbx_PDB_model_num", m_structure->get_model_nr() },
});
@@ -2915,6 +2916,14 @@ static int compare_numbers(std::string_view a, std::string_view b)
return result;
}
int compare_cif_id(const std::string &a, const std::string &b)
{
int d = a.length() - b.length();
if (d == 0)
d = a.compare(b);
return d;
}
void structure::reorder_atoms()
{
auto &atom_site = m_db["atom_site"];
@@ -2926,7 +2935,7 @@ void structure::reorder_atoms()
// First by model number
d = a.get<int>("pdbx_PDB_model_num") - b.get<int>("pdbx_PDB_model_num");
if (d == 0)
d = a.get<std::string>("label_asym_id").compare(b.get<std::string>("label_asym_id"));
d = compare_cif_id(a.get<std::string>("label_asym_id"), b.get<std::string>("label_asym_id"));
if (d == 0)
{
auto na = a.get<std::optional<int>>("label_seq_id");