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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
/*
* api/atom-pull.hh
*
* Copyright 2020 by Medical Research Council
* Author: Paul Emsley
*
* This file is part of Coot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copies of the GNU General Public License and
* the GNU Lesser General Public License along with this program; if not,
* write to the Free Software Foundation, Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA, 02110-1301, USA.
* See http://www.gnu.org/licenses/
*
*/
#ifndef ATOM_PULL_HH
#define ATOM_PULL_HH
#include <clipper/core/coords.h>
#include "geometry/residue-and-atom-specs.hh"
class atom_pull_info_t {
bool status;
public:
coot::atom_spec_t spec;
clipper::Coord_orth pos;
atom_pull_info_t() { status = false; }
atom_pull_info_t(const coot::atom_spec_t &spec_in, const clipper::Coord_orth &pos_in) :
spec(spec_in), pos(pos_in) {
status = true;
}
void off() { status = false; }
void on() { status = true; }
bool get_status() const { return status; }
// return first false if number on not found
std::pair<bool, int> find_spec(mmdb::PAtom *atoms, int n_atoms) const {
int idx = -1;
bool local_status = false;
if (status) {
for (int iat=0; iat<n_atoms; iat++) {
if (coot::atom_spec_t(atoms[iat]).is_same(spec)) {
idx = iat;
local_status = true;
break;
}
}
}
return std::pair<bool, int> (local_status, idx);
}
};
#endif // ATOM_PULL_HH
|