-
Notifications
You must be signed in to change notification settings - Fork 1
/
h3o.cpp
42 lines (30 loc) · 815 Bytes
/
h3o.cpp
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
#include "h3o.h"
int Hydronium::numHydroniums = 0;
Hydronium::Hydronium () : Molecule()
{
this->Rename("h3o");
this->_moltype = Molecule::H3O;
++numHydroniums;
}
Hydronium::~Hydronium () {
--numHydroniums;
}
void Hydronium::SetAtoms () {
// here's the hydrogen and nitrogen atoms
_o = this->GetAtom(Atom::O);
// now set the 3 hydrogens
Atom_ptr_vec hydrogens;
for (Atom_it it = this->begin(); it != this->end(); it++) {
if (*it == _o) continue;
hydrogens.push_back (*it);
}
_h1 = hydrogens[0];
_h2 = hydrogens[1];
_h3 = hydrogens[2];
// while we're here we may as well also find the N-O bond vectors
_oh1 = _h1->Position() - _o->Position();
_oh2 = _h2->Position() - _o->Position();
_oh3 = _h3->Position() - _o->Position();
this->FixAtoms();
return;
}