This documentation covers everything you need to know about MAICoS, the Molecular
Analysis for Interfacial and Confined Systems toolkit. There are five sections:
If you are new to MAICoS, we recommend starting with the Getting started
section. If you want to contribute to the development of the library, please have a look
at our developer documentation.
The Getting started section is for MAICoS beginners. It will help you install
and familiarize yourself with MAICoS and its approach to analyse molecular dynamics
simulations.
The How-to guides section is for MAICoS intermediate and advanced users. It
contains guides taking you through series of steps involved in addressing key problems
and use-cases in MAICoS.
The Reference guides section is for MAICoS intermediate and advanced users, it
contains technical references and parameter list for each MAICoS modules
(How-to guides) as well as the APIs. It describes the various functionalities
provided by MAICoS. You can always refer to this section to learn more about classes,
functions, modules, and other aspects of MAICoS machinery you may come across.
The Explanations section discusses key topics and concepts at a fairly
high level and provides explanations to expand your knowledge of MAICoS. It requires at
least basic to intermediate knowledge of MAICoS.
MAICoS is the acronym for Molecular Analysis for Interfacial and Confined Systems.
It is an object-oriented python toolkit for analysing the structure and dynamics of
interfacial and confined fluids from molecular simulations. Combined with MDAnalysis,
MAICoS can be used to extract density profiles, dielectric constants, structure factors,
or transport properties from trajectories files, including LAMMPS, GROMACS, CHARMM or
NAMD data. MAICoS is open source and is released under the GNU general public license
v3.0.
MAICoS is a tool for beginners of molecular simulations with no prior Python experience.
For these users MAICoS provides a descriptive command line interface. Also experienced
users can use the Python API for their day to day analysis or use the provided
infrastructure to build their own analysis for interfacial and confined systems.
Keep up to date with MAICoS news by following us on Twitter. If you find an issue, you
can report it on Gitlab. You can also join the developer team on Discord to discuss
possible improvements and usages of MAICoS.
Currently, MAICoS supports the following analysis modules in alphabetical order:
Module Name
Description
DensityCylinder
Compute cylindrical partial densitiy profiles
DensityPlanar
Compute cartesian partial density profiles
DensitySphere
Compute spherical partial density profiles
DielectricCylinder
Compute cylindrical dielectric profiles
DielectricPlanar
Compute planar dielectric profiles
DielectricSpectrum
Compute the linear dielectric spectrum
DielectricSphere
Compute spherical dielectric profiles
DipoleAngle
Compute angle timeseries of dipole moments
DiporderCylinder
Compute cylindrical dipolar order parameters
DiporderPlanar
Compute planar dipolar order parameters
RDFDiporder
Spherical Radial Distribution function between dipoles
DiporderSphere
Compute spherical dipolar order parameters
DiporderStructureFactor
Structure factor for dipoles
KineticEnergy
Compute the timeseries of energies
PDFCylinder
Compute cylindrical shell-wise 1D pair distribution functions
PDFPlanar
Compute slab-wise planar 2D pair distribution functions
Saxs
Compute small angle X-Ray structure factors and scattering intensities (SAXS)
TemperaturePlanar
Compute temperature profiles in a cartesian geometry
VelocityCylinder
Compute the cartesian velocity profile across a cylinder
VelocityPlanar
Compute the velocity profile in a cartesian geometry
To follow this tutorial, it is assumed that MAICoS has been installed on your computer.
MAICoS heavily depends on the MDAnalysis infrastructure for trajectory loading and
atom selection. Here we will only cover a small aspects of the capabilities of
MDAnalysis. If you want to learn more about the library, take a look at their
documentation.
Note that some of the calculations may contain pitfall, such as dielectric profiles
calculation. Potential pitfalls and best practices are listed in the
How-to guides section.
To start, let us first import Matplotlib, MDAnalysis and MAICoS
For this tutorial we use a system consisting of a 2D slab with 1176 water molecules
confined in a 2D slit made of NaCl atoms, where the two water/solid interfaces are
normal to the axis \(z\) as shown in the snapshot below:
An acceleration \(a = 0.05\,\text{nm}\,\text{ps}^{-2}\) was applied to the water
molecules in the \(\boldsymbol{e}_x\) direction parallel to the NaCl wall, and the
atoms of the wall were maintained frozen along \(\boldsymbol{e}_x\).
Let us print a few information about the trajectory:
print(f"Number of frames in the trajectory is {u.trajectory.n_frames}.")timestep=round(u.trajectory.dt,2)print(f"Time interval between two frames is {timestep} ps.")total_time=round(u.trajectory.totaltime,2)print(f"Total simulation time is {total_time} ps.")
Number of frames in the trajectory is 201.
Time interval between two frames is 10.0 ps.
Total simulation time is 2000.0 ps.
Now, we define four atom groups containing repectively:
the oxygen and the hydrogen atoms (of the water molecules),
MAICoS estimates the uncertainity for each profile. This uncertainity is stored inside
the dprofile attribute.
uncertainity=dplan.results.dprofile# Let us plot the results also showing the uncertainitiesfig,ax=plt.subplots()ax.errorbar(zcoor,dens,5*uncertainity)ax.set_xlabel(r"z coordinate ($\rm Å$)")ax.set_ylabel(r"density H2O ($\rm u \cdot Å^{-3}$)")fig.show()
For this example we scale the error by 5 to be visible in the plot.
The uncertainity estimatation assumes that the trajectory data is uncorraleted. If the
correlation time is too high or not reasonably computable a warning occurs that the
uncertainity estimatation might be unreasonable.
Unwrapping in combination with the `wrap_compound='atoms` is superfluous. `unwrap` will be set to `False`.
/home/docs/checkouts/readthedocs.org/user_builds/maicos/envs/main/lib/python3.9/site-packages/maicos/core/base.py:456: UserWarning: Your trajectory is too short to estimate a correlation time. Use the calculated error estimates with caution.
self.corrtime = correlation_analysis(self.timeseries)
<maicos.modules.densityplanar.DensityPlanar object at 0x7fad7bc26430>
Let us plot the results using two differents \(y\)-axis:
fig,ax1=plt.subplots()ax1.plot(zcoor_smaller_bin_O,dens_smaller_bin_O,label=r"Oxygen")ax1.plot(zcoor_smaller_bin_H,dens_smaller_bin_H*8,label=r"Hydrogen")ax1.set_xlabel(r"z coordinate ($Å$)")ax1.set_ylabel(r"density O ($\rm u \cdot Å^{-3}$)")ax2=ax1.twinx()ax2.set_ylabel(r"density H ($\rm u \cdot Å^{-3}$)")ax1.legend()fig.show()
For each MAICoS module, they are several parameters similar to bin_width. The
parameter list and default options are listed in the module’s documentation, and can be gathered by calling the help function of Python:
help(maicos.DensityPlanar)
Help on class DensityPlanar in module maicos.modules.densityplanar:
class DensityPlanar(maicos.core.planar.ProfilePlanarBase)
| DensityPlanar(atomgroup: MDAnalysis.core.groups.AtomGroup, dens: str = 'mass', dim: int = 2, zmin: Optional[float] = None, zmax: Optional[float] = None, bin_width: float = 1, refgroup: Optional[MDAnalysis.core.groups.AtomGroup] = None, sym: bool = False, grouping: str = 'atoms', unwrap: bool = True, bin_method: str = 'com', output: str = 'density.dat', concfreq: int = 0, jitter: float = 0.0) -> None
|
| Cartesian partial density profiles.
|
| Calculations are carried out for
| ``mass`` :math:`(\rm u \cdot Å^{-3})`, ``number`` :math:`(\rm Å^{-3})` or ``charge``
| :math:`(\rm e \cdot Å^{-3})` density profiles along certain cartesian axes ``[x, y,
| z]`` of the simulation cell. Cell dimensions are allowed to fluctuate in time.
|
| For grouping with respect to ``molecules``, ``residues`` etc., the corresponding
| centers (i.e., center of mass), taking into account periodic boundary conditions,
| are calculated. For these calculations molecules will be unwrapped/made whole.
| Trajectories containing already whole molecules can be run with ``unwrap=False`` to
| gain a speedup. For grouping with respect to atoms, the `unwrap` option is always
| ignored.
|
| For the correlation analysis the central bin
| (:math:`N \backslash 2`) of the 0th's group profile is used. For further information on the correlation analysis please
| refer to :class:`maicos.core.base.AnalysisBase` or the :ref:`general-design`
| section.
|
| Parameters
| ----------
| atomgroup : MDAnalysis.core.groups.AtomGroup
| A :class:`~MDAnalysis.core.groups.AtomGroup` for which the calculations are
| performed.
| unwrap : bool
| When :obj:`True`, molecules that are broken due to the periodic boundary
| conditions are made whole.
|
| If the input contains molecules that are already whole, speed up the calculation
| by disabling unwrap. To do so, use the flag ``-no-unwrap`` when using MAICoS
| from the command line, or use ``unwrap=False`` when using MAICoS from the Python
| interpreter.
|
| Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
| currently supported in MDAnalysis. In this case, you need to provide unwrapped
| trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
| for example, using the ``trjconv`` command of GROMACS.
| refgroup : MDAnalysis.core.groups.AtomGroup
| Reference :class:`~MDAnalysis.core.groups.AtomGroup` used for the calculation.
| If ``refgroup`` is provided, the calculation is performed relative to the center
| of mass of the AtomGroup. If ``refgroup`` is :obj:`None` the calculations are
| performed with respect to the center of the (changing) box.
| jitter : float
| Magnitude of the random noise to add to the atomic positions.
|
| A jitter can be used to stabilize the aliasing effects sometimes appearing when
| histogramming data. The jitter value should be about the precision of the
| trajectory. In that case, using jitter will not alter the results of the
| histogram. If ``jitter = 0.0`` (default), the original atomic positions are kept
| unchanged.
|
| You can estimate the precision of the positions in your trajectory with
| :func:`maicos.lib.util.trajectory_precision`. Note that if the precision is not
| the same for all frames, the smallest precision should be used.
| concfreq : int
| When concfreq (for conclude frequency) is larger than ``0``, the conclude
| function is called and the output files are written every ``concfreq``
| frames.
| dim : {0, 1, 2}
| Dimension for binning (``x=0``, ``y=1``, ``z=1``).
| zmin : float
| Minimal coordinate for evaluation (in Å) with respect to the center of mass of
| the refgroup.
|
| If ``zmin=None``, all coordinates down to the lower cell boundary are taken into
| account.
| zmax : float
| Maximal coordinate for evaluation (in Å) with respect to the center of mass of
| the refgroup.
|
| If ``zmax = None``, all coordinates up to the upper cell boundary are taken into
| account.
| bin_width : float
| Width of the bins (in Å).
| sym : bool
| Symmetrize the profile. Only works in combination with
| ``refgroup``.
| grouping : {``"atoms"``, ``"residues"``, ``"segments"``, ``"molecules"``, ``"fragments"``}
| Atom grouping for the calculations.
|
| The possible grouping options are the atom positions (in the case where
| ``grouping="atoms"``) or the center of mass of the specified grouping unit (in
| the case where ``grouping="residues"``, ``"segments"``, ``"molecules"`` or
| ``"fragments"``).
| bin_method : {``"com"``, ``"cog"``, ``"coc"``}
| Method for the position binning.
|
| The possible options are center of mass (``"com"``),
| center of geometry (``"cog"``), and center of charge (``"coc"``).
| output : str
| Output filename.
| dens : {``"mass"``, ``"number"``, ``"charge"``}
| density type to be calculated.
|
| Attributes
| ----------
| results.bin_pos : numpy.ndarray
| Bin positions (in Å) ranging from ``zmin`` to ``zmax``.
| results.profile : numpy.ndarray
| Calculated profile.
| results.dprofile : numpy.ndarray
| Estimated profile's uncertainity.
|
| Notes
| -----
| Partial mass density profiles can be used to calculate the ideal component of the
| chemical potential. For details, take a look at the corresponding :ref:`How-to
| guide<howto-chemical-potential>`.
|
| Method resolution order:
| DensityPlanar
| maicos.core.planar.ProfilePlanarBase
| maicos.core.planar.PlanarBase
| maicos.core.base.AnalysisBase
| maicos.core.base._Runner
| MDAnalysis.analysis.base.AnalysisBase
| maicos.core.base.ProfileBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, atomgroup: MDAnalysis.core.groups.AtomGroup, dens: str = 'mass', dim: int = 2, zmin: Optional[float] = None, zmax: Optional[float] = None, bin_width: float = 1, refgroup: Optional[MDAnalysis.core.groups.AtomGroup] = None, sym: bool = False, grouping: str = 'atoms', unwrap: bool = True, bin_method: str = 'com', output: str = 'density.dat', concfreq: int = 0, jitter: float = 0.0) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from maicos.core.planar.PlanarBase:
|
| odims
| Other dimensions perpendicular to dim i.e. (0,2) if dim = 1.
|
| ----------------------------------------------------------------------
| Methods inherited from maicos.core.base.AnalysisBase:
|
| run(self, start: Optional[int] = None, stop: Optional[int] = None, step: Optional[int] = None, frames: Optional[int] = None, verbose: Optional[bool] = None, progressbar_kwargs: Optional[dict] = None) -> typing_extensions.Self
| Iterate over the trajectory.
|
| savetxt(self, fname: str, X: numpy.ndarray, columns: Optional[List[str]] = None) -> None
| Save to text.
|
| An extension of the numpy savetxt function. Adds the command line input to the
| header and checks for a doubled defined filesuffix.
|
| Return a header for the text file to save the data to. This method builds a
| generic header that can be used by any MAICoS module. It is called by the save
| method of each module.
|
| The information it collects is:
| - timestamp of the analysis
| - name of the module
| - version of MAICoS that was used
| - command line arguments that were used to run the module
| - module call including the default arguments
| - number of frames that were analyzed
| - atomgroup that was analyzed
| - output messages from modules and base classes (if they exist)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from maicos.core.base.AnalysisBase:
|
| box_center
| Center of the simulation cell.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from maicos.core.base._Runner:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Methods inherited from maicos.core.base.ProfileBase:
|
| save(self) -> None
| Save results of analysis to file specified by ``output``.
Here we can see that for maicos.DensityPlanar, there are several possible
options such as zmin, zmax (the minimal and maximal coordinates to consider),
or refgroup (to perform the binning with respect to the center of mass of a
certain group of atoms).
Knowing this, let us re-calculate the density profile of \(\mathrm{H_2O}\), but
this time using the group group_H2O as a reference for the center of mass:
/home/docs/checkouts/readthedocs.org/user_builds/maicos/envs/main/lib/python3.9/site-packages/maicos/lib/math.py:303: RuntimeWarning: invalid value encountered in divide
(1 - np.arange(1, cutoff) / len(timeseries)) * corr[1:cutoff] / corr[0]
/home/docs/checkouts/readthedocs.org/user_builds/maicos/envs/main/lib/python3.9/site-packages/maicos/core/base.py:456: UserWarning: Your trajectory does not provide sufficient statistics to estimate a correlation time. Use the calculated error estimates with caution.
self.corrtime = correlation_analysis(self.timeseries)
An plot the two profiles with different \(y\)-axis:
fig,ax1=plt.subplots()ax1.plot(zcoor_centered_H2O,dens_centered_H2O,label=r"$\rm H_2O$")ax1.plot(zcoor_centered_NaCl,dens_centered_NaCl/5,label=r"$\rm NaCl$")ax1.set_xlabel(r"z coordinate ($Å$)")ax1.set_ylabel(r"density O ($\rm u \cdot Å^{-3}$)")ax1.legend()ax2=ax1.twinx()ax2.set_ylabel(r"density NaCl ($\rm u \cdot Å^{-3}$)")fig.show()
Unwrapping in combination with the `wrap_compound='atoms` is superfluous. `unwrap` will be set to `False`.
0%| | 0/201 [00:00<?, ?it/s]
18%|█▊ | 37/201 [00:00<00:00, 360.88it/s]
37%|███▋ | 74/201 [00:00<00:00, 360.00it/s]
55%|█████▌ | 111/201 [00:00<00:00, 362.00it/s]
74%|███████▎ | 148/201 [00:00<00:00, 362.96it/s]
92%|█████████▏| 185/201 [00:00<00:00, 362.81it/s]
100%|██████████| 201/201 [00:00<00:00, 361.47it/s]
<maicos.modules.densityplanar.DensityPlanar object at 0x7fad78e1cbe0>
To analyse only a subpart of a trajectory file, for instance to analyse only frames 2,
4, 6, 8, and 10, use the start, stop, and step keywords as follow:
MAICoS can be used directly from the command line (cli). Using cli instead of a Jupyter
notebook can sometimes be more comfortable, particularly for lengthy analysis. The cli
in particular is handy because it allows for updating the analysis results during the
run. You can specify the number of frames after the output is updated with the
-concfreq flag. See below for details.
Note that in this documentation, we almost exclusively describe the use of MAICoS from
the python interpreter, but all operations can be equivalently performed from the cli.
#!/bin/bash# -*- Mode: bash; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-## Copyright (c) 2024 Authors and contributors# (see the AUTHORS.rst file for the full list of names)## Released under the GNU Public Licence, v3 or any higher version# SPDX-License-Identifier: GPL-3.0-or-later
maicosdensityplanar-sslit_flow.tpr\-fslit_flow.trr\-atomgroup'type OW HW'# The density profile has been written in a file named ``density.dat`` in the current# directory. The written file starts with the following lines
head-n20density.dat
# For lengthy analysis, use the ``concfreq`` option to update the result during the run
maicosdensityplanar-sslit_flow.tpr\-fslit_flow.trr\-atomgroup'type OW HW'\-concfreq'10'# The general help of MAICoS can be accessed using
maicos-h
# Package-specific page can also be accessed from the cli
maicosdensityplanar-h
The base units of MAICoS are consistent with those of MDAnalysis. Keeping inputs and
outputs consistent with this set of units reduces ambiguity, so we encourage everyone to
use them exclusively.
Simon Gravelle, Philip Loche, Marc Sauter, Henrik Stooß, Philipp Staerk, Adyant Agrawal,
Kira Fischer
Skip test for custom modules in case the import is not working (!294)
Change to CHANGELOG.rst update check so that it is only executed in MRs (!198)
Rename radial distribution function to pair distribution function (!278)
Add RDF derivation and explain role of dz. (!278)
Implement 1D pair distribution function in RDFCylinder (!276)
Sort format and add more atomtypes to atomtypes.dat (!291)
Add grouping option to DipoleAngle module (!290)
Added Support for Python 3.12 (!289)
Remove suffixes -linux, -macos, -windows when building wheels. Platform
will be detected automatically. (!288)
Use default tox error for non-exsiting enviroment (!285)
Parse documentation metadata from pyproject.toml (!287)
Convert pathlib.Path into str when using in sys.path.append (#123, !286)
Update dev names (!284)
Improvements to documentation rendering (#122, !282)
Unify Python versions in tox environments i.e. py311-build-macos to
build-macos (!283)
Remove deprecated pytest tmpdir fixture (!283)
Remove deprecated assert_almost_equal in favor of assert_allclose (!283)
Move from os.path to pathlib.Path (!283)
Added Support for Python 3.11 (!283)
Update MacOS images for CI (!281)
Removed the obsolete option for the vacuum boundary condition in the
DielectricPlanar module and prompt users to use tin-foil boundary
conditions instead (!280).
Add physical integration test to test that structure factor from Saxs is the same as
the Fourier transformed RDF. (!279)
Add example and explenation of how to relate the radial distribution function and the
structure factor (!279)
Add function maicos.lib.math.rdf_structure_factor() for converting a radial
distribution function into a structure factor. (!279)
Change default biwnwidth (dq) in maicos.Saxs to 0.1. (!279)
Philip Loche, Simon Gravelle, Marc Sauter, Henrik Stooß, Kira Fischer, Alexander
Schlaich, Philipp Staerk
Make sure citation are only printed once (!260)
Added MacOS pipeline, fixed wheels (!218)
Fix CHANGELOG testing (!220)
Added dielectric how-to (!208)
Raise an error if unwrap=False and refgroup!=None in dielectric modules
(!215).
Fix velocity profiles (!211)
Added the Theory to the Dielectric docs (!201)
Add a logger info for citations (!205)
Rename Diporder to DiporderPlanar (!202)
Change default behavior of DielectricPlanar: assume slab geometry by default (removing
the xy flag and instead introduce is_3d for 3d-periodic systems) (!202)
Rename profile_mean to profile (!202)
Major improvements on the documentation (!202)
Add a check if the CHANGELOG.rst has been updated (!198)
Fix behaviour of refgroup (!192)
Resolve +1 is summed for epsilon for each atom group (#101, !193)
Flatten file structure of analysis modules (#46, !196)
Consistent mass unit in docs
Porting examples to sphinx-gallery (!190)
Add jitter parameter to AnalysisBase (!183)
Test output messages (!191)
Fixed typo in DielectricPlanar docs (!194)
Add Sphere modules (!175)
Add ProfileBase class (!180)
Slight restructure of the documenation (!189)
Fix py311 windows
Update build requirements for py310 and py311
Merged setup.cfg into pyproject.toml (!187)
Use versioneer for version info (!150)
Update project urls (!185)
Added repository link in the documentation (!184)
Added windows CI/CD pipeline (!182)
Update package discovery methods in setup.cfg
Refactor CI script (!181)
Fix DielectricCylinder (!165)
Unified n_bins logging (#93, !179)
Add MAICoS UML Class Diagramm (!178)
Changed density calculation using range in np.histogram (!77)
Update branching model in the documentation (!177)
remove ./ from index.rst
Improve documentation (!174)
Added reference for SAXS calculations (!176)
Update type of bin_pos in docs
Added VelocityCylinder module
Change behavior of sort_atomgroup (#88, !152)
get_compound: option for returning indices of topology attributes
Added Tutorial for non-spatial analysis module (!170)
Check atomgroups if they contain any atoms (!172)
New core attributes: bin_edges, bin_area, bin_volume, bin_pos &
bin_width (!167)
Use frame dict in structure.py (!169)
Fix box dimensions for cylindrical boundaries (!168)
rmax for cylindrical systems now uses correct dimensions
Transport module documentation update (!164)
Rename frame dict (!166)
Implement SphereBase and ProfileSphereBase (!162)
Relative path for data (!163)
Create Linux wheels (!160)
Fix Diporder tests (!161)
norm=number: Declare bins with no atoms as nan (!157)
Like a cooking recipe, How-to guides help you solve key problems and use cases. If you
are a total MAICoS beginner, you should start with the Getting started
section.
Small-angle X-ray scattering (SAXS) can be extracted using MAICoS. To follow this how-to
guide, you should download the topology and the
trajectory files of the water system.
The water system consists of 510 water molecules in the liquid state. The
molecules are placed in a periodic cubic cell with an extent of \(25 \times 25
\times 25\,\textrm{Å}^3\).
Extract small angle x-ray scattering (SAXS) intensities#
Let us use the maicos.Saxs class of MAICoS and apply it to all atoms in the
system:
saxs=maicos.Saxs(u.atoms).run(stop=30)
Note
SAXS computations are extensive calculations. Here, to get an overview of the
scattering intensities, we reduce the number of frames to be analyzed from 101
to 30, by adding the stop=30 parameter to the run method. Due to the
small number of analyzed frames, the scattering intensities shown in this tutorial
should not be used to draw any conclusions from the data.
Extract the scattering vectors and the averaged structure factor and SAXS scattering
intensities from the results attribute:
An advantage of full atomistic simulations is their ability to investigate atomic
contributions individually. Let us calculate both oxygen and hydrogen contributions,
respectively:
Let us plot the results for the structure factor, the squared form factor as well
scattering intensities together. For computing the form factor we will use
maicos.lib.math.compute_form_factor(). Note that here we access the results
directly from the results attribute without storing them in individual variables
before:
fig2,ax2=plt.subplots(nrows=3,sharex=True,layout="constrained")# structure factorsax2[0].plot(saxs_O.results.scattering_vectors,saxs_O.results.structure_factors,label="Oxygen",)ax2[0].plot(saxs_H.results.scattering_vectors,saxs_H.results.structure_factors,label="Hydrogen",)# form factorsax2[1].plot(saxs_O.results.scattering_vectors,compute_form_factor(saxs_O.results.scattering_vectors,"O")**2,)ax2[1].plot(saxs_H.results.scattering_vectors,compute_form_factor(saxs_H.results.scattering_vectors,"H")**2,)# scattering intensitieax2[2].plot(saxs_O.results.scattering_vectors,saxs_O.results.scattering_intensities)ax2[2].plot(saxs_H.results.scattering_vectors,saxs_H.results.scattering_intensities)ax2[-1].set_xlabel(r"q (1/Å)")ax2[0].set_ylabel(r"$S(q)$")ax2[1].set_ylabel(r"$f(q)^2$")ax2[2].set_ylabel(r"$I(q)$")ax2[0].legend()fig2.align_labels()fig2.show()
The figure above nicely shows that multiplying the structure factor \(S(q)\) and
the squared form factor \(f(q)^2\) results in the scattering intensity
\(I(q)\). Also, it is worth to notice that due to small form factor of hydrogen
there is basically no contribution of the hydrogen atoms to the total scattering
intensity of water.
Connection of the structure factor to the radial distribution function#
As in details explained in Small-angle X-ray scattering, the structure factor can be
related to the radial distribution function (RDF). We denote this structure factor by
\(S^\mathrm{FT}(q)\) since it is based on Fourier transforming the RDF. The
structure factor which can be directly obtained from the trajectory is denoted by
\(S^\mathrm{D}(q)\).
To relate these two we first calculate the oxygen-oxygen RDF up to half the box length
using MDAnalysis.analysis.rdf.InterRDF and save the result in
variables for an easier access.
We use exclude_same="residue" to exclude atomic self contributions resulting in a
large peak at 0. Next, we convert the RDF into a structure factor using
maicos.lib.math.compute_rdf_structure_factor() and the number density of the
oxygens.
Molecular dynamics simulations are often performed with a constant number of particles.
When modelling confined systems in molecular dynamics simulations, it is often assumed
that the confined geometry extends infinitely, while real systems have a finite size and
are connected to a reservior many times larger than the confined space.
In this case, the number of particles in the system is not constant, but changes over
time. This can be seen as a system that is exchanging particles with a reservoir. The
chemical potential describes how the free energy changes when particles are added to (or
removed from) the system. The chemical potential is therefore a very important quantity
in molecular dynamics simulations of confined systems.
If you want to know more about what the chemical potential means you can take a look at
the references below [1].
How to calculate the ideal component of the chemical potential#
The chemical potential can be split up into different parts
where \(\mu^0\) represents the standard potential of the substance,
\(\mu^\text{ideal}\) represents the component of the potential that would also occur
for an ideal gas and \(\mu^\text{excess}\) represents the excess contribution
generated from the interactions between the particles. In the following calculations we
are only interested in the ideal component.
For our case, we can calculate the ideal component of the potential according to
\[\mu^\text{ideal} = R T \ln \left( \rho \Lambda^3 \right),\]
where \(\Lambda = \hbar \sqrt{\frac{2\pi}{m \cdot k_\mathrm{B} \cdot T}}\) is the
thermal De-Broglie wavelength, i.e. the mean De-Broglie wavelength at temperature
\(T\). Furthermore, \(m\) is the mass of the particles and \(\rho\) is the
mean density of the system. The mean density can be calculated with MAICoS by using the
Density modules. We will exemplify this in the following example using the
maicos.DensityPlanar module.
Now we define a function that calculates \(\mu\) according to the equation above.
We can calculate the Volume \(V\) with MAICoS by calculating the mean density and
deviding it by the mass of the particles. Therefore our function takes the density as
input instead of the Volume.
defmu(rho:np.ndarray,T:float,m:float)->np.ndarray:"""Calculate the chemical potential. The chemical potential is calculated from the density: mu = R T log(rho. / m) """# RT in KJ/molRT=T*const.Boltzmann*const.Avogadro/const.kilo# De Broglie (converted to angstrom)db=(np.sqrt(const.h**2/(2*np.pi*m*const.atomic_mass*const.Boltzmann*T))/const.angstrom)ifnp.all(rho>0):returnRT*np.log(rho*db**3)elifnp.any(rho==0):returnnp.float64("-inf")*np.ones(rho.shape)else:returnnp.float64("nan")*np.ones(rho.shape)
If you’re also interested in the error of the chemical potential we can calculate it
through propagation of uncertainty from the error of the density, calculated by
MAICoS. The error propagates according to
defdmu(rho:np.ndarray,drho:np.ndarray,T:float)->np.ndarray:"""Calculate the error of the chemical potential. The error is calculated from the density using propagation of uncertainty. """RT=T*const.Boltzmann*const.Avogadro/const.kiloifnp.all(rho>0):returnRT*(drho/rho)else:returnnp.float64("nan")*np.ones(rho.shape)
Finally, we can use those previously defined functions to calculate the chemical
potential and its error for an example trajectory called water, whose data can be
downloaded from topology and trajectory. To calculate the mean density we use the module
maicos.DensityPlanar of MAICoS. This example uses a temperature of \(300
\: \rm K\) and a mass of \(18 \: \rm u\).
Unwrapping in combination with the `wrap_compound='atoms` is superfluous. `unwrap` will be set to `False`.
/home/docs/checkouts/readthedocs.org/user_builds/maicos/envs/main/lib/python3.9/site-packages/maicos/core/base.py:456: UserWarning: Your data seems to be correlated with a correlation time which is 2.19 times larger than your step size. Consider increasing your step size by a factor of 4 to get a reasonable error estimate.
self.corrtime = correlation_analysis(self.timeseries)
µ_id = -12.050277646766348
Δµ_id = 0.041243491788978626
In the following example, we will show how to calculate the dielectric profiles as
described in Dielectric constant measurement.
Before producing trajectories to calculate dielectric profiles, you will need to
consider which information you will need and thus need to print out. The dielectric
profile calculators need unwrapped positions and charges of all charged atoms in the
system. Unwrapped refers to the fact that you will need either “repaired” molecules
(which in GROMACS trjconv with the -pbcmol option can do for you) or you will
need to provide topology information for MAICoS to repair molecules for you during the
analysis. Note, however, that unwrapping adds overhead to your calculations. Therefore,
it is recommended to use a repaired trajectory if possible.
In the following, we will give an example of a trajectory of water confined by graphene
sheets simulated via GROMACS. We assume that the GROMACS topology is given by
graphene_water.tpr and the trajectory is given by graphene_water.xtc. Both can be
downloaded under topology and trajectory, respectively.
From these files you can create a MDAnalysis universe object.
This universe object can then be passed to the dielectric profile analysis object,
documented in maicos.DielectricPlanar. It expects
you to pass the atom groups you want to perform the analysis for. In our example, we
have graphene walls and SPC/E water confined between them, where we are interested in
the dielectric behavior of the fluid. Thus, we will first select the water as an
MDAnalysis atom group using MDAnalysis.core.groups.AtomGroup.select_atoms(). In
this case we select the water by filtering for the residue named SOL.
According to the discussion above, we use an unwrapped trajectory and set the unwrap=False keyword.
The simulation trajectory that we provide was simulated using Yeh-Berkowitz dipole
correction. So we don’t want to include dipole corrections, because we assume that our
simulation data adequately represents a 2d-periodic system. For systems that are not
2d-periodic, one should set the is_3d argument to True to include the
dipole correction (see Dielectric constant measurement or the section on boundary
conditions down below).
Since we included a large vacuum region in our simulation that is not of interest for
the dielectric profile, we can set the refgroup to the group containing our water
molecules. This will calculate the dielectric profile relative to the center of mass
of the water in the region of interest.
water=u.select_atoms("resname SOL")# Create the analysis object with the appropriate parameters.analysis_obj=maicos.DielectricPlanar(water,bin_width=0.1,refgroup=water)
This creates the analysis object, but does not yet perform the analysis. To this end
we call the member function run. We may set the verbose
keyword to True to get additional information like a progress bar.
Here you also have the chance to set start and stop keywords to specify which
frames the analysis should start at and where to end. One can also specify a step
keyword to only analyze every step frames.
analysis_obj.run(step=5)
/home/docs/checkouts/readthedocs.org/user_builds/maicos/envs/main/lib/python3.9/site-packages/maicos/core/base.py:456: UserWarning: Your data seems to be correlated with a correlation time which is 2.55 times larger than your step size. Consider increasing your step size by a factor of 5 to get a reasonable error estimate.
self.corrtime = correlation_analysis(self.timeseries)
<maicos.modules.dielectricplanar.DielectricPlanar object at 0x7fad79bdfe50>
Here we use step=5 to run a fast analysis. You may reduce the step parameter
to gain a higher accuracy. Note that the analysis issues a warning concerning the
correlation time of the trajectory, which is automatically calculated as an indication
of how far apart the frames should be chosen to get a statistically uncertainty
indicator estimate. For small trajectories such as the one in this example, this
estimate is not very reliable and one should perform the analysis for longer
trajectories for actual production runs.
Hence, we will ignore the warning for the purpose of this example. Now we are ready to
plot the results. MAICoS provides the outcome of the calculation as sub-attributes of
the results attribute of the analysis object. The results object contains several
attributes that can be accessed directly. For example, the bin positions are stored in
the bin_pos attribute, the parallel and perpendicular dielectric profiles in the
eps_par and eps_perp attributes respectively. (See
maicos.DielectricPlanar for a full list of
attributes.)
For this example, we plot both profiles using matplotlib. Note that MAICoS always
centers the system at the origin or the selected refgroup, so here we set the limits
of the x-axis to [-7, 7]. Then we can only show the relevant part of the output (the
system has a width of 14 Å).
fig,ax=plt.subplots(2,sharex=True)z=analysis_obj.results.bin_posax[0].plot(z,analysis_obj.results.eps_perp)ax[1].plot(z,analysis_obj.results.eps_par)ax[0].set_ylabel(r"$\varepsilon^{-1}_{\perp} - 1$")ax[1].set_ylabel(r"$\varepsilon_{\parallel} - 1$")ax[1].set_xlabel(r"$z$")# Only plot the actual physical system:ax[0].set_xlim([-7,7])ax[1].set_xlim([-7,7])# Also plot the bulk values for referenceax[0].axhline(1/71-1,color="black",linestyle="dashed")ax[1].axhline(71-1,color="black",linestyle="dashed")fig.tight_layout()plt.show()
A few notes on the results: The perpendicular component is given as the inverse of the
dielectric profile, which is the “natural” output (see Dielectric constant measurement
for more details). Furthermore, the bulk values expected for the SPC/E water model are
given as reference lines.
Notice that the parallel component is better converged than the perpendicular
component which in this very short trajectory is still noisy. For trajectories with a
duration of about 1 microsecond, the perpendicular component can be expected to be
converged.
(See Dielectric constant measurement for a thorough discussion of the boundary
conditions). Here we only note that the is_3d flag has to be chosen carefully,
depending on if one simulated a truly 3d periodic system or a 2d periodic one.
Seldomly, vacuum boundary conditions might have been used for Ewald summations instead
of the more common tin-foil boundary conditions. In this case, the vac flag should
be set to True.
One has to be careful when using the dielectric profile analysis for systems with
virtual sites, such as TIP4P water. The reason is that the virtual sites might not be
included in the trajectory, but instead are only constructed by the MD engine during
the force calculation. (For example some LAMMPS fixes)
This problem can be circumvented by creating the virtual sites by hand. This is done
by creating a transformation function that is added to the universe. This function is
called for every frame and can be used to create the virtual sites. The following
example shows how to do this for TIP4P/ε water from a LAMMPS trajectory. Here we only
shift the oxygen charge along the H-O-H angle bisector by a distance of 0.105 Å, which
is the distance between the oxygen charge and the virtual site in the TIP4P/ε water
model.
deftransform_lammps_tip4p(oxygen_index_array:np.ndarray,distance:float)->mda.coordinates.timestep.Timestep:"""Creates a transformation function where for lammps tip4p molecukes. oxygen_index_array is the array of indices where ``atom.type == oxygen_type``. I.e. given by ``np.where(universe.atoms.types == oxygen_type)[0]``. ``distance`` defines by how much the oxygen is moved in the H-O-H plane. """defwrapped(timestep):# shift oxygen charge in case of tip4pthis_pos=timestep.positionsforjinoxygen_index_array:# -2 * vec_o + vec_h1 + vec_h2vec=np.dot(np.array([-2,1,1]),this_pos[j:j+3,:])unit_vec=vec/np.linalg.norm(vec)this_pos[j]+=unit_vec*distancereturntimestepreturnwrappedoxygen_index_array=u.select_atoms("type 2").indicesshift_tip4p_lammps=transform_lammps_tip4p(oxygen_index_array,0.105)u.trajectory.add_transformations(shift_tip4p_lammps)
As the dielectric analysis is usually run for long trajectories, analysis can take a
while. Hence, it is useful to get some preliminary output to see how the analysis is
progressing. Use the concfreq keyword to specify how often the analysis should
output the current results into data files on the disk. The concfreq keyword is
given in units of frames. For example, if concfreq=100, the analysis will output
the current results to the data files every 100 frames.
In the following example, we will show how to calculate the two-dimensional planar
pair distribution functions.
In the following, we will give an example of a trajectory of water confined by graphene
sheets simulated via GROMACS. We assume that the GROMACS topology is given by
graphene_water.tpr and the trajectory is given by graphene_water.xtc. Both can be
downloaded under topology and
trajectory, respectively.
From these files you can create a MDAnalysis universe object.
This universe object can then be passed to maicos.modules.pdfplanar.PDFPlanar
analysis object.
It expects you to pass the atom groups you want to perform the analysis for.
In our example, we have graphene walls and SPC/E water confined between them,
where we are interested in the dielectric behavior of the fluid.
Thus, we will first select the water as an MDAnalysis atom group using
MDAnalysis.core.groups.AtomGroup.select_atoms(). In this case we select
the water by filtering for the residue named SOL.
Next, we can run the analysis over the trajectory.
To this end we call the member function
run.
We may set the verbose keyword to True to get additional information
such a a progress bar.
Here you also have the chance to set start and stop keywords to
specify which frames the analysis should start at and where to end.
One can also specify a step keyword to only analyze every step
frames.
Unwrapping in combination with the `wrap_compound='atoms` is superfluous. `unwrap` will be set to `False`.
<maicos.modules.densityplanar.DensityPlanar object at 0x7fad7be354c0>
The results of the analysis are stored in the results member variable.
As per the documentation of PDFPlanar, we get three different arrays:
bin_pos, bins, and pdf.
Here, bin_pos is the position of the center of the slices in the
z-direction, bins contains the bin positions of the pair distribution,
which are shared by all slices and correspondingly pdf contains each
profile that our code produced.
In the following, we loop over all the pdf slices and plot each of them.
Furthermore, in a separate subplot, we also show the density profile of the
water molecules and highlight the slices that each pdf is calculated for.
Hence, the same color in both plots corresponds to the same slice for the
pair distribution function and the density profile.
%%
# u per cubic angstrom to kg per cubic meter factoru2kg=1660.5390665999998fig,ax=plt.subplots(1,2)print(ax)tax=ax[1].twinx()shift=0shift_amount=2foriinrange(0,len(ana_obj.results.pdf[0])):bin_pos=ana_obj.results.bin_pos[i]pdf_prof=ana_obj.results.pdf[:,i]mean_bulk=np.mean(pdf_prof[ana_obj.results.bins>10])line=ax[0].plot(ana_obj.results.bins,ana_obj.results.pdf[:,i]/mean_bulk+shift)tax.vlines(7+bin_pos,0,3500,alpha=0.7,color=line[0].get_color(),linestyles="dashed")tax.axvspan(7+bin_pos-0.25*2,7+bin_pos+0.25*2,color=line[0].get_color(),alpha=0.3,)shift+=shift_amountax[0].set_ylabel(r"$g(r)$")ax[0].set_xlabel(r"$r$ [$\AA$]")ax[0].set_xlim((0,15))ax[0].hlines(1,0,15,color="black",linestyles="dashed",alpha=0.5)tax.plot(7+dana_obj.results.bin_pos,dana_obj.results.profile*u2kg,color="black",label="Density",)tax.set_xlim((1,7))ax[1].set_yticks(tax.get_yticks())ax[1].set_yticklabels([])tax.set_ylabel(r"$\rho(z)$ [kg/m$^3$]")ax[1].set_xlabel(r"$z$ [$\AA$]")# Set the padding between the axis to zeroplt.tight_layout()fig.subplots_adjust(wspace=0,hspace=0)fig.dpi=200
[<Axes: > <Axes: >]
Total running time of the script: (1 minutes 12.400 seconds)
Calculating and interpreting dipolar pair correlation functions#
In this examples we will calculate dipolar pair correlation functions in real and
Fourier space using the maicos modules maicos.RDFDiporder and
maicos.DiporderStructureFactor. We will show how these pair correlation
functions are connected to each other and electrostatic properties like the dielectric
constant \(\varepsilon\) and the Kirkwood factor \(g_K\).
Our example system is \(N=512\) rigid SPC/E water molecules simulated in an NVT
ensemble at \(300\,\mathrm{K}\) in a cubic cell of \(L=24.635\,Å\). To follow
this how-to guide, you should download the topology and
the trajectory files of the system. Below we load the
system, report and store some system properties for later usage.
The results of our first property calculations show that the number density as well as
the dipole moment of a single water molecule is consistent with the literature
[1].
To start with the analysis we first look at the dielectric constant of the system. If
you run a simulation using an Ewald simulation technique as usually done, the
dielectric constant for such system with metallic boundary conditions is given
according to Neumann[2] by
\[\varepsilon = 1 + \frac{\langle M^2 \rangle_\mathrm{MBE} - \langle
M \rangle_\mathrm{MBE}^2}{3 \varepsilon_0 V k_B T}\]
where
\[\boldsymbol M = \sum_{i=1}^N \boldsymbol \mu_i\]
is the total dipole moment of the box, \(V\) its volume and \(\varepsilon_0\)
the vacuum permittivity. We use the subscript in the expectation value
\(\mathrm{MBE}\) indicating that the equation only holds for simulations with
Metallic Boundary conditions in an Ewald simulation style. As shown
in the equation for \(\varepsilon(\mathrm{MBE})\) the dielectric constant here is
a total cell quantity connecting the fluctuations of the total dipole moment to the
dielectric constant. We can calculate \(\varepsilon_\mathrm{MBE}\) using the
MDAnalysis.analysis.dielectric.DielectricConstant module of MDAnalysis.
Knowing the dielectric constant we can also calculate the Kirkwood factor \(g_K\)
which is a measure describing molecular correlations. I.e a Kirkwood factor greater
than 1 indicates that neighboring molecular dipoles are more likely to align in the
same direction, enhancing the material’s polarization and, consequently, its
dielectric constant. Based on the dielectric constant \(\varepsilon\) Kirkwood and
Fröhlich derived the relation for the factor \(g_K\) according to
\[\frac{ N \mu^2 g_K}{\varepsilon_0 V k_B T} = \frac{(\varepsilon -
1)(2\varepsilon + 1)}{\varepsilon}\]
This relation is valid for a sample in an infinity, homogenous medium of the same
dielectric constant. Below we implement this equation and calculate the factor for our
system.
defkirkwood_factor_KF(dielectric_constant:float,volume:float,n_dipoles:float,molecular_dipole_moment:float,temperature:float=300,)->float:"""Kirkwood factor in the Kirkwood-Fröhlich way. For the sample in an infinity, homogenous medium of the same dielectric constant. Parameters ---------- dielectric_constant : float the static dielectric constant ɛ volume : float system volume in Å^3 n_dipoles : float number of dipoles molecular_dipole_moment : float dipole moment of a molecule (eÅ) temperature : float temperature of the simulation K """dipole_moment_sq=(molecular_dipole_moment*scipy.constants.elementary_charge*scipy.constants.angstrom)**2factor=(scipy.constants.epsilon_0*(volume*scipy.constants.angstrom**3)*scipy.constants.Boltzmann*temperature)return(factor/(dielectric_constant*n_dipoles*dipole_moment_sq)*(dielectric_constant-1)*(2*dielectric_constant+1))kirkwood_KF=kirkwood_factor_KF(dielectric_constant=epsilon_mbe.results.eps_mean,volume=volume,n_dipoles=u.residues.n_residues,molecular_dipole_moment=dipole_moment,)print(f"g_K = {kirkwood_KF:.2f}")
g_K = 2.39
This value means there is a quite strong correlation between neighboring water
molecules. The dielectric constant \(\varepsilon\) is a material property and does
not depend on the boundary condition. Instead, the Kirkwood factor is indicative of
dipole-dipole correlations which instead depend on the boundary condistions in the
simulation. This relation is described and shown below.
Connecting the Kirkwood factor to real space dipolar pair-correlation functions#
The \(r\)-dependent Kirkwood factor can also be calculated from real space
dipole-dipole pair correlation function [3]
where \(\hat{\boldsymbol{\mu}}\) is the normalized dipole moment and
\(n_i(r)\) is the number of dipoles within a spherical shell of distance \(r\)
and \(r + \delta r\) from dipole \(i\). We compute the pair correlation
function using the maicos.RDFDiporder module up to half of the length of
cubic simulation box. We drop a delta like contribution in \(r=0\) caused by
interaction of the dipole with itself.
While, for a truly infinite system, the \(r\)- dependent Kirkwood factor,
\(G_\mathrm{K}(r)\) is short range [5][4], the boundary conditions on a finite system
introduce long-range effects. In particular, within MBE,
Caillol[6] has shown that \(G_\mathrm{K}(r)\) has a
spurious asymptotic growth proportional to \(r^3/V\). This effect is stil present
at \(r=r_K\), where \(r_K\) (here approximately 6 Å) indicates a distance
after which all the physical features of
\(g_\mathrm{\hat{\boldsymbol{\mu}},\hat{\boldsymbol{\mu}}}(r)\) are extinct. For
more details see the original literature. Below we show the pair correlation function
as well as the radial and the (static) Kirkwood factor as gray dashed line.
Notice that the Kirkwood Fröhlich estimator for the Kirkwood factors differs from the
value of \(G_K(r=r_K)\) obtained from simulations in the MBE ensemble.
<maicos.modules.diporderstructurefactor.DiporderStructureFactor object at 0x7fad78f6e2b0>
As also shown how to on SAXS calculations the structure factor can
also be obtained directly from the real space correlation functions using Fourier
transformation via
The fit contains no linear term because of the structure factors’ symmetry around 0.
n_max=5# take `n_max` first data points of the structure factor for the fit# q_max is the maximal q value corresponding to the last point taken for the fitq_max=diporder_structure_factors.results.scattering_vectors[n_max]print(f"q_max = {q_max:.2f} Å")eps_fit=np.polynomial.Polynomial.fit(x=diporder_structure_factors.results.scattering_vectors[:n_max],y=diporder_structure_factors.results.structure_factors[:n_max],deg=(0,2),domain=(-q_max,q_max),)print(f"Best fit parameters: S_0 = {eps_fit.coef[0]:.2f}, S_2 = {eps_fit.coef[2]:.2f} Å^2")
q_max = 0.63 Å
Best fit parameters: S_0 = 2.45, S_2 = -0.84 Å^2
You see that the orange and the blue curve agree. We also add the fit as a green
dotted line. From \(S_0\) we can extract the dielectric constant via
[7]
This formula can be inverted and an estimator for \(\varepsilon_S\) can be
obtained as we show below.
defdielectric_constant_struc_fact(S_0:float,molecular_dipole_moment:float)->float:"""The dielectric constant calculated from the q->0 limit of the structure factor. Parameters ---------- q_0_limit : float the q -> 0 limit if the dipololar structure factor molecular_dipole_moment : float dipole moment of a molecule (eÅ) """dipole_moment_sq=(molecular_dipole_moment*scipy.constants.angstrom*scipy.constants.elementary_charge)**2S_limit=(dipole_moment_sq*S_0/scipy.constants.epsilon_0/scipy.constants.elementary_charge/scipy.constants.angstrom**3)return(np.sqrt((S_limit)**2+2*S_limit+9)+S_limit+1)/4epsilon_struct_fac=dielectric_constant_struc_fact(S_0=eps_fit.coef[0],molecular_dipole_moment=dipole_moment)print(f"ɛ_S = {epsilon_struct_fac:.2f}")
ɛ_S = 53.53
Which is quite close the value calculated directly from the total dipole fluctuations
of the simulations \(\varepsilon_\mathrm{MBE}\approx69\). This difference may
result in the very crude fit that is performed and it could be drastically improved by
a Bayesian fitting method as for example for fitting the Seebeck coefficient from a
similar structure factor [8].
The reference guides contain details for all the analysis modules. The API documentation
gives details on how the calculators and additional functions can be used from each
language.
This is a list of all analysis modules provided by MAICoS. Note that we do not have an
example section for each module. Instead, we refer to our tutorial
and How-to guides. Once you understand the basic structure taught there, you can
work with all modules. If not, feel free to raise an issue in Gitlab or ask us on
Discord.
Calculations are carried out for
mass\((\rm u \cdot Å^{-3})\), number\((\rm Å^{-3})\) or charge\((\rm e \cdot Å^{-3})\) density profiles along certain cartesian axes [x,y,z] of the simulation cell. Cell dimensions are allowed to fluctuate in time.
For grouping with respect to molecules, residues etc., the corresponding
centers (i.e., center of mass), taking into account periodic boundary conditions,
are calculated. For these calculations molecules will be unwrapped/made whole.
Trajectories containing already whole molecules can be run with unwrap=False to
gain a speedup. For grouping with respect to atoms, the unwrap option is always
ignored.
For the correlation analysis the 0th bin of the 0th’s
group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Calculations are carried out for
mass\((\rm u \cdot Å^{-3})\), number\((\rm Å^{-3})\) or charge\((\rm e \cdot Å^{-3})\) density profiles along certain cartesian axes [x,y,z] of the simulation cell. Cell dimensions are allowed to fluctuate in time.
For grouping with respect to molecules, residues etc., the corresponding
centers (i.e., center of mass), taking into account periodic boundary conditions,
are calculated. For these calculations molecules will be unwrapped/made whole.
Trajectories containing already whole molecules can be run with unwrap=False to
gain a speedup. For grouping with respect to atoms, the unwrap option is always
ignored.
For the correlation analysis the central bin
(\(N \backslash 2\)) of the 0th’s group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Partial mass density profiles can be used to calculate the ideal component of the
chemical potential. For details, take a look at the corresponding How-to
guide.
Calculations are carried out for
mass\((\rm u \cdot Å^{-3})\), number\((\rm Å^{-3})\) or charge\((\rm e \cdot Å^{-3})\) density profiles along certain cartesian axes [x,y,z] of the simulation cell. Cell dimensions are allowed to fluctuate in time.
For grouping with respect to molecules, residues etc., the corresponding
centers (i.e., center of mass), taking into account periodic boundary conditions,
are calculated. For these calculations molecules will be unwrapped/made whole.
Trajectories containing already whole molecules can be run with unwrap=False to
gain a speedup. For grouping with respect to atoms, the unwrap option is always
ignored.
For the correlation analysis the 0th bin of the 0th’s
group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
rmin (float) – Minimal radial coordinate relative to the center of mass of the refgroup for
evaluation (in Å).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Components are calculated along the axial (\(z\)) and radial (\(r\))
direction either with respect to the center of the simulation box or the center of
mass of the refgroup, if provided. The axial direction is selected using the dim
parameter.
For correlation analysis, the component along the \(z\) axis is used.
For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
For correlation analysis, the norm of the parallel total dipole moment is used.
For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
Also, please read and cite
Schlaich et al.[1] and Refs.
[2],
[3].
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
This module, given a molecular dynamics trajectory, produces a .txt file
containing the complex dielectric function as a function of the (linear, not radial
- i.e., \(\nu\) or \(f\), rather than \(\omega\)) frequency, along with
the associated standard deviations. The algorithm is based on the Fluctuation
Dissipation Relation: \(\chi(f) = -1/(3 V k_B T \varepsilon_0)
\mathcal{L}[\theta(t) \langle P(0) dP(t)/dt\rangle]\), where \(\mathcal{L}\) is
the Laplace transformation.
Note
The polarization time series and the average system volume are also saved.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
segs (int) – Sets the number of segments the trajectory is broken into.
df (float) – The desired frequency spacing in THz. This determines the minimum frequency
about which there is data. Overrides segs option.
bins (int) – Determines the number of bins used for data averaging; (this parameter sets the
upper limit). The data are by default binned logarithmically. This helps to
reduce noise, particularly in the high-frequency domain, and also prevents plot
files from being too large.
binafter (int) – The number of low-frequency data points that are left unbinned.
nobin (bool) – Prevents the data from being binned altogether. This can result in very large
plot files and errors.
Components are calculated along the radial (\(r\)) direction either with respect
to the center of the simulation box or the center of mass of the refgroup, if
provided.
For correlation analysis, the radial (\(r\)) component is used.
For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
rmin (float) – Minimal radial coordinate relative to the center of mass of the refgroup for
evaluation (in Å).
Angle timeseries of dipole moments with respect to an axis.
The analysis can be applied to study the orientational dynamics of water molecules
during an excitation pulse. For more details read
Elgabarty et al.[1].
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
Calculations include the projected dipole density
\(P_0⋅ρ(z)⋅\cos(θ[z])\), the dipole orientation \(\cos(θ[z])\), the squared
dipole orientation \(\cos²(Θ[z])\) and the number density \(ρ(z)\).
For the correlation analysis the 0th bin of the 0th’s
group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Calculations include the projected dipole density
\(P_0⋅ρ(z)⋅\cos(θ[z])\), the dipole orientation \(\cos(θ[z])\), the squared
dipole orientation \(\cos²(Θ[z])\) and the number density \(ρ(z)\).
For the correlation analysis the central bin
(\(N \backslash 2\)) of the 0th’s group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Calculations include the projected dipole density
\(P_0⋅ρ(z)⋅\cos(θ[z])\), the dipole orientation \(\cos(θ[z])\), the squared
dipole orientation \(\cos²(Θ[z])\) and the number density \(ρ(z)\).
For the correlation analysis the 0th bin of the 0th’s
group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Extension the standard structure factor \(S(q)\) by weighting it with different
the normalized dipole moment \(\hat{\boldsymbol{\mu}}\) of a group according
to
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
The kinetic energy function computes the translational and rotational kinetic energy
with respect to molecular center (center of mass, center of charge) of a molecular
dynamics simulation trajectory.
The analysis can be applied to study the dynamics of water molecules during an
excitation pulse. For more details read
Elgabarty et al.[1].
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
refpoint (str) – reference point for molecular center: center of mass ("com") or center of
charge ("coc").
Shell-wise one-dimensional (cylindrical) pair distribution functions.
The one-dimensional pair distribution functions \(g_{\text{1d}}(\phi)\)
and \(g_{\text{1d}}(z)\) describes the pair distribution to particles
which lie on the same cylinder along the angular and axial directions
respectively. These functions can be used in cylindrical systems that are
inhomogeneous along radial coordinate, and homogeneous in the angular and
axial directions. It gives the average number density of \(g2\) as a
function of angular and axial distances respectively from a \(g1\) atom.
Then the angular pair distribution function is
Even though due to consistency reasons the results are called pair distribution
functions the output is not unitless. The default output is is in dimension of
number/volume in \(Å^{-3}\). If density is set to True, the
output is normalised by the density of \(g2\).
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The pair distribution function \(g_\mathrm{2D}(r)\) describes the
spatial correlation between atoms in \(g_1\) and atoms in
\(g_2\), which lie in the same plane.
It gives the average number density of \(g_2\) atoms as a function of lateral
distance \(r\) from a centered \(g_1\) atom.
PDFPlanar can be used in systems that are inhomogeneous along one axis,
and homogeneous in a plane.
In fully homogeneous systems and in the limit of small ‘dzheight’
\(\Delta z\), it is the same as the well known three dimensional PDF.
where the brackets \(\langle \cdot \rangle\) denote the ensemble
average. \(\delta(r- r_{ij})\) counts the \(g_2\) atoms at distance
\(r\) from atom \(i\).
\(\delta(z_{ij})\) ensures that only atoms, which lie
in the same plane \(z_i = z_j\), are considered for the PDF.
Discretized for computational purposes the equation reads as
where \(\Delta V_i(r)\) is a ring around atom i, with inner
radius \(r - \frac{\Delta r}{2}\), outer radius
\(r + \frac{\Delta r}{2}\) and height \(2 \Delta z\).
As the density to normalise the PDF with is unknown, the output is in
the dimension of number/volume in 1/Å^3.
Functionally, PDFPlanar bins all pairwise \(g_1\)-\(g_2\) distances,
where the z distance is smaller than ‘dzheight’ in a histogram.
pdf_bin_width (float) – Binwidth of bins in the histogram of the PDF (Å).
dzheight (float) – dz height of a PDF slab \(\Delta z\) (Å). \(\Delta z\) is
introduced to discretize the delta function \(\delta(z_{ij})\).
It is the maximum \(z\) distance between atoms which are
considered to lie in the same plane.
In the limit of \(\Delta z \to 0\), PDFPlanar reaches the
continous limit. However, if \(\Delta z\) is too small, there
are no atoms in g2 to sample.
We recommend a choice of \(\Delta z\) that is 1/10th of
a bond length.
dmin (float) – Minimum pairwise distance between g1 and g2 (Å).
dmax (float) – Maximum pairwise distance between g1 and g2 (Å).
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
where \(\hat{\boldsymbol{\mu}}\) is the normalized dipole moment of a
grouping and \(n_i(r)\) is the number of dipoles within a spherical shell of
distance \(r\) and \(r + \delta r\) from dipole \(i\).
For the correlation time estimation the module will use the value of the RDF with
the largest possible \(r\) value.
Maximal radial coordinate relative to the center of mass of the refgroup for
evaluation (in Å).
If rmax=None, the box extension is taken.
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
norm (str, {'rdf', 'density', 'none'}) – For ‘rdf’ calculate \(g_{ab}(r)\). For ‘density’ the single group density
\(n_{ab}(r)\) is computed. ‘none’ computes the number of particles
occurences in each spherical shell.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
This module computes the structure factor \(S(q)\), the scattering intensity
\(I(q)\) and their corresponding scattering vectors \(q\). For a system
containing only one element the structure factor and the scattering intensity are
connected via the form factor \(f(q)\)
By default the scattering vectors \(\boldsymbol{q}\) are binned according to
their length \(q\) using a bin width given by dq. Setting the option
bin_spectrum=False, also the raw scattering vectors and their corresponding
Miller indices can be saved. Saving the scattering vectors and Miller indices is
only possible when the box vectors are constant in the whole trajectory (NVT) since
for changing cells the same Miller indices correspond to different scattering
vectors.
Analyzed scattering vectors \(q\) can be restricted by a minimal and maximal
angle with the z-axis. For 0 and 180, all possible vectors are taken into
account. To obtain the scattering intensities, the structure factor is normalized by
an element-specific form factor based on Cromer-Mann parameters
Prince[1].
For the correlation time estimation the module will use the value of the scattering
intensity with the largest possible \(q\) value.
For an example on the usage refer to How-to: SAXS.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
bin_spectrum (bool) – Bin the spectrum. If False Miller indices of q-vector are returned.
Only works for NVT simulations.
Currently only atomistic temperature profiles are supported. Therefore grouping per
molecule, segment, residue, or fragment is not possible.
For the correlation analysis the central bin
(\(N \backslash 2\)) of the 0th’s group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Reads in coordinates and velocities from a trajectory and calculates a velocity
\([\mathrm{Å/ps}]\) or a flux per unit area \([\mathrm{Å^{-2}\,ps^{-1}}]\)
profile along a given axis.
The grouping keyword gives you fine control over the velocity profile, e.g. you
can choose atomar or molecular velocities. Note that if the first one is employed
for complex compounds, usually a contribution corresponding to the vorticity appears
in the profile.
For the correlation analysis the 0th bin of the 0th’s
group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Reads in coordinates and velocities from a trajectory and calculates a velocity
\([\mathrm{Å/ps}]\) or a flux per unit area \([\mathrm{Å^{-2}\,ps^{-1}}]\)
profile along a given axis.
The grouping keyword gives you fine control over the velocity profile, e.g. you
can choose atomar or molecular velocities. Note that if the first one is employed
for complex compounds, usually a contribution corresponding to the vorticity appears
in the profile.
For the correlation analysis the central bin
(\(N \backslash 2\)) of the 0th’s group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Base class derived from MDAnalysis for defining multi-frame analysis.
The class is designed as a template for creating multi-frame analyses. This class
will automatically take care of setting up the trajectory reader for iterating, and
it offers to show a progress meter. Computed results are stored inside the
results attribute. To define a new analysis, AnalysisBase needs to be
subclassed and _single_frame() must be defined. It is also possible to define
_prepare() and _conclude() for pre- and post-processing. All results
should be stored as attributes of the MDAnalysis.analysis.base.Results
container.
During the analysis, the correlation time of an observable can be estimated to
ensure that calculated errors are reasonable. For this, the _single_frame()
method has to return a single float. For details on the computation of the
correlation and its further analysis refer to
maicos.lib.util.correlation_analysis().
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
wrap_compound (str) – The group which will be kept together through the wrap processes.
Allowed values are: "atoms", "group", "residues",
"segments", "molecules", or "fragments".
ValueError – If any of the provided AtomGroups (atomgroup or refgroup) does
not contain any atoms.
Example
To write your own analysis module you can use the example given below. As with all
MAICoS modules, this inherits from the maicos.core.base.AnalysisBase class.
The example will calculate the average box volume and stores the result within the
result object of the class.
In the following the analysis module itself. Due to the similar structure of all
MAICoS modules you can render the parameters using the
maicos.lib.util.render_docs() decorator. The decorator will replace special
keywords with a leading $ with the actual docstring as defined in
maicos.lib.util.DOC_DICT.
>>> @render_docs... classNewAnalysis(AnalysisBase):... '''Analysis class calcuting the average box volume.'''...... def__init__(... self,... atomgroup:mda.AtomGroup,... concfreq:int=0,... temperature:float=300,... output:str="outfile.dat",... ):... super().__init__(... atomgroup=atomgroup,... refgroup=None,... unwrap=False,... jitter=0.0,... wrap_compound="atoms",... concfreq=concfreq,... )...... self.temperature=temperature... self.output=output...... def_prepare(self):... '''Set things up before the analysis loop begins.'''... # self.atomgroup refers to the provided `atomgroup`... # self._universe refers to full universe of given `atomgroup`... self.volume=0...... def_single_frame(self):... '''Calculate data from a single frame of trajectory....... Don't worry about normalising, just deal with a single frame.... '''... # Current frame index: self._frame_index... # Current timestep object: self._ts...... volume=self._ts.volume... self.volume+=volume...... # Eeach module should return a characteristic scalar which is used... # by MAICoS to estimate correlations of an Analysis.... returnvolume...... def_conclude(self):... '''Finalise the results you've gathered....... Called at the end of the run() method to finish everything up.... '''... self.results.volume=self.volume/self.n_frames... logger.info(... "Average volume of the simulation box "... f"{self.results.volume:.2f} ų"... )...... defsave(self)->None:... '''Save results of analysis to file specified by ``output``....... Called at the end of the run() method after _conclude.... '''... self.savetxt(... self.output,np.array([self.results.volume]),columns="volume / ų"... )...
An extension of the numpy savetxt function. Adds the command line input to the
header and checks for a doubled defined filesuffix.
Return a header for the text file to save the data to. This method builds a
generic header that can be used by any MAICoS module. It is called by the save
method of each module.
The information it collects is:
timestamp of the analysis
name of the module
version of MAICoS that was used
command line arguments that were used to run the module
module call including the default arguments
number of frames that were analyzed
atomgroup that was analyzed
output messages from modules and base classes (if they exist)
Running a collection of analysis classes on the same single trajectory.
Warning
AnalysisCollection is still experimental. You should not use it for anything
important.
An analyses with AnalysisCollection can lead to a speedup compared to running
the individual analyses, since the trajectory loop is performed only once. The class
requires that each analysis is a child of AnalysisBase. Additionally, the
trajectory of all analysis_instances must be the same. It is ensured that all
analysis instances use the same original timestep and not an altered one from a
previous analysis instance.
Parameters:
*analysis_instances (AnalysisBase) – Arbitrary number of analysis instances to be run on the same trajectory.
Raises:
AttributeError – If the provided analysis_instances do not work on the same trajectory.
step (int) – number of frames to skip between each analysed frame
frames (array_like) – array of integers or booleans to slice trajectory; frames can only be
used instead of start, stop, and step. Setting bothframes and at least one of start, stop, step to a
non-default value will raise a ValueError.
progressbar_kwargs (dict) – ProgressBar keywords with custom parameters regarding progress bar position,
etc; see MDAnalysis.lib.log.ProgressBar for full list.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
weighting_function (callable) – The function calculating the array weights for the histogram analysis. It must
take an AtomGroup as first argument and a
grouping ("atoms", "residues", "segments", "molecules",
"fragments") as second.
Additional parameters can be given as weighting_function_kwargs. The
function must return a numpy.ndarray with the same length as the number of group
members.
weighting_function_kwargs (dict) – Additional keyword arguments for weighting_function
normalization ({"none", "number", "volume"}) – The normalization of the profile performed in every frame. If None, no
normalization is performed. If number, the histogram is divided by the number
of occurences in each bin. If volume, the profile is divided by the volume of
each bin.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
wrap_compound (str) – The group which will be kept together through the wrap processes.
Allowed values are: "atoms", "group", "residues",
"segments", "molecules", or "fragments".
Area of the rectangle of each bin in the current frame. Calculated via
\(L_x \cdot L_y / N_\mathrm{bins}\) where \(L_x\) and \(L_y\) are
the box lengths perpendicular to the dimension of evaluations given by dim.
\(N_\mathrm{bins}\) is the number of bins.
Base class for computing profiles in a cartesian geometry.
For the correlation analysis the 0th bin of the 0th’s
group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
weighting_function (callable) – The function calculating the array weights for the histogram analysis. It must
take an AtomGroup as first argument and a
grouping ("atoms", "residues", "segments", "molecules",
"fragments") as second.
Additional parameters can be given as weighting_function_kwargs. The
function must return a numpy.ndarray with the same length as the number of group
members.
weighting_function_kwargs (dict) – Additional keyword arguments for weighting_function
normalization ({"none", "number", "volume"}) – The normalization of the profile performed in every frame. If None, no
normalization is performed. If number, the histogram is divided by the number
of occurences in each bin. If volume, the profile is divided by the volume of
each bin.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
Maximal radial coordinate relative to the center of mass of the refgroup for
evaluation (in Å).
If rmax=None, the box extension is taken.
wrap_compound (str) – The group which will be kept together through the wrap processes.
Allowed values are: "atoms", "group", "residues",
"segments", "molecules", or "fragments".
Volume of an hollow cylinder of each bin (in Å^3) in the current frame.
Calculated via \(\pi L \left( r_{i+1}^2 - r_i^2 \right)\) where i is the
index of the bin.
Base class for computing radial profiles in a cylindrical geometry.
For the correlation analysis the 0th bin of the 0th’s
group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
weighting_function (callable) – The function calculating the array weights for the histogram analysis. It must
take an AtomGroup as first argument and a
grouping ("atoms", "residues", "segments", "molecules",
"fragments") as second.
Additional parameters can be given as weighting_function_kwargs. The
function must return a numpy.ndarray with the same length as the number of group
members.
weighting_function_kwargs (dict) – Additional keyword arguments for weighting_function
normalization ({"none", "number", "volume"}) – The normalization of the profile performed in every frame. If None, no
normalization is performed. If number, the histogram is divided by the number
of occurences in each bin. If volume, the profile is divided by the volume of
each bin.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
rmin (float) – Minimal radial coordinate relative to the center of mass of the refgroup for
evaluation (in Å).
wrap_compound (str) – The group which will be kept together through the wrap processes.
Allowed values are: "atoms", "group", "residues",
"segments", "molecules", or "fragments".
Surface area (in Å^2) of the sphere of each bin with radius bin_pos in the
current frame. Calculated via \(4 \pi r_i^2\) where \(i\) is the index
of the bin.
volume of a spherical shell of each bins (in Å^3) of the current frame.
Calculated via \(4\pi/3 \left(r_{i+1}^3 - r_i^3 \right)\) where i is the
index of the bin.
Base class for computing radial profiles in a spherical geometry.
For the correlation analysis the 0th bin of the 0th’s
group profile is used. For further information on the correlation analysis please
refer to maicos.core.base.AnalysisBase or the General design
section.
When True, molecules that are broken due to the periodic boundary
conditions are made whole.
If the input contains molecules that are already whole, speed up the calculation
by disabling unwrap. To do so, use the flag -no-unwrap when using MAICoS
from the command line, or use unwrap=False when using MAICoS from the Python
interpreter.
Note: Molecules containing virtual sites (e.g. TIP4P water models) are not
currently supported in MDAnalysis. In this case, you need to provide unwrapped
trajectory files directly, and disable unwrap. Trajectories can be unwrapped,
for example, using the trjconv command of GROMACS.
refgroup (MDAnalysis.core.groups.AtomGroup) – Reference AtomGroup used for the calculation.
If refgroup is provided, the calculation is performed relative to the center
of mass of the AtomGroup. If refgroup is None the calculations are
performed with respect to the center of the (changing) box.
Magnitude of the random noise to add to the atomic positions.
A jitter can be used to stabilize the aliasing effects sometimes appearing when
histogramming data. The jitter value should be about the precision of the
trajectory. In that case, using jitter will not alter the results of the
histogram. If jitter=0.0 (default), the original atomic positions are kept
unchanged.
You can estimate the precision of the positions in your trajectory with
maicos.lib.util.trajectory_precision(). Note that if the precision is not
the same for all frames, the smallest precision should be used.
concfreq (int) – When concfreq (for conclude frequency) is larger than 0, the conclude
function is called and the output files are written every concfreq
frames.
rmin (float) – Minimal radial coordinate relative to the center of mass of the refgroup for
evaluation (in Å).
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
weighting_function (callable) – The function calculating the array weights for the histogram analysis. It must
take an AtomGroup as first argument and a
grouping ("atoms", "residues", "segments", "molecules",
"fragments") as second.
Additional parameters can be given as weighting_function_kwargs. The
function must return a numpy.ndarray with the same length as the number of group
members.
weighting_function_kwargs (dict) – Additional keyword arguments for weighting_function
normalization ({"none", "number", "volume"}) – The normalization of the profile performed in every frame. If None, no
normalization is performed. If number, the histogram is divided by the number
of occurences in each bin. If volume, the profile is divided by the volume of
each bin.
Without proper treatment of periodic boundrary conditions (PBC) most algorithms will
result in wrong center calculations. As shown below without treating PBC the center
of mass is located in the center of the box
+-----------+|||1x2|||+-----------+
However, the distance accross the box boundary is shorter and therefore the center
with PBC should be located somwhere else. The correct way to calculate the center is
described in Bai and Breen[1] where coordinates of the particles
are projected on a circle and weighted by their mass in this two dimensional space.
The center of mass is obtained by transforming this point back to the corresponding
point in the real system. This is done seperately for each dimension.
Reasons for doing this include the analysis of clusters in periodic boundrary
conditions and consistent center of mass calculation across box boundraries. This
procedure results in the right center of mass as seen below
\(f(q)\) is expressed in terms of the scattering vector as
\[f(q) = \sum_{i=1}^4 a_i e^{-b_i q^2/(4\pi)^2} + c \,.\]
The coefficients \(a_{1,\dots,4}\), \(b_{1,\dots,4}\) and \(c\) are also
known as Cromer-Mann X-ray scattering factors and are documented in
Prince[2].
where \(q\) is the magnitude of the scattering vector. The calculation is
performed via a discrete sine transform as implemented in scipy.fftpack.dst().
Uses fast fourier transforms to give the correlation function of two arrays, or, if
only one array is given, the autocorrelation. Setting subtract_mean=True causes
the mean to be subtracted from the input data.
Parameters:
a (numpy.ndarray) – The first input array to calculate the correlation
b (numpy.ndarray) – The second input array. If None, autocorrelation of a is calculated.
subtract_mean (bool) – If True, subtract the mean from the input data.
where \(N_\mathrm{cut} < N\) is a subset of the time series of length \(N\)
and \(C(t)\) is the discrete-time autocorrelation function. To obtain the upper
limit of the sum \(N_\mathrm{cut}\) two different methods are provided:
For “chodera” [3]\(N_\mathrm{cut}\) is given by the time when \(C(t)\)
crosses zero the first time.
For “sokal” [4]\(N_\mathrm{cut}\) is determined
iteratively by stepwise increasing until
\[N_\mathrm{cut} \geq c \cdot \tau\]
where \(c\) is the constant sokal_factor. If the condition is never
fulfilled, -1 is returned, indicating that the time series does not provide
sufficient statistics to estimate a
correlation time.
While both methods give the same correlation time for a smooth time series that
decays to 0, “sokal” will results in a more reasonable result for actual time series
that are noisy and cross zero several times.
Parameters:
timeseries (numpy.ndarray) – The time series used to calculate the correlation time from.
method ({"sokal", "chodera"}) – Method to choose summation cutoff \(N_\mathrm{cut}\).
mintime (int) – Minimum possible value for \(N_\mathrm{cut}\).
sokal_factor (float) – Cut-off factor \(c\) for the Sokal method.
Returns:
tau – Integrated correlation time \(\tau\). If -1 (only for
method="sokal") the provided time series does not provide sufficient
statistics to estimate a correlation time.
Inverse Fourier transformation using fast Fourier transformation (FFT).
Takes the frequency series and the function as arguments. By default, returns the
iFT and the time series. Setting indvar=False means the function returns only the
iFT.
The mean of a data set can easily be calculated from the data points. However this
requires one to keep all data points on hand until the end of the calculation.
>>> np.mean([1,3,5,7])4.0
Alternatively, one can update an existing mean, this requires only knowledge of the
total number of samples.
Give the corr. function of the scalar product of two vector timeseries.
Arguments should be given in the form a[t, i], where t is the time variable along
which the correlation is calculated, and i indexes the vector components.
Parameters:
a (numpy.ndarray) – The first vector timeseries of shape (t, i).
b (numpy.ndarray) – The second vector timeseries of shape (t, i). If None, correlation with
itself is calculated.
subtract_mean (bool) – If True, subtract the mean from the timeseries before calculating the
correlation.
Returns:
The correlation function of the scalar product of the vector timeseries.
The shape of the array is preserved, but the elements are symmetrized with respect
to the given axis.
Parameters:
m (array_like) – Input array to symmetrize
axis (int, tuple(int)) – Axis or axes along which to symmetrize over. The default, axis=None, will
symmetrize over all of the axes of the input array. If axis is negative it
counts from the last to the first axis. If axis is a tuple of ints,
symmetrizing is performed on all of the axes specified in the tuple.
inplace (bool) – Do symmetrizations inplace. If False a new array is returned.
Returns:
out – the symmetrized array
Return type:
array_like
Notes
symmetrize uses np.flip() for flipping the indices.
where \(\boldsymbol{r}_j\) is the positions vector of particle \(k\),
\(\boldsymbol{q}\) is scattering vector and the \(w_j\) are optional
weights. The possible scattering vectors are determined by the given cell
dimensions.
Results are returned as arrays with three dimensions, where the index of each
dimensions referers to the Miller indices \(hkl\). Based on the Miller indices
and the returned length of the scattering vector the actual scattering vector can be
obtained by
thetamin (float) – Minimal angle (°) between the scattering vectors and the z-axis.
thetamax (float) – Maximal angle (°) between the scattering vectors and the z-axis.
weights (numpy.ndarray) – Atomic quantity whose \(S(\vert q \vert)\) we are computing. Provide an
array of 1 that has the same size as the postions, h.e
np.ones(len(positions)), for the standard structure factor.
Returns:
The length of the scattering vectors and the corresponding structure factors.
Raise a Warning when AtomGroup is not charge neutral.
Class Decorator to raise an Error/Warning when AtomGroup in an AnalysisBase class is
not charge neutral. The behaviour of the warning can be controlled with the filter
attribute. If the AtomGroup’s corresponding universe is non-neutral an ValueError is
raised.
Parameters:
filter (str) – Filter type to control warning filter. Common values are: “error” or “default”
See warnings.simplefilter for more options.
This function acts as a wrapper for the
MDAnalysis.core.groups.AtomGroup.center() method, providing a more
user-friendly interface by automatically determining the appropriate weights based
on the chosen binning method.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
compound ({"group", "segments", "residues", "molecules", "fragments"}) – The compound to be used in the center calculation. For example, "residue",
"segment", etc.
Returns:
The coordinates of the calculated center.
Return type:
np.ndarray
Raises:
ValueError – If the provided bin_method is not one of {"com", "cog", "coc"}.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
dim ({0, 1, 2}) – Dimension for binning (x=0, y=1, z=1).
pdim ({"r", "z"}) – direction of the projection
Returns:
Array of the calculated unit vectors with shape (3,) for pdim=’z’ and shape
(3,n) for pdim=’r’. The length of n depends on the grouping.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
bin_method ({"com", "cog", "coc"}) –
Method for the position binning.
The possible options are center of mass ("com"),
center of geometry ("cog"), and center of charge ("coc").
Returns:
Array of the calculated unit vectors with shape (3,n). The length of n
depends on the grouping.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
dens ({"mass", "number", "charge"}) – density type to be calculated.
Returns:
1D array of calculated weights. The length depends on the grouping.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
"cos_theta": cosine of the dipole moment with an axis
"cos_2_theta": squred cosine with an axis.
get_unit_vectors (Callable) – Callable that returns unit vectors on which the projection is performed.
Returned unit_vectors can either be of shape (3,) or of shape (n, 3). For a
shape of (3,) the same unit vector is used for all calculations.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
Returns:
1D array of calculated weights. The length depends on the grouping.
The possible grouping options are the atom positions (in the case where
grouping="atoms") or the center of mass of the specified grouping unit (in
the case where grouping="residues", "segments", "molecules" or
"fragments").
vdim : {0, 1, 2}
Dimension for velocity binning (x=0, y=1, z=1).
Returns:
1D array of calculated weights. The length depends on the grouping.
This section provides the theory behind some of the most complex analysis modules and
explains the general design of MAICoS. Its purpose is to provide more clarity and
understanding of what MAICoS is all about.
MAICoS analysis modules are built on top of stacked Core classes as shown in the
UML chart above. For spatial dependent analysis, these are split into the geometries:
Each sub class inherits attributes and provides geometry-specific methods and
attributes. The flow chart is shown in the figure above. The foundation for all these
classes is maicos.core.base.AnalysisBase, inherited and extended from
MDAnalysis.analysis.base.AnalysisBase. maicos.core.base.AnalysisBase
takes case of the general aspects of each analysis, which will be discussed in detail
below:
Atom Selection - MAICoS builds on top of the MDAnalysis Universe and atom
selection system, therefore all analysis modules work only on subsets of the whole
simulation. This allows investigating different species components individually, for
example splitting the contributions of solvent and solute to a single observable.
Moreover, many MAICoS analysis modules are able to process several atom selections
from one simulation within one analysis run by providing a list of atom
selections. This reduces I/O loads and operations and gains a speed up for the
analysis.
Translational coordinate transformations and unit cell wrapping - MAICoS works
with a reference structure denoted by refgroup which center of mass (com for short)
serves as the coordinate origin for every analysis. MDAnalysis’s cell dimension and
coordinates range from 0 to L where L is the dimension of the simulation box.
Therefore, MAICoS defines the origin at the center of the simulation cell.
Within each frame of the analysis, the refgroup’s com is translated to the origin
and all coordinates are wrapped into the primary unit cell. Additionally, it is
possible to unwrap molecules afterwards since some analysis require whole molecules
(e.g. dielectric). With this centering, the investigation of systems that translate
over time is made possible, such as for example soft interfaces or moving molecules.
However, users are not forced to give a refgroup. If no such reference structure is
given, MAICoS takes the frame specific center of the simulation cell as the origin.
User-provided ranges for spatial analysis are always with respect to the refgroup
and not in absolute box coordinates. For example, a 1-dimensional planar analysis
ranging from -2 (Å) to 0 considers atoms on the left half space of the refgroup.
Trajectory iteration - Each module implements an initialization, a prepare, a
single frame and a conclude method. The AnalysisBase will perform an analysis that
is based on these provided methods. It is possible to provide an initial and final
frame as well as a step size or to analyse individual frames.
Time averaging of observables - For observables that have to be time-averaged,
maicos.core.base.AnalysisBase provides a frame dictionary. Each key has to
be updated within the (private) _single_frame method and the mean and the variance
of each observable will be provided within a mean and a var dictionary. Each
key name within these two dictionaries is the same as within the frame dictionary.
On-the-fly output - MAICoS is able to update analysis results during the
analysis. This can be particularly useful for long analysis providing a way to check
the correctness of analysis parameters during the run.
Correlation time estimation - For the calculation of the mean and the standard
deviation, MAICoS assumes uncorrelated data to compute reasonable error estimates.
Since users may not know the correlation time within their simulation, MAICoS
estimates correlation times for representative observables and warns users if their
averages are obtained from correlated data. The correlation analysis gets handled by
maicos.core.base.AnalysisBase if the single_frame method of the used class
returns a value to perform the analysis on. You can find general info about which
class uses which observable for the analysis below, and more detailed information in
the Reference guides. The correlation time gets calculated using the
correlationtimefunction. The generation
of warnings for the users gets handled by the correlationanalysisfunction.
For dielectric analysis, MAICoS uses the total dipole moment parallel to the
direction of the analysis. For other spatial-dependant analysis, the correlation time
is estimated from the central bin of the refgroup; in the center of the simulation
cell. This translates to the middle bin of the profile for planar analyses and the
first bin for cylindrical or spherical profiles.
Spatial dependent analyses are crucial for interfacial and confined systems. Based on
the AnalysisBase in combination with a maicos.core.base.ProfileBase class,
MAICoS provides intermediate Core classes for the three main geometries:
These modules take care of the coordinate transformations, of the spatial boundaries,
and of the spatial resolution of the analysis.
A design concept of MAICoS for spatial analysis is that the user always provides the
spatial resolution via the bin_width parameter rather than a number of bins.
Therefore, the same analysis code is easily transferable to different simulation sizes
without additional considerations about the spatial resolution.
Based on the three geometric base classes, three corresponding high level classes are
provided:
When developing a new analysis class based on one of theses three classes, only a single
weight function has to be provided. All current Weighting functions are
documented. For instance, the atomic weight could be the masses, thus resulting in mass
density profiles as done in DensityPlanar, atomic or molecular velocities as for
VelocityPlanar, or the dipolar orientations as used by the DiporderPlanar
class.
More details on each base class are given in the API Documentation. For detailed
information on the physical principles of each module consider the following sections.
Dielectric Response of Homogeneous, Isotropic Fluids#
The linear dielectric response of a material relates the displacement field \(D\) to
the electric field \(E\), which in the isotropic, homogenous case can be written as
(in SI units)
where \(\varepsilon_0\) is the vacuum permittivity, and \(\varepsilon\) is the
dielectric constant of the insulating medium.
One can relate the dielectric constant of a material to the fluctuations of the dipole
moment of a sub-sample even without any perturbation by an external field. Relations of
this sort have been known since the 1930s and follow from the fluctuation-dissipation
theory [1]. Depending on the boundary
conditions, this equation takes different forms, however, the most common boundary
conditions of molecular dynamics simulations are tin-foil boundary conditions in
conjunction with an Ewald-summation type approach. In this case, we get for a bulk
material
\[\varepsilon = 1 + \frac{\langle M^2 \rangle - \langle M \rangle^2}
{3 \varepsilon_0 V k _{\mathrm{B}} T}\]
where \(M\) is the dipole moment of the sample, \(V\) is its volume, \(k
_\mathrm{B}\) is the Boltzmann constant and \(T\) is the temperature.
The dipole moment is defined by
\[M = \sum_i \mathbf{r}_i q_i\]
where \(\mathbf{r}_i\) is the position of the \(i\)-th particle and \(q_i\)
is the charge of the \(i\)-th particle. Notably, this allows the calculation of the
dielectric response from equilibrium simulations without the need to explicitly define
an external field in simulations.
This analysis - valid for isotropic and homogeneous systems - is implemented in
MDAnalysis.analysis.dielectric.DielectricConstant and can directly be applied
to trajectories of homogeneous systems.
Dielectric Response of Fluids at Interfaces and in Confinement#
The relationship between the electric field and the dielectric response shown above is
only valid for isotropic homogeneous systems, where the properties of the material are
the same throughout. However, there is also a need for calculating the dielectric
response of anistropic inhomogeneous systems. For instance, fluids confined in a porous
material are of great importance for many technological processes, such as energy
storage devices like batteries and capacitors. In these devices, a nano-porous electrode
is used to increase the surface area and improve the capacity of the device. Another
common example are catalysts, where an increased surface area is used to increase the
rate of a chemical reaction, and thus porous catalysts are often utilized.
The presence of interfaces alters the dielectric response of the fluid in two ways.
First, the response is not isotropic anymore, but depends on the orientation of the
electric field. Second, the response varies with the distance from the surface of the
porous material, i.e., it becomes inhomogeneous.
In the following discussion, we will focus on pores with planar symmetry, also known as
“slit pores” and implemented in maicos.DielectricPlanar. However, similar
concepts apply to other types of pore geometries, such as ones with cylindrical or
spherical symmetries implemented in maicos.DielectricCylinder and
maicos.DielectricSphere.
Without loss of generality, we will assume that the pore is aligned along the
\(z\)-axis.
The non-local, anisotropic, linear dielectric response of a fluid can generally be
written as [2]
where \(\varepsilon(\mathbf{r}, \mathbf{r}')\) is the dielectric tensor, which
describes how the dielectric response of the fluid at position \(\mathbf{r}\) is
affected by the electric field \(E(\mathbf{r}')\) throughout the volume \(V\) of
the fluid. The convolution integral accounts for the non-local influences of the fluid
response at other locations.
In planar symmetry, we can simplify the above expression further, because the Maxwell
relations give
\[\nabla \times \mathbf{E} = 0\]
in the absence of external magnetic fields. Because of the planar symmetry, we know that
the \(\mathbf{E}\) only varies with respect to \(z\). Hence, the above gives
\(\partial_z E_y = \partial_z E_x = 0\), implying that the parallel components of
the electric field do not vary with \(z\).
Thus, we can simplify the anisotropic, non-linear equation above in the parallel case to
where the marginal integration of \(\varepsilon_\parallel (\mathbf{r},
\mathbf{r}')\) defines the dielectric profile \(\varepsilon_\parallel(z)\). It is
important to note that this derivation starts with non-local assumptions and is exact in
the case of planar geometries discussed here (similar derivations apply also for
cylindrical and spherical symmertries). Thus, \(\varepsilon_\parallel(z)\) fully
captures the non-locality of the confined fluid’s response and does not require
additional assumptions.
In the absence of “free charges” we can use the macroscopic Maxwell equation
\[\nabla \cdot \mathbf{D} = 0\]
to derive the perpendicular dielectric profile.
Warning
This requires that no free charges are used in simulations, which
means that no ions can be included in simulations. This is a common pitfall
and leads to a wrong analysis.
The above equation gives us the important relation of \(\partial_z \mathbf{D}_z =
0\), which implies that the perpendicular components of the displacement field do not
vary with \(z\). Thus, if we start with the inverse dielectric response, defined as
where \(\varepsilon^{-1}(z, z')\) is the matrix inverse of the dielectric tensor.
Similar to above, we use the fact that \(D\) does not vary with \(z\) and
simplify
where the marginal integration of \(\varepsilon_\perp^{-1} (\mathbf{r},
\mathbf{r}')\) defines the inverse dielectric profile \(\varepsilon_\perp^{-1}(z)\).
In summary, if one has no magnetic fields and no free charges, the dielectric
profiles \(\varepsilon^{-1}_\bot (z)\) and \(\varepsilon_\parallel(z)\) fully
define the linear, anisotropic, non-local response of a system in planar confinement.
As was briefly discussed for the homogenous case, the dielectric response of a system
can be calculated from equilibrium simulations without the need to explicitly define an
external field in simulations, using a fluctuation dissipation theorem. This can be
derived by identifying the linear response under consideration, in this case the
dielectric response to a derivative of the expected value of an observable, in this case
the polarization density. The expectation value is calculated using statistical
mechanics. One can then show [3][2][4] that the dielectric response formalism
is given by
For the parallel case, we have to derive the lateral component of the polarization
density as a function of the coordinate \(z\). This can be done by introducing
multiple virtual cuts perpendicular to any lateral axis, such as the \(x\) or
\(y\) axis [2][4]. During this step one has to take care
to only cut molecules along this cutting plane, which requires careful treatment of the
periodic boundary conditions commonly employed in simulations. Identifying the
(non-zero) total charge on one side of the cut with the surface charge along the plane
of the virtual cut via Gauss’ theorem we can integrate out the dependency of the lateral
axis of the cut and average over multiple such cuts. This gives a good estimate for the
average surface charge density \(\sigma(z)\) w.r.t the coordinate \(z\).
Finally, we can identify
The above equations for \(\varepsilon _\parallel (z)\) and \(\varepsilon
_\perp^{-1} (z)\) are derived under 2d periodicity. In simulations, this entails using
periodic boundary conditions only in the \(x\) and \(y\) directions. In most of
the typically employed simulation codes, electrostatics are calculated using a
Ewald-summation type approach. This includes direct Ewald sums or the faster meshed
Ewald sums (such as P3M, and PME). However, in their usual formulation these codes
calculate 3d-periodic systems and thus do not meet the assumptions of the derivation
shown above.
In order to use the above, one can use the 2d Ewald sum or corrections thereof, such as
the correction of Yeh and Berkovitz [5] or the
ELC [6].
However, one can also correct for the 3d electrostatics of an uncorrected Ewald-sum in
the fluctuation dissipation formalism directly as shown in refs.
[3][4]
Note, that a very close formula [3]
can also be derived for arbitrary boundary conditions at infinity, which some
simulation codes can also utilize. As most simulations nowadays are performed using
tin-foil boundary conditions, MAICoS does not provide these special cases and we
do not recommend that simulations for the calculation of dielectric profiles
are performed with other boundary conditions.
Note
The above equation reduces to the correct 2d periodic system if one
includes an explicit vacuum layer in the \(z\) direction of infinite
(sufficiently large) size, such that the influence between periodic images
over the \(z\) direction can be approximated as a dipole interaction.
This approach is analogous to the Yeh and Berkovitz correction
[5] and
may be used to calculate the dielectric profiles for physical systems with
2d-symmetry when corrections are not available. In these situations, we
recommend to use a padding vacuum layer such that the system is 3x the
physical system size in \(z\) direction.
However, there are systems which truly are 3d-periodic, such as stacks of lipid
membranes. In these cases, one has to also use the above formula which includes the
dipole corrections, but only simulate the physical system, without a padding vacuum
layer.
The correction for 3d periodic systems with tin-foil boundary conditions can be
turned on using the parameter is_3d.
MD Simulations often complement conventional experiments, such as X-ray crystallography,
Nuclear Magnetic Resonance (NMR) spectroscopy and Atomic-Force Microscopy (AFM). X-ray
crystallography is a method by which the structure of molecules can be resolved. X-rays
of wavelength 0.1 to 100 Å are scattered by the electrons of atoms. The intensities of
the scattered rays are often amplified using by crystals containing a multitude of the
studied molecule positionally ordered. The molecule is thereby no longer under
physiological conditions. However, the study of structures in a solvent should be done
under physiological conditions (in essence, this implies a disordered, solvated fluid
system); therefore X-ray crystallography does not represent the ideal method for such
systems. Small-Angle X-ray Scattering (abbreviated to SAXS) allows for measurements of
molecules in solutions. With this method the shape and size of the molecule and also
distances within it can be obtained. In general, for larger objects, the information
provided by SAXS can be converted to information about the object’s geometry via the
Bragg-Equation
\[n \cdot \lambda = 2 \cdot d \cdot \sin(\theta)\]
with \(n \in \mathbb{N}\), \(\lambda\) the wavelength of the incident wave,
\(d\) the size of the diffracting object, and \(\theta\) the scattering angle.
For small angles, \(d\) and \(\theta\) are approximately inversely proportional
to each other, which means larger objects scatter X-rays at smaller angles.
The measured quantity in SAXS experiments is the number of elastically scattered photons
as a function of the scattering angle \(2\theta\), i.e. the intensity of the
scattered rays across a range of small angles. The general set-up of a SAXS experiment
is shown in figure below.
The experiments are carried out by placing the sample of interest in a highly
monochromatic and collimated (parallel) X-ray beam of wavelength \(\lambda\). When
the incident rays with wave vector \(\boldsymbol{k}_i\) reach the sample they
scatter. The scattered rays, with wave vector \(\boldsymbol{k}_s\), are recorded by
a 2D-detector revealing a diffraction pattern.
Since the scattering agents in the sample are electrons, X-Ray diffraction patterns
reveal the electron density. Since the scattering is elastic, the magnitudes of the
incident and scattered waves are the same: \(|\boldsymbol{k}_i| =
|\boldsymbol{k}_s| = 2\pi/\lambda\). The scattering vector is \(\boldsymbol{q} =
\boldsymbol{k}_s - \boldsymbol{k}_i\) with a magnitude of \(q = |\boldsymbol{q}| =
4\pi \sin(\theta)/\lambda\). The structure factor can be obtained from the intensity of
the scattered wave, \(I_s(\boldsymbol{q})\), and the correspnding form factor
\(f (q)\), which involves a frourier transform of the element-specific local
electron density and thus determines the amplitude of the scattered wave of a single
element.
In simulations, the structure factor and scattering intensities
\(S(\boldsymbol{q})\) can be extracted directly from the positions of the particles.
maicos.Saxs calculates these factors. The calculated scattering intensities can
be directly compared to the experimental one without any further processing. In the
following we derive the essential relations. We start with the scattering intensity
which is expressed as
where \(f_j(q)\) is the element-specific form factor of atom \(j\) and
\(\boldsymbol{r}_j\) the position of the \(j\) th atom out of \(N\) atoms.
The scattering intensity can be evaluated for wave vectors \(\boldsymbol q = 2 \pi
(L_x n_x, L_y n_y, L_z n_z)\), where \(n \in \mathbb N\) and \(L_x, L_y, L_z\)
are the box lengths of cubic cells.
Note
maicos.Saxs can analyze any cells by mapping coordinates back onto cubic
cells.
With Euler’s formula \(e^{i\phi} = \cos(\phi) + i \sin(\phi)\) the intensity is
\[I_s (\boldsymbol{q}) = \sum\limits_{j=1}^N f_j(q) \cos(\boldsymbol{qr}_j) - i \sin(\boldsymbol{qr}_j)
\cdot \sum\limits_{k=1}^N f_k(q) \cos(\boldsymbol{qr}_k) + i \sin(\boldsymbol{qr}_k) \,.\]
Multiplication of the terms and simplifying yields the final expression for the
intensity of a scattered wave as a function of the wave vector and with respect to the
particle’s form factor
The limiting value \(S(0)\) for \(q \rightarrow 0\) is connected to the
isothermal compressibility [1] and the element-specific
form factors \(f(q)\) of a specific atom can be approximated with
\[f(\sin\theta/\lambda) = \sum_{i=1}^4 a_i e^{-b_i \sin^2\theta/\lambda^2} + c \,.\]
Expressed in terms of the scattering vector we can write
\[f(q) = \sum_{i=1}^4 a_i e^{-b_i q^2/(4\pi)^2} + c \,.\]
The element-specific coefficients \(a_{1,\dots,4}\), \(b_{1,\dots,4}\) and
\(c\) are documented [2].
Connection of the structure factor to the radial distribution function#
If the system’s structure is determined by pairwise interactions only, the density
correlations of a fluid are characterized by the pair distribution function
where \(\rho^{(2)}(\boldsymbol r, \boldsymbol r\prime) = \sum_{i,j=1, i\neq j}^{N}
\delta (\boldsymbol r - \boldsymbol r_i) \delta (\boldsymbol r - \boldsymbol r_j)\) and
\(\rho(\boldsymbol r) = \sum_{i=1}^{N} \delta (\boldsymbol r - \boldsymbol r_i)\)
are the two- and one-particle density operators.
For a homogeneous and isotropic system, \(g(r) = g(\boldsymbol r, \boldsymbol
r^\prime)\) is a function of the distance \(r =|\boldsymbol r - \boldsymbol
r^\prime|\) only and is called the radial distribution function (RDF). As explained
above, scattering experiments measure the structure factor
which we here normalize only by the number of particles \(N\). For a homogeneous and
isotropic system, it is a function of \(q = |\boldsymbol q|\) only and related to
the RDF by Fourier transformation (FT)
which is another way compared for the direct evaluation from trajectories which was
derived above. In general this can be as accurate as the direct evaluation if the
RDF implementation works for non-cubic cells and is not limited to distances
\(r_\mathrm{max} = L/2\), see [3] for details.
However, in usual implementation the RDF can only be obtained until
\(r_\mathrm{max} = L/2\) which leads to a range of \(q >
q_\mathrm{min}^\mathrm{FT} = 2\pi / r_\mathrm{rmax} = 4 \pi /L\). This means that the
minimal wave vector that can be resolved is a factor of 2 larger compared compared to
the direct evaluation, leading to “cutoff ripples”. The direct evaluation should
therefore usually be preferred [4].
The pair distribution function describes the spatial correlation
between particles.
Two-dimensional (planar) pair distribution function#
Here, we present the two-dimensional pair distribution function
\(g_{\text{2d}}(r)\), which restricts the distribution to
particles which lie on the same surface
\(S_\xi\).
Let \(g_1\) be the group of particles which are centered, and \(g_2\) be
the group of particles whose density around a \(g_1\) particle is
calculated.
Furthermore, we define a parametric surface \(S_\xi\) as a function of
\(\xi\),
\[S_\xi = \{ \mathbf{r}_{\xi} (u, v) |
u_{\text{min}} < u < u_{\text{max}}, v_{\text{min}} < v < v_{\text{max}} \}\]
which consists of all points \(\mathbf{r}_\xi\). By varying
\(u, v\) we can reach all points on one surface \(\xi\). Let us
additionally consider a circle on that plane \(S_{i, r}\) with radius
\(r\) around atom \(i\) given by
where \(L(r, \xi_i)\) is the contour length of the circle \(S_{i, r}\).
\(\mathbf{f}_i(r, \gamma, \phi)\) is a parametrization of the
circle \(S_{i, r}\).
Discretized for computational purposes we consider a volume
\(\Delta V_{\xi_i}(r)\), which is bounded by the surfaces
\(S_{\xi_i - \Delta \xi}\), \(S_{\xi_i + \Delta \xi}\) and
\(S_{r - \frac{\Delta r}{2}}, S_{r + \frac{\Delta r}{2}}\). Then our
two-dimensional pair distribution function is
where we have followed the general derivations given above.
For discretized calculation we count the number of atoms per ring as illustrated below
The sketch shows an atom \(i\) from group \(g_1\) at the origin in blue.
Around the atom a ring volume with average distance \(r\) from atom i
is shaded in light red.
Atoms \(j\) from group \(g_2\) are counted in this volume.
One-dimensional (cylindrical) pair distribution functions#
Here, we present the one-dimensional pair distribution functions
\(g_{\text{1d}}(\phi)\) and \(g_{\text{1d}}(z)\), which restricts the
distribution to particles which lie on the same cylinder along the angular and axial
directions respectively.
Let \(g2\) be the group of particles whose density around a \(g1\) particle is
to be calculated and let \(g1, g2\) lie in a cylinderical coordinate
system \((R, z, \phi)\).
Discretized for computational purposes we consider a volume
\(\Delta V_{z_i,R_i}(\phi)\), which is bounded by the surfaces
\(S_{z_i - \Delta z}\), \(S_{z_i + \Delta z}\),
\(S_{R_i - \Delta R}\), \(S_{R_i + \Delta R}\) and
\(S_{\phi - \frac{\Delta \phi}{2}}, S_{\phi + \frac{\Delta \phi}{2}}\). Then our
the angular pair distribution function is
Contribution via merge requests are always welcome. Source code is available from
GitLab. Before submitting a merge request, please read the developer documentation
and open an issue to discuss your changes. Use only the main branch for submitting
your requests.
By contributing to MAICoS, you accept and agree to the following terms and conditions
for your present and future contributions submitted to MAICoS. Except for the license
granted herein to MAICoS and recipients of software distributed by MAICoS, you reserve
all right, title, and interest in and to your contributions.
To help with developing start by installing the development dependencies. Our continuous
integration pipeline is based on Tox. So you need to install tox first
pipinstalltox
# or
condainstall-cconda-forgetox
Then go to the MAICoS develop project page, hit the Fork button and clone your
forked branch to your machine.
gitclonegit@gitlab.com:your-user-name/maicos.git
Now you have a local version on your machine which you can install by
cdmaicos
pipinstall-e.
This install the package in development mode, making it importable globally and allowing
you to edit the code and directly use the updated version.
As contributors and maintainers of MAICoS, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating documentation,
submitting merge requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience
for everyone, regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or
religion.
Examples of unacceptable behavior by participants include the use of sexual language or
imagery, derogatory comments or personal attacks, trolling, public or private
harassment, insults, or other unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are not
aligned to this Code of Conduct. Project maintainers who do not follow the Code of
Conduct may be removed from the project team.
This code of Conduct applies both within project spaces and in public spaces when an
individual is representing the project or its community.
To write your module take a look at the comprehensive example in the documentation of
maicos.core.AnalysisBase. MAICoS also has more specific base classes for
different geometries that make developing modules much easier. You may take a look at
the source code at src/maicos/modules.
After you wrote your module you can add it in a new file in src/maicos/modules. On
top of that please also update the list in src/maicos/modules/__init__.py
accordingly. Also, create a new .rst file with your module name in
docs/src/references/modules similar to the already existing. To finally show the
documentation for the other modules add an entry in
docs/src/references/modules/index.rst in alphabetical order.
All MAICoS modules are also listed in the README.rst and you should add your module
as well.
Finally, also provide meaningful tests for your module in test/modules.
For further questions feel free to ask us on our Discord server.
Whenever you add a new feature to the code you should also add a test case. Further test
cases are also useful if a bug is fixed or you consider something to be worthwhile.
Follow the philosophy - the more the better!
You can run all tests by:
tox
These are exactly the same tests that will be performed online in our GitLab CI
workflows.
Also, you can run individual environments if you wish to test only specific
functionalities, for example
You can also run only a subset of the tests with tox-etests--<tests/file.py>,
replacing <tests/file.py> with the path to the files you want to test, e.g. tox-etests--tests/test_main.py for testing only the main functions. For more details take
a look at the usage and invocation
<https://docs.pytest.org/en/latest/usage.html#usage-and-invocations> page of the pytest
documentation.
You can also use tox-eformat to use tox to do actual formatting instead of just
testing it. Also, you may want to setup your editor to automatically apply the black code formatter when saving your files, there
are plugins to do this with all major editors.
The documentation of MAICoS is written in reStructuredText (rst) and uses the
Sphinx documentation generator. You can build the documentation from the
maicos/docs folder:
tox-edocs
Then, visualize the local documentation with your favorite internet explorer (here
Mozilla Firefox is used)
Most of the content of the documentation is written in .rst files located within
docs/src/. The content in the Reference guides section is directly
generated from the documentation string of the source code located in src/maicos
thanks to Sphinx and Autodoc.
After creating a new module, add it to the documentation by modifying the toctree in
the docs/src/references/modules/index.rst file, and adding a new .rst file with the
following format:
The version information in maicos.__version__ indicates the release of MAICoS using
semantic versioning.
In brief:
Given a version number MAJOR.MINOR.PATCH, we increment the
MAJOR version when we make incompatible API changes,
MINOR version when we add functionality in a backwards-compatible manner,
and
PATCH version when we make backwards-compatible bug fixes.
However, as long as the MAJOR number is 0 (i.e. the API has not stabilized),
even MINOR increases may introduce incompatible API changes. As soon as we have a
1.0.0 release, the public API can only be changed in a backward-incompatible manner with
an increase in MAJOR version.
Additional labels for pre-release and build metadata are available as extensions to the
MAJOR.MINOR.PATCH format, following PEP 440.
Note
Development versions and pre-releases have a suffix after
the release number, such as 0.7.0+12.gFEED2BEEF. If you have
problems, try out a full release (e.g. 0.7.0) first.
Thank you to all of the developers, programmers, and researchers who
contributed to the creation of MAICoS.
We also thank the Institute for Computational Physics (University of
Stuttgart), group members of Roland Netz at Freie Universität Berlin,
and the Stuttgart Center for Simulation Science and the German Research
Council (DFG) for funding through the Cluster of Excellence EXC 2075
“Data-integrated Simulation Science”.
MAICoS was first developed in Roland Netz’s group at the Freie University of
Berlin by Alexander Schlaich and Philip Loche, and is now mostly developed
and maintained at the Institute for Computational Physics.