Skip to content

Commit 29268a8

Browse files
corrections to the documentation (#9)
* corrections to the documentation * more minor corrections
1 parent f0cc586 commit 29268a8

File tree

1 file changed

+39
-20
lines changed

1 file changed

+39
-20
lines changed

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If you cannot wait to start codding, try to run some scripts from `examples` fol
2020
## Basic Components
2121
There are three basic components required for any simulation of systems of N-bodies: `bodies`, `system` and `simulation`.
2222

23-
**Bodies** or **Particles** are the objects which will interact with each other and for wich the equations of Newton's 2nd law are solved during the simulation process. Three parametes of a body are necessary, they are initial location, initial velocity and mass. `MassBody` structure represents such particles:
23+
**Bodies** or **Particles** are the objects which will interact with each other and for which the equations of Newton's 2nd law are solved during the simulation process. Three parameters of a body are necessary, they are initial location, initial velocity and mass. `MassBody` structure represents such particles:
2424

2525
```julia
2626
using StaticArrays
@@ -29,7 +29,7 @@ v = SVector(.1,.2,.5)
2929
mass = 1.25
3030
body = MassBody(r,v,mass)
3131
```
32-
For the sake of simulation speed it is advised to use static arrays from the corresponding package.
32+
For the sake of simulation speed it is advised to use [static arrays](https://github.com/JuliaArrays/StaticArrays.jl).
3333

3434
A **System** covers bodies and necessary parameters for correct simulation of interaction between particles. For example, to create an entity for a system of gravitationally interacting particles, one needs to use `GravitationalSystem` constructor:
3535

@@ -48,7 +48,7 @@ simulation = NBodySimulation(system, tspan)
4848
There are different types of bodies but they are just containers of particle parameters. The interaction and acceleration of particles are defined by the potentials or force fields.
4949

5050
## Generating bodies
51-
The package exports quite a useful function for placing simular particles in the nodes of a cubic cell with their velocities distributed in accordance with the Maxwell–Boltzmann law:
51+
The package exports quite a useful function for placing similar particles in the nodes of a cubic cell with their velocities distributed in accordance with the Maxwell–Boltzmann law:
5252

5353
```julia
5454
N = 100 # number of bodies/particles
@@ -65,7 +65,7 @@ molecules = load_water_molecules_from_pdb("path_to_pdb_file.pdb")
6565
```
6666

6767
## Potentials
68-
The potentials or force field determines the interaction of particles ant, therefore, their acceleration.
68+
The potentials or force field determines the interaction of particles and, therefore, their acceleration.
6969

7070
There are several structures for basic physical interactions:
7171

@@ -77,7 +77,7 @@ jl_parameters = LennardJonesParameters(ϵ, σ, cutoff_radius)
7777
spc_water_paramters = SPCFwParameters(rOH, ∠HOH, k_bond, k_angle)
7878
```
7979

80-
The Lennard-Jones potential is used in molecular dynamics simulations for approximating interactions between neutral atoms or molecules. The SPC/Fw water model is used in water simulations. The meaning of arguments for `SPCFwParameters` constructor will be clarified further in this documentation.
80+
The Lennard-Jones potential is used in molecular dynamics simulations for approximating interactions between neutral atoms or molecules. The [SPC/Fw water model](http://www.sklogwiki.org/SklogWiki/index.php/SPC/Fw_model_of_water) is used in water simulations. The meaning of arguments for `SPCFwParameters` constructor will be clarified further in this documentation.
8181

8282
`PotentialNBodySystem` structure represents systems with a custom set of potentials. In other words, the user determines the ways in which the particles are allowed to interact. One can pass the bodies and parameters of interaction potentials into that system. In case the potential parameters are not set, during the simulation particles will move at constant velocities without acceleration.
8383

@@ -90,7 +90,7 @@ There exists an [example](http://docs.juliadiffeq.org/latest/models/physical.htm
9090

9191
Here is shown how to create custom acceleration functions using tools of NBodySimulator.
9292

93-
First of all it is necessary to create a structure for parameters for the custom potential.
93+
First of all, it is necessary to create a structure for parameters for the custom potential.
9494

9595
```julia
9696
struct CustomPotentialParameters <: PotentialParameters
@@ -141,7 +141,7 @@ Usually we solve an N-body problem for a certain period of time:
141141
tspan = (0.0, 1111150.0)
142142
```
143143

144-
The created objects determines the simulation we want to run:
144+
The created objects determine the simulation we want to run:
145145

146146
```julia
147147
simulation = NBodySimulation(system, tspan)
@@ -159,7 +159,7 @@ animate(sim_result, "path_to_animated_particles.gif")
159159
### Electrostatic Interaction
160160
Interaction between charged particles obeys Coulomb's law. The movement of such bodies can be simulated using `ChargedParticle` and `ChargedParticles` structures.
161161

162-
The following example shows how to model two oppositely charged particles. If one body is more massive that another, it will be possible to observe rotation of the light body around the heavy one without ajusting their positions in space. The constructor for `ChargedParticles` system requires bodies and Coulomb's constant `k` to be passed as arguments.
162+
The following example shows how to model two oppositely charged particles. If one body is more massive that another, it will be possible to observe rotation of the light body around the heavy one without adjusting their positions in space. The constructor for `ChargedParticles` system requires bodies and Coulomb's constant `k` to be passed as arguments.
163163

164164
```julia
165165
r = 100.0 # m
@@ -179,7 +179,7 @@ sim_result = run_simulation(simulation)
179179
### Magnetic Interaction
180180
An N-body system consisting of `MagneticParticle`s can be used for simulation of interacting magnetic dipoles, though such dipoles cannot rotate in space. Such a model can represent single domain particles interacting under the influence of a strong external magnetic field.
181181

182-
In order to create a magnetic particle one specifies its location in space, velocity and the vector of its magnetic moment. The following code shows how we can construct an iron particle:
182+
In order to create a magnetic particle, one specifies its location in space, velocity and the vector of its magnetic moment. The following code shows how we can construct an iron particle:
183183

184184
```julia
185185
iron_dencity = 7800 # kg/m^3
@@ -219,7 +219,7 @@ NBodySimulator allows one to conduct molecular dynamic simulations for the Lenna
219219
The comprehensive examples of liquid argon and water simulations can be found in `examples` folder.
220220
Here only the basic principles of the molecular dynamics simulations using NBodySimulator are presented using liquid argon as a classical MD system for beginners.
221221

222-
First of all one needs to define paramters of the simultaion:
222+
First of all, one needs to define parameters of the simulation:
223223

224224
```julia
225225
T = 120.0 # °K
@@ -264,10 +264,29 @@ simulation = NBodySimulation(lj_system, (t1, t2), pbc, thermostat);
264264
simulation = NBodySimulation(lj_system, (t1, t2), pbc, thermostat, kb);
265265
```
266266

267-
The default boundary conditions are `InfiniteBox` withouth any limits, default thermostat is `NullThermostat` which does no thermostating and default Boltzmann constant `kb` equals its value in SI, i.e. 1.38e-23 J/K.
267+
The default boundary conditions are `InfiniteBox` without any limits, default thermostat is `NullThermostat` which does no thermostating and default Boltzmann constant `kb` equals its value in SI, i.e. 1.38e-23 J/K.
268+
269+
## Water Simulations
270+
In NBodySImulator the [SPC/Fw water model](http://www.sklogwiki.org/SklogWiki/index.php/SPC/Fw_model_of_water) is implemented. For using this model, one has to specify parameters of the Lennard-Jones potential between the oxygen atoms of water molecules, parameters of the electrostatic potential for the corresponding interactions between atoms of different molecules and parameters for harmonic potentials representing bonds between atoms and the valence angle made from bonds between hydrogen atoms and the oxygen one.
271+
272+
```julia
273+
bodies = generate_bodies_in_cell_nodes(N, mH2O, v, L)
274+
jl_parameters = LennardJonesParameters(ϵOO, σOO, R)
275+
e_parameters = ElectrostaticParameters(k, Rel)
276+
spc_paramters = SPCFwParameters(rOH, ∠HOH, k_bond, k_angle)
277+
water = WaterSPCFw(bodies, mH, mO, qH, qO, jl_parameters, e_parameters, spc_paramters);
278+
```
279+
280+
For each water molecule here, `rOH` is the equilibrium distance between a hydrogen atom and the oxygen atom, `∠HOH` denotes the equilibrium angle made of those two bonds, `k_bond` and `k_angle` are the elastic coefficients for the corresponding harmonic potentials.
281+
282+
Further, one pass the water system into `NBodySimulation` constructor as a usual system of N-bodies.
283+
284+
```julia
285+
simulation = NBodySimulation(water, (t1, t2), pbc, kb);
286+
```
268287

269288
## Thermostats
270-
Usually during simulation of a system is required to be at a particular temperature. NBodySimulator contains several thermostas for that purpose. Here the thermostating of liquid argon is presented, for thermostating of water one can refer to [this post](https://mikhail-vaganov.github.io/gsoc-2018-blog/2018/08/06/thermostating.html)
289+
Usually during simulation of a system is required to be at a particular temperature. NBodySimulator contains several thermostats for that purpose. Here the thermostating of liquid argon is presented, for thermostating of water one can refer to [this post](https://mikhail-vaganov.github.io/gsoc-2018-blog/2018/08/06/thermostating.html)
271290

272291
### [Andersen Thermostat](http://www.sklogwiki.org/SklogWiki/index.php/Andersen_thermostat)
273292
```julia
@@ -302,9 +321,9 @@ thermostat = LangevinThermostat(90, γ)
302321
## Analyzing the Result of Simulation
303322
Once the simulation is completed, one can analyze the result and obtain some useful characteristics of the system.
304323

305-
Function `run_simulation` returns a structure containig the initial parameters of simulation and the solution of differential equation (DE) required for description of the corresponding system of particles. There are different functions which help to intepret solution of DEs into physical quantities.
324+
Function `run_simulation` returns a structure containing the initial parameters of simulation and the solution of differential equation (DE) required for description of the corresponding system of particles. There are different functions which help to interpret solution of DEs into physical quantities.
306325

307-
One of the main charachterestics of a system during molecular dynamics simulations is its thermodynamic temperature. The value of the temperature at a particular time `t` can be obtained via calling this function:
326+
One of the main characteristics of a system during molecular dynamics simulations is its thermodynamic temperature. The value of the temperature at a particular time `t` can be obtained via calling this function:
308327

309328
```julia
310329
T = temperature(result, t)
@@ -314,7 +333,7 @@ T = temperature(result, t)
314333
The RDF is another popular and essential characteristic of molecules or similar systems of particles. It shows the reciprocal location of particles averaged by the time of simulation.
315334

316335
```julia
317-
(rs, grf) = @time rdf(result)
336+
(rs, grf) = rdf(result)
318337
```
319338

320339
The dependence of `grf` on `rs` shows radial distribution of particles at different distances from an average particle in a system.
@@ -325,14 +344,14 @@ Here the radial distribution function for the classic system of liquid argon is
325344
### Mean Squared Displacement (MSD)
326345
The MSD characteristic can be used to estimate the shift of particles from their initial positions.
327346
```julia
328-
(ts, dr2) = @time msd(result)
347+
(ts, dr2) = msd(result)
329348
```
330-
For a standrad liquid argon system the displacement grows with time:
349+
For a standard liquid argon system the displacement grows with time:
331350
![rdf for liquid argon](https://user-images.githubusercontent.com/16945627/43990362-9a67c0aa-9d74-11e8-9512-08840294d411.png)
332351

333352
### Energy Functions
334353

335-
Energy is a higlhy important physical characteristic of a system. The module provides four functions to obtain it, though the `total_energy` function just sums potential and kinetic energy:
354+
Energy is a highly important physical characteristic of a system. The module provides four functions to obtain it, though the `total_energy` function just sums potential and kinetic energy:
336355

337356
```julia
338357
e_init = initial_energy(simualtion)
@@ -341,7 +360,7 @@ e_pot = potential_energy(result, t)
341360
e_tot = total_energy(result, t)
342361
```
343362

344-
## Ploting Images
363+
## Plotting Images
345364
Using tools of NBodySimulator one can export results of simulation into a [Protein Database File](https://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)). [VMD](http://www.ks.uiuc.edu/Research/vmd/) is a well-known tool for visualizing molecular dynamics, which can read data from PDB files.
346365

347366
```julia
@@ -358,4 +377,4 @@ plot(result)
358377
animate(result, "path_to_file.gif")
359378
```
360379

361-
Makie.jl also has a recipe for plotting results of N-body simulations. The [example](http://makie.juliaplots.org/stable/examples-meshscatter.html#Type-recipe-for-molecule-simulation-1) is presenten in the documentation.
380+
Makie.jl also has a recipe for plotting results of N-body simulations. The [example](http://makie.juliaplots.org/stable/examples-meshscatter.html#Type-recipe-for-molecule-simulation-1) is presented in the documentation.

0 commit comments

Comments
 (0)