-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (48 loc) · 2.07 KB
/
Copy pathmain.cpp
File metadata and controls
57 lines (48 loc) · 2.07 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
/**
* Nano Adhesive Dynamics (NAD) simulation
* A simulation framework for modeling adhesion/movement of adhesive nanoparticle in the flow
*
* Please modify "parameters.h" to customize simulation condition
* Please refer to <> for simulation details
*
* @author: Mingqiu Wang (mingqiuw at uci.edu)
* @date: 6/28/2016
*
*/
#include "declaration.h"
using namespace std;
int main() {
if (RESUME) { if (!resume()) exit(2); }
else ini();
// starts integrating Langevin equation
coord frepulsion;
pair<coord, coord> fbond, fshear;
for (unsigned long long step = 0; timeAcc < _timeLimit; ++step, timeAcc += _timeInc) {
if ((activeBonds.size()) || (np.position.z < (_radius + bondCutoff.bondLMax))) {
breakageCheck(activeBonds, bonds, ligands, receptors); // assess bond breakage
formationCheck(availLig, availRec, activeBonds, ligands, receptors); // assess bond formation
frepulsion = Frepulsion(np.position.z); // calculate repulsion force from substrate to nanoparticle
}
else frepulsion = coord{0, 0, 0}; // don't have to check bond and calculate repulsion force if
// no bond and particle is higher than a certain height, which is not able to form bond
fbond = Fbond(activeBonds, bonds, receptors, ligands); // assess bond forces/torques on the nanoparticle
fshear = Fshear(np.position.z); // assess shear force/torque on the nanoparticle
acceleration(fbond, fshear, frepulsion); // calculate accelerations
translation(np.velocity, np.position, np.acc); // translate nanoparticle
rotateLig (ligands, rotate(np.rot_velocity, np.rot_acc), np.position); // rotate nanoparticle
if (!(step%CHECKER)) {
if (ifDetach(np.position)) break;
checkDisplace(step);
}
}
// final recording
writeEndTime();
writeBond();
return 0;
}
/**
* Note that
* 1) the term "receptor" stands for adhesion molecule on the substrate;
* 2) the term "ligand" stands for adhesion molecule on the nanoparticle;
* 3) all counts start from 0;
**/