Skip to content

Lammps parser model method#147

Draft
Bernadette-Mohr wants to merge 36 commits into
developfrom
lammps-parser_model-method
Draft

Lammps parser model method#147
Bernadette-Mohr wants to merge 36 commits into
developfrom
lammps-parser_model-method

Conversation

@Bernadette-Mohr

Copy link
Copy Markdown
Collaborator

Purpose

Extends the LAMMPS parser to populate the MolecularDynamicsMethod schema from nomad-simulations, enabling standardized extraction of MD simulation metadata (thermostat/barostat settings, integrator parameters, ensemble type) from LAMMPS log and data files.

Scope

  • MolecularDynamicsMethod extraction:
    • Integrator type from run_style command (velocity_verlet, verlet_split, respa, respa_omp)
    • Timestep from timestep command
    • Number of steps from run command
    • Thermodynamic ensemble detection (NVE/NVT/NPH/NPT)
    • Coordinate/velocity/force/thermodynamics save frequencies from dump/thermo commands
    • ThermostatParameters: 4 types (nvt, langevin, temp/berendsen, temp/rescale), reference temperature, coupling constant
  • BarostatParameters: 3 types (npt, nph, press/berendsen), reference pressure, coupling constant
  • Compressibility extraction: Converts LAMMPS modulus keyword (bulk modulus) to compressibility via 1/modulus formula
  • Helper methods:
    • _extract_integrator_type(),
    • _extract_modulus(),
    • existing _extract_thermostat_settings(),
    • _extract_barostat_settings()
  • Test coverage: # new test functions

Out of scope (What is explicitly not included (to avoid scope creep)?)

Status

  • Draft / In progress (not ready for full review)
  • Ready for review
  • Blocked (explain below)

Dependencies / Blockers

  • None.
  • Related PRs:
  • Open design questions:
  • External dependencies (people, decisions, data, releases):

Testing / Validation

  • Unit tests
  • Integration tests
  • Manual testing (brief description):
  • Not applicable (explain why):

Linked Issues / Context

Use GitHub keywords where applicable.

  • Fixes #
  • Related to #
  • Follow-up issues (if known):

Reviewer Notes

Anything reviewers should pay special attention to? Trade-offs, known limitations, or areas of uncertainty.

@Bernadette-Mohr Bernadette-Mohr self-assigned this Feb 12, 2026
@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21947708520

Details

  • 337 of 404 (83.42%) changed or added relevant lines in 2 files are covered.
  • 15 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.6%) to 68.31%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/nomad_simulation_parsers/parsers/lammps/parser.py 196 223 87.89%
tests/parsers/test_lammps_parser.py 141 181 77.9%
Files with Coverage Reduction New Missed Lines %
src/nomad_simulation_parsers/parsers/utils/mdanalysisparser.py 15 36.7%
Totals Coverage Status
Change from base Build 21869152946: 0.6%
Covered Lines: 5930
Relevant Lines: 8681

💛 - Coveralls

* docs: Add parser testing strategy discussion paper

* fixed code highlighting syntax

* Added method/force field parameter parsing

* removed unneccessary docs page

* ForceField.contributions not added to archive

* Updated test-data  to work with current MDAnalysis (2.10.0). Replaced hardcoded exlusion of GMX2024 with dynamic support check, to reflect major changes in MDAnalysis

* Added timestep, thermostat and parostat parameter parsing

