Révision | f0be6da1644b96ca8a27fb4b10f857ceec6d96f1 (tree) |
---|---|
l'heure | 2014-01-05 02:28:30 |
Auteur | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Bugs in the constructor and destructor of ghost atoms are fixed. #32750
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1613 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -58,8 +58,6 @@ Atom::Atom(int index){ | ||
58 | 58 | this->index = index; |
59 | 59 | } |
60 | 60 | |
61 | -Atom::Atom(){} | |
62 | - | |
63 | 61 | Atom::~Atom(){ |
64 | 62 | MallocerFreer::GetInstance()->Free<double>(&this->xyz, CartesianType_end); |
65 | 63 | MallocerFreer::GetInstance()->Free<double>(&this->pxyz, CartesianType_end); |
@@ -163,7 +161,11 @@ double* Atom::GetPxyz() const{ | ||
163 | 161 | |
164 | 162 | void Atom::SetXyz(double x, double y, double z) const{ |
165 | 163 | #ifdef MOLDS_DBG |
166 | - if(this->xyz==NULL) throw MolDSException(this->errorMessageSetXyzCoordinatesNull); | |
164 | + if(this->xyz==NULL){ | |
165 | + printf("xyz\n\n"); | |
166 | + throw MolDSException("aaa"); | |
167 | + //throw MolDSException(this->errorMessageSetXyzCoordinatesNull); | |
168 | + } | |
167 | 169 | #endif |
168 | 170 | xyz[0]= x; xyz[1]= y; xyz[2]= z; |
169 | 171 | } |
@@ -107,7 +107,6 @@ public: | ||
107 | 107 | double GetPm3PddgParameterPa(int paIndex) const; |
108 | 108 | double GetPm3PddgParameterDa(int daIndex) const; |
109 | 109 | protected: |
110 | - Atom(); | |
111 | 110 | double* xyz; // coordinates |
112 | 111 | double* pxyz; // momentum. Note that this is not velocity!! |
113 | 112 | MolDS_base::AtomType atomType; |
@@ -231,6 +230,7 @@ protected: | ||
231 | 230 | double pm3DAlpha; // Table II in ref. [MH_2007] for H, C, N, O, and Table IV in re. [MMHBV_2007] for S. |
232 | 231 | virtual void SetAtomicParameters() = 0; |
233 | 232 | private: |
233 | + Atom(); | |
234 | 234 | std::string errorMessageIonPot; |
235 | 235 | std::string errorMessageAtomType; |
236 | 236 | std::string errorMessageNumberValences; |
@@ -42,6 +42,8 @@ Catom::Catom(int index) : Atom(index){ | ||
42 | 42 | this->SetAtomicParameters(); |
43 | 43 | } |
44 | 44 | |
45 | +Catom::~Catom(){} | |
46 | + | |
45 | 47 | void Catom::SetAtomicParameters(){ |
46 | 48 | this->atomType = C; |
47 | 49 | this->atomicMass = 12.0107*Parameters::GetInstance()->GetGMolin2AU(); |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms{ | ||
22 | 22 | class Catom : virtual public Atom { |
23 | 23 | public: |
24 | 24 | Catom(int index); |
25 | + virtual ~Catom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -45,6 +45,8 @@ Hatom::Hatom(int index) : Atom(index){ | ||
45 | 45 | this->SetAtomicParameters(); |
46 | 46 | } |
47 | 47 | |
48 | +Hatom::~Hatom(){} | |
49 | + | |
48 | 50 | void Hatom::SetAtomicParameters(){ |
49 | 51 | this->atomType = H; |
50 | 52 | this->atomicMass = 1.00794*Parameters::GetInstance()->GetGMolin2AU(); |
@@ -23,6 +23,7 @@ namespace MolDS_base_atoms{ | ||
23 | 23 | class Hatom : virtual public Atom { |
24 | 24 | public: |
25 | 25 | Hatom(int index); |
26 | + virtual ~Hatom(); | |
26 | 27 | protected: |
27 | 28 | void virtual SetAtomicParameters(); |
28 | 29 | private: |
@@ -43,6 +43,8 @@ Liatom::Liatom(int index) : Atom(index){ | ||
43 | 43 | this->SetAtomicParameters(); |
44 | 44 | } |
45 | 45 | |
46 | +Liatom::~Liatom(){} | |
47 | + | |
46 | 48 | void Liatom::SetAtomicParameters(){ |
47 | 49 | this->atomType = Li; |
48 | 50 | this->atomicMass = 6.941*Parameters::GetInstance()->GetGMolin2AU(); |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms{ | ||
22 | 22 | class Liatom : virtual public Atom { |
23 | 23 | public: |
24 | 24 | Liatom(int index); |
25 | + virtual ~Liatom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -42,6 +42,8 @@ Natom::Natom(int index) : Atom(index){ | ||
42 | 42 | this->SetAtomicParameters(); |
43 | 43 | } |
44 | 44 | |
45 | +Natom::~Natom(){} | |
46 | + | |
45 | 47 | void Natom::SetAtomicParameters(){ |
46 | 48 | this->atomType = N; |
47 | 49 | this->atomicMass = 14.00674*Parameters::GetInstance()->GetGMolin2AU(); |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms{ | ||
22 | 22 | class Natom : virtual public Atom { |
23 | 23 | public: |
24 | 24 | Natom(int index); |
25 | + virtual ~Natom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -42,6 +42,8 @@ Oatom::Oatom(int index) : Atom(index){ | ||
42 | 42 | this->SetAtomicParameters(); |
43 | 43 | } |
44 | 44 | |
45 | +Oatom::~Oatom(){} | |
46 | + | |
45 | 47 | void Oatom::SetAtomicParameters(){ |
46 | 48 | this->atomType = O; |
47 | 49 | this->atomicMass = 15.9994*Parameters::GetInstance()->GetGMolin2AU(); |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms{ | ||
22 | 22 | class Oatom : virtual public Atom { |
23 | 23 | public: |
24 | 24 | Oatom(int index); |
25 | + virtual ~Oatom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -42,6 +42,8 @@ Satom::Satom(int index) : Atom(index){ | ||
42 | 42 | this->SetAtomicParameters(); |
43 | 43 | } |
44 | 44 | |
45 | +Satom::~Satom(){} | |
46 | + | |
45 | 47 | void Satom::SetAtomicParameters(){ |
46 | 48 | this->atomType = S; |
47 | 49 | this->atomicMass = 32.066*Parameters::GetInstance()->GetGMolin2AU(); |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms{ | ||
22 | 22 | class Satom : virtual public Atom { |
23 | 23 | public: |
24 | 24 | Satom(int index); |
25 | + virtual ~Satom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -39,9 +39,12 @@ using namespace std; | ||
39 | 39 | using namespace MolDS_base; |
40 | 40 | using namespace MolDS_base_atoms; |
41 | 41 | namespace MolDS_base_atoms_ghost{ |
42 | -Ghost::Ghost() : Atom(){ | |
42 | +Ghost::Ghost(int index) : Atom(index){ | |
43 | + this->SetAtomicParameters(); | |
43 | 44 | } |
44 | 45 | |
46 | +Ghost::~Ghost(){} | |
47 | + | |
45 | 48 | void Ghost::SetAtomicParameters(){ |
46 | 49 | this->atomicMass = 0.0; |
47 | 50 | this->coreCharge = 0.0; |
@@ -21,10 +21,12 @@ | ||
21 | 21 | namespace MolDS_base_atoms_ghost{ |
22 | 22 | class Ghost : virtual public MolDS_base_atoms::Atom { |
23 | 23 | public: |
24 | - Ghost(); | |
24 | + Ghost(int index); | |
25 | + virtual ~Ghost(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
29 | + Ghost(); | |
28 | 30 | }; |
29 | 31 | } |
30 | 32 | #endif |
@@ -41,12 +41,13 @@ using namespace std; | ||
41 | 41 | using namespace MolDS_base; |
42 | 42 | using namespace MolDS_base_atoms; |
43 | 43 | namespace MolDS_base_atoms_ghost{ |
44 | -GhostCatom::GhostCatom(int index) : Catom(index),Ghost(){ | |
44 | +GhostCatom::GhostCatom(int index) : Atom(index),Catom(index),Ghost(index){ | |
45 | + this->SetAtomicParameters(); | |
45 | 46 | } |
46 | 47 | |
48 | +GhostCatom::~GhostCatom(){} | |
49 | + | |
47 | 50 | void GhostCatom::SetAtomicParameters(){ |
48 | - Catom::SetAtomicParameters(); | |
49 | - Ghost::SetAtomicParameters(); | |
50 | 51 | this->atomType = ghostC; |
51 | 52 | } |
52 | 53 | } |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms_ghost{ | ||
22 | 22 | class GhostCatom : public MolDS_base_atoms::Catom, public Ghost { |
23 | 23 | public: |
24 | 24 | GhostCatom(int index); |
25 | + ~GhostCatom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -41,12 +41,13 @@ using namespace std; | ||
41 | 41 | using namespace MolDS_base; |
42 | 42 | using namespace MolDS_base_atoms; |
43 | 43 | namespace MolDS_base_atoms_ghost{ |
44 | -GhostHatom::GhostHatom(int index) : Hatom(index),Ghost(){ | |
44 | +GhostHatom::GhostHatom(int index) : Atom(index),Hatom(index),Ghost(index){ | |
45 | + this->SetAtomicParameters(); | |
45 | 46 | } |
46 | 47 | |
48 | +GhostHatom::~GhostHatom(){} | |
49 | + | |
47 | 50 | void GhostHatom::SetAtomicParameters(){ |
48 | - Hatom::SetAtomicParameters(); | |
49 | - Ghost::SetAtomicParameters(); | |
50 | 51 | this->atomType = ghostH; |
51 | 52 | } |
52 | 53 | } |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms_ghost{ | ||
22 | 22 | class GhostHatom : public MolDS_base_atoms::Hatom, public Ghost { |
23 | 23 | public: |
24 | 24 | GhostHatom(int index); |
25 | + ~GhostHatom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -41,9 +41,12 @@ using namespace std; | ||
41 | 41 | using namespace MolDS_base; |
42 | 42 | using namespace MolDS_base_atoms; |
43 | 43 | namespace MolDS_base_atoms_ghost{ |
44 | -GhostLiatom::GhostLiatom(int index) : Liatom(index),Ghost(){ | |
44 | +GhostLiatom::GhostLiatom(int index) : Atom(index),Liatom(index),Ghost(index){ | |
45 | + this->SetAtomicParameters(); | |
45 | 46 | } |
46 | 47 | |
48 | +GhostLiatom::~GhostLiatom(){} | |
49 | + | |
47 | 50 | void GhostLiatom::SetAtomicParameters(){ |
48 | 51 | Liatom::SetAtomicParameters(); |
49 | 52 | Ghost::SetAtomicParameters(); |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms_ghost{ | ||
22 | 22 | class GhostLiatom : public MolDS_base_atoms::Liatom, public Ghost { |
23 | 23 | public: |
24 | 24 | GhostLiatom(int index); |
25 | + ~GhostLiatom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -41,12 +41,13 @@ using namespace std; | ||
41 | 41 | using namespace MolDS_base; |
42 | 42 | using namespace MolDS_base_atoms; |
43 | 43 | namespace MolDS_base_atoms_ghost{ |
44 | -GhostNatom::GhostNatom(int index) : Natom(index),Ghost(){ | |
44 | +GhostNatom::GhostNatom(int index) : Atom(index),Natom(index),Ghost(index){ | |
45 | + this->SetAtomicParameters(); | |
45 | 46 | } |
46 | 47 | |
48 | +GhostNatom::~GhostNatom(){} | |
49 | + | |
47 | 50 | void GhostNatom::SetAtomicParameters(){ |
48 | - Natom::SetAtomicParameters(); | |
49 | - Ghost::SetAtomicParameters(); | |
50 | 51 | this->atomType = ghostN; |
51 | 52 | } |
52 | 53 | } |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms_ghost{ | ||
22 | 22 | class GhostNatom : public MolDS_base_atoms::Natom, public Ghost { |
23 | 23 | public: |
24 | 24 | GhostNatom(int index); |
25 | + ~GhostNatom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -41,12 +41,13 @@ using namespace std; | ||
41 | 41 | using namespace MolDS_base; |
42 | 42 | using namespace MolDS_base_atoms; |
43 | 43 | namespace MolDS_base_atoms_ghost{ |
44 | -GhostOatom::GhostOatom(int index) : Oatom(index),Ghost(){ | |
44 | +GhostOatom::GhostOatom(int index) : Atom(index),Oatom(index),Ghost(index){ | |
45 | + this->SetAtomicParameters(); | |
45 | 46 | } |
46 | 47 | |
48 | +GhostOatom::~GhostOatom(){} | |
49 | + | |
47 | 50 | void GhostOatom::SetAtomicParameters(){ |
48 | - Oatom::SetAtomicParameters(); | |
49 | - Ghost::SetAtomicParameters(); | |
50 | 51 | this->atomType = ghostO; |
51 | 52 | } |
52 | 53 | } |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms_ghost{ | ||
22 | 22 | class GhostOatom : public MolDS_base_atoms::Oatom, public Ghost { |
23 | 23 | public: |
24 | 24 | GhostOatom(int index); |
25 | + ~GhostOatom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |
@@ -41,12 +41,13 @@ using namespace std; | ||
41 | 41 | using namespace MolDS_base; |
42 | 42 | using namespace MolDS_base_atoms; |
43 | 43 | namespace MolDS_base_atoms_ghost{ |
44 | -GhostSatom::GhostSatom(int index) : Satom(index),Ghost(){ | |
44 | +GhostSatom::GhostSatom(int index) : Atom(index),Satom(index),Ghost(index){ | |
45 | + this->SetAtomicParameters(); | |
45 | 46 | } |
46 | 47 | |
48 | +GhostSatom::~GhostSatom(){} | |
49 | + | |
47 | 50 | void GhostSatom::SetAtomicParameters(){ |
48 | - Satom::SetAtomicParameters(); | |
49 | - Ghost::SetAtomicParameters(); | |
50 | 51 | this->atomType = ghostS; |
51 | 52 | } |
52 | 53 | } |
@@ -22,6 +22,7 @@ namespace MolDS_base_atoms_ghost{ | ||
22 | 22 | class GhostSatom : public MolDS_base_atoms::Satom, public Ghost { |
23 | 23 | public: |
24 | 24 | GhostSatom(int index); |
25 | + ~GhostSatom(); | |
25 | 26 | protected: |
26 | 27 | void virtual SetAtomicParameters(); |
27 | 28 | private: |