~sfiorucci/ptools/test_seb

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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/****************************************************************************
 *   Copyright (C) 2008   Adrien Saladin                                    *
 *   adrien.saladin@gmail.com                                               *
 *   Copyright (C) 2008   Pierre Poulain                                    *
 *   Copyright (C) 2008   Sebastien Fiorucci                                *
 *   Copyright (C) 2008   Chantal Prevost                                   *
 *   Copyright (C) 2008   Martin Zacharias                                  *
 *                                                                          *
 *   This program is free software: you can redistribute it and/or modify   *
 *   it under the terms of the GNU 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 General Public License for more details.                           *
 *                                                                          *
 *   You should have received a copy of the GNU General Public License      *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
 *                                                                          *
 *                                          *
 ***************************************************************************/



#ifndef _ATTRACTRIGIDBODY_H_
#define _ATTRACTRIGIDBODY_H_

#include "rigidbody.h"

namespace PTools{


/*! \brief Rigidbody specific to Attract's reduced model
*
*   this objects stores "atom type number" property
*   which is required for Attract's forcefields and for
*   some attract's specific pairlist
*/
class AttractRigidbody: public Rigidbody
{
public:
    explicit AttractRigidbody(const Rigidbody & rig) ; ///< initilize a new object from a regular Rigidbody object
    AttractRigidbody(){};
    AttractRigidbody(const std::string& filename);

    virtual ~AttractRigidbody(){};

    uint getAtomTypeNumber(uint i) const
    {
        return m_atomTypeNumber[i];
    };
    dbl getCharge(uint i) const
    {
        return m_charge[i];
    };

    virtual bool isAtomActive(uint i) const {

       uint atomtype = this->m_atomTypeNumber[i];
       for(uint j=0; j<m_dummytypes.size(); j++)
         if(m_dummytypes[j]==atomtype)
               return false;
       return true; 
    };


    void resetForces()
    {
        m_forces = std::vector<Coord3D> (this->Size() ) ;
    }

    void addForces(const std::vector<Coord3D>& forces)
    {
        for (uint i=0; i<forces.size(); i++)
            m_forces[i]+=forces[i];
    }


    void setRotation(bool value) {hasrotation  = value;} ///< allow/disallow rotation
    void setTranslation(bool value) {hastranslation = value;} ///< allow/disallow translation

    void setDummyTypes(const std::vector<uint>& dummy); ///< set a list of ignored atom types

    bool operator==(const AttractRigidbody& at) {return false;}; //don't use it, needed to expose vector<AttractRigidobdy> to python by boost::vector indexing suite. 

    void updateActiveList();

private:

    void init_();

    std::vector<uint> m_atomTypeNumber ;
    std::vector<dbl> m_charge ;
    std::vector<Coord3D> m_forces ;

    std::vector<uint> m_dummytypes; ///< list of ignored atom types
    std::vector<uint> m_activeAtoms; ///< list of active atoms (atoms that are taken into account for interaction)

    bool hastranslation;
    bool hasrotation;

    friend class BaseAttractForceField;
    friend class AttractForceField2;
    friend class AttractForceField1;
    friend class McopForceField;


};  //end class AttractRigid


} //end namespace PTools


#endif