* Linting fix (#145)

* Fixed Linting error

* bond_list parsing and test

* Added angle and dihedral parsing

* patches for processing (#152)

* Update src/nomad_simulation_parsers/parsers/lammps/file_parsers.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: ladinesa <67910858+ladinesa@users.noreply.github.com>
Co-authored-by: Joseph Rudzinski <JFRudzinski@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JFRudzinski JFRudzinski mentioned this pull request Mar 5, 2026
9 tasks
Bernadette-Mohr and others added 21 commits May 15, 2026 13:12
* resolve ruff PLC0207 by limiting split operations to one split each

* tighten behavior
* Fixed Ruff complaint

* Fixed failing test/skipping tests until update of test data

* Added creation and parsing of system hierarchy

* Fixed system hierarchy not being fully parsed, added tests/data/protein_small, updated tests

* Resolved Copilot review comments.

* Optimized the system hierarchy parsing, minimizing number of trajectory searches.

* Added negation exeption for test data log files to gitignore

* Pruned water trajectories to reduce test time
* Temporarily disable mappings to `convergence_tolerance_energy_difference` and
`convergence_tolerance_force_maximum` in abinit and gromacs schema packages.

This commit restores functionality. Follow-up commit will migrate to the new `WorkflowConvergenceTarget` API.
* Workaround for recursive workflow tasks

* Update src/nomad_simulation_parsers/schema_packages/h5md.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Updated test_h5md_parser to accomodate workaround

* Added TODO marker to test_h5md_parser for workflow regression workaround

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add convergence target and SCF steps parsing to 8 parsers

Adds support for parsing workflow convergence criteria (`EnergyConvergenceTarget`, `ForceConvergenceTarget`) and SCF iteration data (`SCFSteps`) following schema updates in nomad-simulations#260.

**Parsers updated:** abinit, ams, crystal, exciting, fhiaims, gpaw, quantumespresso, vasp

**Implementation:** Uses direct class instantiation approach. Future migration to dict-based `m_def` mapping annotations should be tracked separately (see PR #162 for reference).

**Testing:** 39 unit tests added, all passing. Validated with production samples in `.tests/pr-150-convergence/`.

Depends on nomad-simulations#260

Co-authored-by: Joseph Rudzinski <joseph.rudzinski@physik.hu-berlin.de>
Co-authored-by: Nathan Daelman <nathan.daelman@physik.hu-berlin.de>
* implement particle state reassignment fix

* revert pyproject.toml changes

* add more tests
* Resolved field naming conflict (values -> coupling_parameters)

* Renamed coupling_parameters to lambda_values to improve clarity
Add support for capturing k-point mesh configuration from FHI-aims
output and control.in files. This is the first step toward full
KMesh schema population.

Additions:
- Add `k_offset` regex capture to out_parser.py for output file
- Add `k_grid` and `k_offset` regex captures to ControlParser in common.py
- Parse k-grid as integer array and k-offset as float array
Wire up KMesh support through schema annotations to map k-grid
and k-offset data to the NOMAD schema.

Changes:
- Import `numerical_settings` module in fhiaims.py
- Add DFT class with numerical_settings mapping annotation
- Add NumericalSettings class with KMesh subsection mapping
- Add KMesh class with direct field mappings for `grid` and `offset`
- Add test for k_mesh (currently shows model_method is empty, needs investigation)

Note: model_method population appears to happen during normalization,
not during parsing. Further investigation needed to verify k_mesh
data flow through the full parsing+normalization pipeline.
Directly populate DFT and KMesh sections after parsing as temporary
workaround while investigating why mapping annotations don't trigger
section creation.

Issue: DFT.m_def annotation with '.@' path does not create DFT section
despite being identical to working patterns in VASP, GPAW, etc.

Temporary solution:
- Create DFT section programmatically after convert()
- Extract k_grid/k_offset from parsed data
- Instantiate KMesh and add to DFT.numerical_settings

This approach works but bypasses the annotation system. Need to find
root cause of annotation failure and implement proper fix.
Add k-point mesh (k_grid and k_offset) parsing and mapping to NOMAD schema
for FHI-aims. The implementation uses the KSpace → k_mesh → KMesh hierarchy
as defined in the NOMAD schema.

Changes:
- Parse k_grid and k_offset from FHI-aims output using regex quantities
- Add KSpace and KMesh schema classes with mapping annotations
- Map parsed k-point data to DFT → KSpace → KMesh structure
- Add comprehensive test coverage for k-mesh functionality

The key insight was that KMesh is not a direct subclass of NumericalSettings
- it must be wrapped in KSpace (which is a NumericalSettings) to be added to
`DFT.numerical_settings`. This follows the same pattern used by VASP parser.
Add `KMesh` support for FHI-aims parser

Parse k_grid and k_offset from FHI-aims output and map to
`DFT.numerical_settings.KSpace.k_mesh`. Set FHI-aims default
offset=[0,0,0] (Gamma-centered) when not present.
* Added parsing of masses and (partial) charges

* Rebasing onto current develop

* Extended atom parameter parsing to include chemical_symbol and atomic_number, if available

* WIP

* Adapted schema to archive derived properties from MolecularDynamicsResults

* Implemented explicitly archiving ParticleParameters, generalized all references to atom to particle

* Fixed Ruff complaint

* Added temporary check for availability of new feature in nomad_simulations

* More guards

* Adjusted parser and schema to changes in nomad-simulations.force_field, updated program.version regex

* Recovered some missing quantities

* Added some more missing Quantities

* fix: block MappingParser Level 3 task recursion for GROMACS workflows

* Extended parser to handle CG systems, started adding free energy parameter parsing

* corrected model_method structure, added workarounds for nested subsection issues

* Added free energy parameter parsing

* fix: clean up unused imports, remove magic numbers

* implemented atom/particle classification

* fix: organize inputs

* added parsing of free energy parameters

* fix: rename lambdas valuse -> coupling_parameters to resolve naming conflict with MappingParser

* Adapted parser to reflect resolved field naming conflict

* Resolved field naming conflict (values -> lambda_values) (#169)

* Resolved field naming conflict (values -> coupling_parameters)

* Renamed coupling_parameters to lambda_values to improve clarity

* renamed coupling_parameters to lambda_values

* closed implementation gap to add free-energy inputs via XVG parser.

* linting stuff

* Conditionally skip test until related PR is merged

* optimized tests, adressed Copilot comments

* fix: rename Outpus -> Outputs in gromacs schema, update TODO PR ref to #375

* Update src/nomad_simulation_parsers/parsers/gromacs/parser.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* reabsing

* adressed review comments, reduced code redundancy in the parser

* removed stale dependency

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Corrected annotation for ForceField, ForceCalculation, ParticleParametersContainer

* Fixed comments

* explicit type annotations for pylance compliance
Bernadette-Mohr and others added 9 commits May 20, 2026 15:27
* Pin nmr schema version

* Update nmr version
* Add SCF convergence criteria mapping for FHI-aims

Add SelfConsistency annotation using multi-mapper pattern to extract
convergence criteria (energy, density, eigenvalues) as separate instances
alongside KSpace in DFT.numerical_settings.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Haoyu Yang <yang@Haoyus-Air.localdomain>
* Add tests

* Use utc reference for datetime
* Implement parsing of vasp charge density

* Update pyproject.toml

* Try using nomad-lab develop

* Remove index-url

* Revert and exclude vasp entry point

* Add charge density annotation to vasp schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants