File size: 1,571 Bytes
10f2621
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#ifndef H_TABIPB_MOLECULE_STRUCT_H
#define H_TABIPB_MOLECULE_STRUCT_H

#include <vector>
#include <string>
#include <fstream>
#include <cstddef>

#include "timer.h"
#include "params.h"

#ifdef TABIPB_APBS
    #include "generic/valist.h"
#endif

struct Timers_Molecule;

class Molecule
{
private:
    const struct Params& params_;
    struct Timers_Molecule& timers_;
    
    std::size_t num_atoms_;
    std::vector<double> coords_;
    std::vector<double> charge_;
    std::vector<double> radius_;

    double coulombic_energy_;

public:
    Molecule(struct Params&, struct Timers_Molecule&);
    ~Molecule() = default;
    
#ifdef TABIPB_APBS
    Molecule(Valist*, struct Params&, struct Timers_Molecule&);
#endif
    
    void build_xyzr_file() const;
    
    std::size_t num_atoms() const { return num_atoms_; };
    double coulombic_energy() const { return coulombic_energy_; };
    const double* coords_ptr() const { return coords_.data(); };
    const double* charge_ptr() const { return charge_.data(); };
    const double* radius_ptr() const { return radius_.data(); };
    
    void compute_coulombic_energy();
    void copyin_to_device() const;
    void delete_from_device() const;
};


struct Timers_Molecule
{
    Timer ctor;
    Timer compute_coulombic_energy;
    Timer build_xyzr_file;
    Timer copyin_to_device;
    Timer delete_from_device;
    
    void print() const;
    std::string get_durations() const;
    std::string get_headers() const;

    Timers_Molecule() = default;
    ~Timers_Molecule() = default;
};

#endif /* H_MOLECULE_STRUCT_H */