-
Notifications
You must be signed in to change notification settings - Fork 2
/
sum.jl
40 lines (31 loc) · 854 Bytes
/
sum.jl
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
"""
```
sum!(R1::Result, R2::Result)
```
Sum the counts of two Results structures, adding the result to the first structure
as in R1 = R1 + R2.
"""
function sum!(R1::Result, R2::Result)
@. R1.md_count += R2.md_count
@. R1.md_count_random += R2.md_count_random
@. R1.solute_atom += R2.solute_atom
@. R1.solvent_atom += R2.solvent_atom
@. R1.rdf_count += R2.rdf_count
@. R1.rdf_count_random += R2.rdf_count_random
sum!(R1.density, R2.density)
sum!(R1.volume, R2.volume)
return nothing
end
function sum!(D1::Density, D2::Density)
D1.solute += D2.solute
D1.solvent += D2.solvent
D1.solvent_bulk += D2.solvent_bulk
return nothing
end
function sum!(V1::Volume, V2::Volume)
V1.total += V2.total
V1.bulk += V2.bulk
V1.domain += V2.domain
@. V1.shell += V2.shell
return nothing
end