-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.h
More file actions
74 lines (52 loc) · 1.46 KB
/
atom.h
File metadata and controls
74 lines (52 loc) · 1.46 KB
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
#ifndef ATOM_H
#define ATOM_H
#include "vector3.h"
#include <vector>
#include <unordered_set>
constexpr double dt = 1e-6;
class Atom;
struct Bond {
Atom* partner;
int order; // Single bond: 1, triple bond: 3
};
struct LonePair {
Vector3 relativePos; // s.t. AtomPos + relativePos = ElectronPos
};
class Atom {
public:
// Assigned system values
int atomID;
int moleculeID;
int AtomicNumber;
Vector3 pos;
Vector3 vel;
Vector3 force;
double charge;
double velocityloss_pertick;
std::vector<Bond> bonds; // Useful for iterating through
std::unordered_set<Atom*> bondsSet; // Same as bonds, but useful for faster lookup times
double mass;
double covalentRadius;
double vdw_radius; // Van der Waals radius
double electronegativity;
int maxbonds;
int valency;
int valenceVacancies;
LonePair lonePairs[4]; // Any atom can only have, at most, 8 valence electrons, therefore 4 is the maximum no. lone pairs
int numLonePairs; // Number of lone pairs present
int brownianNoiseIndex;
Atom(
int AtomicNumber,
Vector3 pos, // Position
Vector3 vel, // Velocity
double charge,
double velocityloss_pertick
);
void update();
void bondWith(Atom* atom);
void breakWith(Atom* atom);
void spawnLonePairs();
std::vector<double> getLPPositions() const;
bool isBondedWith(Atom* atom) const;
};
#endif