Package: baggianalysis
baggianalysisBaggianalysis is a library aimed at simplifying the analysis of particle-based simulations. It makes it easy to parse, convert and analyse trajectories generated by simulation codes in an agnostic way. It is written in C++ and provides Python bindings. It is modular and can be extended from C++ and Python.The documentation for the Python bindings can be foundhere.Install thePythonpackageIf all the requirements are met, thebaggianalysisPython package can be compiled & installed by cloning the repo and usingpipas follows:$gitclonehttps://github.com/lorenzo-rovigatti/baggianalysis.git
$PIP_COMMANDinstall./baggianalysiswherePIP_COMMANDshould bepip,pip3,python -m piporpython3 -m pip, depending on your local configuration. Use-vfor verbose output.RequirementsCMake >= 3.1 (>= 3.12 if installed throughpip)makeA c++14-compliant compiler (tested with GCC >= 5.4)If Python bindings are enabled, thepip,setuptoolsandsetuptools-scmpackages, as well as Python 3's header file are required (python3-dev)The pore size observable requires theNLoptlibrary (libnlopt-dev)The bond-order parameter observable requires theGNU Scientific LibraryandBoost's mathlibraries (libgsl-devandlibboost-math-dev)Sphinx,sphinx_rtd_themeandrecommonmarkare required to generate the Python bindings' documentation. Those can all be installed by usingpip(for instance with the commandpip3 install --user sphinx sphinx_rtd_theme recommonmark)CompilationThe code can be compiled with the following commands:cd baggianalysis   # enter the baggianalysis folder
mkdir build        # create a new build folder. It is good practice to compile out-of-source
cd build
cmake ..           # here you can specify additional options, see next section
make -j4           # compile baggianalysis. The -jX make option makes it compile the code in parallel by using X threads.At the end of the compilation a test executable used for development (test_feature) will be placed in the build/bin folder. If Python bindings are enabled,make installwill install the package throughpipto make the library accessible by the user.cmake optionsHere is a list of options that can be passed to cmake during the pre-compilation stage:-DPython=On|Offenables|disables Python bindings (defaults toOn)-DDebug=On|Offcompiles with|without debug symbols and without|with optimisation flags (defaults toOff)-DG=On|Offcompiles with|without debug symbols and optimisation flags (defaults toOff)Ifcmakecannot find some of the libraries required, add their paths to theCMAKE_FIND_ROOT_PATHset command which can be found close to the top of theCMakeLists.txtfile.Test suitebaggianalysis contains a very simple testing suite that checks whether the Python bindings and core functionalities work. The test suite is run by using themake test_quickcommand.FeaturesSupport many configuration typesFilters: after being parsed, configurations can be modified by the so-calledfilters. Some available filters are:filter particles according to a custom lambda function (FilterByFunction)select particles of certain types only (FilterByType)remove the centre-of-mass position and velocity (SubtractCOM)reduce the configuration so that it contains only a single particle with position and velocity given by the centre-of-mass position and velocity (FilterByReducingToCOM)NotesBy default, the core library is compiled dynamically. However, if Python bindings are enabled, the core library is compiled statically.The timestep associated to a configurationmustbe an integer number. If your preferred format stores it as a floating-precision number, your parser will have to find a way of converting that to an integer. This isby design, as the time of a configuration is used as a key in several maps around the code, and floating-point numbers are not good at that. Moreover, integer numbers can be stored without losing any precision, in contrast to floats.Normal trajectories need not load all the frames at once. Trajectories that do are called "full trajectories". Many observables, in general, do not require to have access to all frames at once, which means that frames can parsed (and hence loaded) one by one when needed (lazy loading). This allows to work on big trajectories without consuming up too much memory.Lists of 3D vectors are copied when accessed from the Python's side. This means that their c++ counterparts (which arestd::vectors) are not modified whenappendor similar Python methods are used.Simple Python parsers can be used to either parse singleSystems or to initialise trajectories from file lists and folders only. In order to do so, parsers should inherit fromBaseParserand override theparse_filemethod, which takes a string as its only argument.Molecules built by theTopologyclass are namedmol_XXX, whereXXXis an index that runs from zero to the number of molecules minus one.AcknowledgementsTheglm 0.9.9,pybind 2.4.3andspdlog 1.8.2libraries are included in the source tree.Natural sorting of files is carried out with theNaturalSortlibrary.akuukka's quickhulllibrary is included in the source tree.