7#ifndef GEMMI_MODIFY_HPP_
8#define GEMMI_MODIFY_HPP_
23 for (
size_t i = 0;
i < chain.
residues.size(); ) {
30 std::set<std::string>
names;
31 for (
size_t i = 0;
i < residue.atoms.size(); ) {
32 Atom& atom = residue.atoms[
i];
37 residue.atoms.erase(residue.atoms.begin() +
i);
49 return a.element == El::H || a.element == El::D;
70 atom.
aniso = {0, 0, 0, 0, 0, 0};
81 atom.
aniso = {u, u, u, 0.f, 0.f, 0.f};
100 for (
Residue& res : chain.residues) {
101 for (
Atom& atom : res.atoms)
102 atom.serial = ++serial;
114template<
typename Func>
150 for (
Chain& chain : model.chains)
156 const std::map<std::string, std::string>&
old_new) {
157 auto update = [&
old_new](std::string& name) {
164 update(
aa.atom_name);
167 for (
Chain& chain : model.chains)
168 for (
Residue& res : chain.residues)
170 for (
Atom& atom : res.atoms)
177 for (
size_t i = res.
atoms.size();
i-- != 0; ) {
183 if (atom.
name[0] ==
'H')
200 if (
deut->name[0] ==
'H')
209 for (
auto d = res.
atoms.end();
d-- != res.
atoms.begin(); )
210 if (
d->element ==
El::D) {
212 auto h = res.
atoms.begin();
213 for (;
h != res.
atoms.end(); ++
h)
214 if (
h->element ==
El::H &&
h->pos.approx(
d->pos, 1
e-9))
216 if (
h != res.
atoms.end()) {
218 h->fraction =
h->occ > 0.f ?
d->occ /
h->occ : 0.f;
222 if (
i !=
d &&
i !=
h && (
i->name ==
h->name ||
i->name ==
d->name))
246 st.has_d_fraction =
false;
248 for (
Chain& chain : model.chains)
249 for (
Residue& res : chain.residues)
252 st.has_d_fraction =
true;
260 if (!
st.cell.explicit_matrices || !
st.cell.is_crystal())
263 st.cell.explicit_matrices =
false;
264 st.cell.calculate_properties();
void assign_serial_numbers(Model &model, bool numbered_ter=false)
set atom site serial numbers to 1, 2, ..., optionally leaving gaps for TERs
void remove_anisou(T &obj)
Remove anisotropic ADP.
void remove_alternative_conformations(T &obj)
Remove alternative conformations.
void replace_d_fraction_with_altlocs(Residue &res)
void vector_remove_if(std::vector< T > &v, F &&condition)
bool replace_deuterium_with_fraction(Residue &res)
void process_addresses(Structure &st, Func func)
void rename_chain(Structure &st, const std::string &old_name, const std::string &new_name)
void transform_pos_and_adp(T &obj, const Transform &tr)
apply Transform to both atom's position and ADP
void remove_hydrogens(T &obj)
Remove hydrogens.
void store_deuterium_as_fraction(Structure &st, bool store_fraction)
Hydrogens modelled as H/D mixture (altlocs H and D with the same position and ADP,...
void rename_atom_names(Structure &st, const std::string &res_name, const std::map< std::string, std::string > &old_new)
void standardize_crystal_frame(Structure &st)
Convert coordinates to the standard coordinate system for the unit cell.
void assign_b_iso(T &obj, float b_min, float b_max)
Set isotropic ADP to the range (b_min, b_max).
void ensure_anisou(T &obj)
Set absent ANISOU to value from B_iso.
constexpr double u_to_b()
Represents atom site in macromolecular structure (~100 bytes).
std::vector< Residue > residues
std::vector< Chain > chains
Non-crystallographic symmetry operation (such as in the MTRIXn record)
Coordinates in Angstroms - orthogonal (Cartesian) coordinates.
std::vector< Atom > atoms
SMat33< Real > transformed_by(const Mat33 &m) const