-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAction_Closest.h
53 lines (48 loc) · 2.28 KB
/
Action_Closest.h
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
#ifndef INC_ACTION_CLOSEST_H
#define INC_ACTION_CLOSEST_H
#include "ImagedAction.h"
#include "Topology.h"
#include "ArgList.h"
// NOTE: Simplified version of Action_Closest for testing with GPU code.
/// Modify the state so that only the closest solvent molecules are kept.
class Action_Closest {
public:
Action_Closest();
void Help() const;
enum RetType { OK, ERR, USE_ORIGINAL_FRAME, SUPPRESS_COORD_OUTPUT,
SKIP, MODIFY_TOPOLOGY, MODIFY_COORDS };
RetType Init(ArgList&, int);
RetType Setup(Topology const&, CoordinateInfo const&);
RetType DoAction(int, Frame&);
private:
//faster routines - pulling out divergent code
void Action_NoImage(Frame& frmIn,double maxD);
void Action_ImageOrtho(Frame& frmIn, double maxD);
void Action_ImageNonOrtho(Frame& frmIn, double maxD, Matrix_3x3 ucell, Matrix_3x3 recip);
bool cuda_action_center(Frame& frmIn, double maxD, Matrix_3x3 ucell, Matrix_3x3 recip,int type, float &time_gpu);
bool cuda_action_no_center(Frame& frmIn, double maxD, Matrix_3x3 ucell, Matrix_3x3 recip,int type, float &time_gpu);
ImagedAction image_; ///< Imaging routines.
int closestWaters_; ///< Closest # of molecules to keep.
bool firstAtom_; ///< If true just calc based on molecule first atom.
bool useMaskCenter_; ///< If true use geometric center of mask.
AtomMask distanceMask_; ///< Mask of atoms to calculate distance from solvent to.
int NsolventMolecules_; ///< # of solvent molecules in SolventMols.
int debug_;
typedef std::vector<int> Iarray;
/** The moldist structure is used in order to preserve the original
* solvent molecule numbers after sorting. */
struct MolDist {
int mol; ///< Original solvent molecule number (starts from 1).
double D; ///< Closest distance of solvent molecule to atoms in distanceMask.
AtomMask mask; ///< Original topology solvent molecule atom mask.
Iarray solventAtoms; ///< Actual solvent atom #s to loop over.
};
/// Return true if the first molecule is closer than the second
struct moldist_cmp {
inline bool operator()(MolDist const& first, MolDist const& second) const {
return (first.D < second.D);
}
};
std::vector<MolDist> SolventMols_;
};
#endif