pymatgen (Python Materials Genomics) is a robust, open-source Python library for materials analysis, primarily used for high-throughput computational materials science. It provides core object representations for crystal structures, molecules, and computational outputs (VASP, Q-Chem, Gaussian, etc.), and extends into analysis modules for phase diagrams, battery electrodes, coordination environments, magnetism, elasticity, surface science, diffraction, and spectroscopy. The library powers the Materials Project database and includes CLI tools for structure manipulation, POTCAR generation, and plotting. It features extensive use of MSONable serialization, abstract base classes, and a correction scheme pattern for DFT energy adjustments. While heavily integrated with the Materials Project ecosystem, its modular design allows reuse of individual analysis components in other materials research pipelines.
Fityk is a cross-platform scientific data fitting program focused on nonlinear curve fitting, particularly peak fitting in spectroscopy and crystallography. It provides a core library (libfityk) with multiple fitting algorithms (Levenberg-Marquardt, MPFIT, Nelder-Mead, Genetic Algorithm, NLopt), a rich set of built-in peak functions (Gaussian, Lorentzian, Voigt, Pearson VII, etc.), symbolic derivatives via AST, and a bytecode VM for expression evaluation. The architecture is modular: a core library, a CLI with readline and gnuplot integration, a wxWidgets GUI, and scripting support via Lua and SWIG bindings for Python, Perl, Ruby, and Java. Key entry points include the Fityk class API, the command parser (cparser.cpp), the runner (runner.cpp), and the GUI main frame (frame.cpp). Data flows involve loading data from files (via xylib), defining models as sums of functions, fitting using least-squares optimization, and outputting parameters and statistics. External dependencies include wxWidgets, Boost, Lua, NLopt, xylib, readline, gnuplot, zlib, and SWIG. The codebase is well-structured with extensive documentation and tests, though it shows some age with pre-C++11 idioms and platform-specific workarounds.