File: SimpleProteinManager.cpp

package info (click to toggle)
ausaxs 1.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 72,592 kB
  • sloc: cpp: 49,853; ansic: 6,901; python: 730; makefile: 18
file content (29 lines) | stat: -rw-r--r-- 1,287 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: LGPL-3.0-or-later
// Author: Kristian Lytje

#include <em/manager/SimpleProteinManager.h>
#include <hist/histogram_manager/HistogramManagerMT.h>
#include <data/Molecule.h>
#include <utility/Exceptions.h>
#include <utility/Logging.h>
#include <data/Body.h>

using namespace ausaxs;

void em::managers::SimpleProteinManager::update_protein(double cutoff) {
    logging::log("SimpleProteinManager::update_protein: cutoff = " + std::to_string(cutoff));
    auto atoms = generate_atoms(cutoff);

    // this sorting step is principially not necessary, but required for consistency with SmartProteinManager
    // otherwise we may see tiny differences in the generated hydration shells which breaks the tests
    std::sort(
        atoms.begin(), 
        atoms.end(), 
        [] (const data::EMAtom& atom1, const data::EMAtom& atom2) {return atom1.charge_density() < atom2.charge_density();}
    );

    std::vector<data::AtomFF> converted(atoms.size());
    std::transform(atoms.begin(), atoms.end(), converted.begin(), [] (const data::EMAtom& atom) {return atom.get_atom_ff();});
    protein = std::make_unique<data::Molecule>(std::vector{data::Body{converted}});
    protein->set_histogram_manager(settings::hist::HistogramManagerChoice::HistogramManagerMT);
}