You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Added new DynamicsOutput: OutputDesorptionTrajectory #317
- Added new DynamicsOutput: OutputDesorptionAngle #317
- Created an `Analysis` submodule for common analysis functions
- Add `Structure` submodule for common utility functions for atomic structure.
* Add rudimentary tests for NQCDynamics.Structure
* Improved method definitions, possible efficiency gain by using views
* Add unit tests for diatomic analysis functions for desorption
* Add "Analysis" group to unit testing
* Added explanation for Structure module scope
This submodule contains utility functions to analyse and modify atomic structure data, such as interatomic distances, centres of mass, both with and without support for periodic boundary conditions.
7
+
8
+
These functions can be used to build more sophisticated output functions, or for basic analysis of simulation results in post.
9
+
10
+
This module **doesn't contain**:
11
+
- Basic definitions of atomic structures (e.g. `Atoms`, `PeriodicCell`, ...). These are defined in [`NQCBase`](@ref).
12
+
- Functions to generate atomic structures. These should be added to [`NQCDynamics.InitialConditions`](@ref).
13
+
- Analysis functions for specific systems (e.g. molecules on surfaces). These should be added to [`NQCDynamics.Analysis`](@ref).
# [Simulations outputs and analysis functions](@id output_and_analysis)
2
+
3
+
NQCDynamics.jl is able to output a variety of common observables when running simulations with the `run_dynamics` function. Further output functions can be implemented easily as well.
4
+
5
+
In this section you will find an overview of all available output types, as well as explanations of some common analysis functions in the realm of surface chemistry which we have implemented in the package.
6
+
7
+
## DynamicsOutputs
8
+
9
+
In many examples within this documentation, you have seen calls to `run_dynamics`:
Within `run_dynamics`, the `output` argument specifies the desired output values for each trajectory. `output` can either be given as a single function, or as a tuple of multiple output functions, for example:
ensemble[3][:OutputPosition] # will output the positions at all timesteps in trajectory 3
23
+
```
24
+
25
+
Every output type is a function which can use the [`DynamicsVariables`](@ref) and [`Simulation`](@ref) values of the respective trajectory, allowing you to create custom output types of any kind. See the [developer documentation] for more information on how to implement a custom output type.
26
+
27
+
You can find an overview of all available output types in the [`DynamicsOutputs`](@ref NQCDynamics.DynamicsOutputs) API.
28
+
29
+
## Analysis functions
30
+
31
+
The [Analysis](@ref Analysis) submodule in NQCDynamics contains functions commonly used in the analysis of trajectories to make the analysis of existing trajectories easier.
32
+
Ideally, most observable quantities could be implemented with a combination of [`DynamicsOutputs`](@ref NQCDynamics.DynamicsOutputs) and `Reduction` types, however we might want to data from existing ensemble simulations where re-running the entire set of trajectories is impractical.
33
+
34
+
As a result, most functions in the `Analysis` submodule are also implemented as a `DynamicsOutput`.
35
+
36
+
### Convenient functions for periodic structures
37
+
[`NQCDynamics.Structure`](@ref Structure) contains several useful functions for periodic structures, such as `pbc_distance, pbc_center_of_mass`.
38
+
39
+
These functions take into account periodic copies of the atoms in question, returning the respective values for the closest set of periodic copies.
molecule_position=surface_normal_height(Structure.pbc_center_of_mass(x, indices..., simulation)) # molecule position wrt surface normal
21
+
substrate_heights=surface_normal_height.(eachcol(get_positions(x)[:, symdiff(1:length(simulation.atoms.masses), indices)])) # substrate positions along surface normal
Determines the index in a trajectory where surface desorption begins.
49
+
50
+
This is evaluated using two conditions:
51
+
52
+
1. In the trajectory, the diatomic must be `surface_distance_threshold` or further away from the highest other atom. (In `surface_normal` direction).
53
+
54
+
2. Desorption begins at the turning point of the centre of mass velocity component along `surface_normal`, indicating overall movement away from the surface.
@debug"Desorption observed in snapshot $(desorbed_frame)"
64
+
leaving_surface_frame=findlast(com_velocity_condition.(view(trajectory, 1:desorbed_frame), Ref(diatomic_indices), Ref(simulation); surface_normal=surface_normal)) #ToDo testing views for memory efficiency, need to test time penalty. Also need to test if running on everything and findfirst-ing the Bool array is quicker.
65
+
if leaving_surface_frame<0
66
+
@warn"Desorption event detected, but no direction change detected."
0 commit comments