8000 Add CIF input format for read/write by lmseidler · Pull Request #147 · grimme-lab/mctc-lib · GitHub
[go: up one dir, main page]

Skip to content

Add CIF input format for read/write - #147

Open
lmseidler wants to merge 5 commits into
grimme-lab:mainfrom
lmseidler:cif
Open

lmseidler wants to merge 5 commits into
grimme-lab:mainfrom
lmseidler:cif

Conversation

@lmseidler
@lmseidler lmseidler commented Oct 14, 2026 •
Copy link
Copy Markdown
Member
  • added CIF reader and writer
  • additional tests for chiral periodic structures, since these fail on a naive cif reader
  • docs updated
  • refactored some shared periodic helpers into src/mctc/io/periodic.f90

@codecov
codecov Bot commented Oct 14, 2026 •
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.86420% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.97%. Comparing base (aec7f40) to head (298de4f).

Files with missing lines Patch % Lines
src/mctc/io/read/cif.f90 81.87% 2 Missing and 27 partials ⚠️
app/main.f90 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #147       +/-   ##
===========================================
+ Coverage   11.84%   41.97%   +30.13%     
===========================================
  Files           5        6        +1     
  Lines         211      374      +163     
  Branches       97      171       +74     
===========================================
+ Hits           25      157      +132     
- Misses        176      180        +4     
- Partials       10       37       +27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved CIF validation errors can reject valid structures or return invalid geometry.

4 open findings
What changed in this PR

Adds CIF support to mctc-lib’s geometry I/O, including symmetry expansion and chirality-preserving output.

Changes:

  • Implements and registers CIF reading and writing.
  • Consolidates shared periodic-cell conversions.
  • Adds CIF tests, cross-format chirality checks, and documentation.
File Description
test/​testsuite_structure.f90 Adds a chiral periodic fixture.
test/​test_write.f90 Tests CIF writer dispatch.
test/​test_write_xyz.f90 Checks chirality preservation.
test/​test_write_vasp.f90 Checks chirality preservation.
test/​test_write_turbomole.f90 Checks chirality preservation.
test/​test_write_qcschema.f90 Checks chirality preservation.
test/​test_write_pymatgen.f90 Checks chirality preservation.
test/​test_write_genformat.f90 Checks chirality preservation.
test/​test_write_cjson.f90 Checks chirality preservation.
test/​test_write_cif.f90 Tests CIF round trips and validation.
test/​test_write_aims.f90 Checks chirality preservation.
test/​test_read.f90 Tests CIF reader dispatch.
test/​test_read_cif.f90 Tests CIF parsing and symmetry expansion.
test/​meson.build Registers CIF test suites.
test/​main.f90 Connects CIF test collectors.
test/​CMakeLists.txt Registers CIF test suites.
src/​mctc/​io/​write/​pymatgen.f90 Uses shared cell conversion.
src/​mctc/​io/​write/​meson.build Includes the CIF writer.
src/​mctc/​io/​write/​CMakeLists.txt Includes the CIF writer.
src/​mctc/​io/​write/​cjson.f90 Uses shared cell conversion.
src/​mctc/​io/​write/​cif.f90 Implements P1 CIF output.
src/​mctc/​io/​write.f90 Registers CIF writer dispatch.
src/​mctc/​io/​read/​turbomole.f90 Uses shared lattice conversion.
src/​mctc/​io/​read/​meson.build Includes the CIF reader.
src/​mctc/​io/​read/​CMakeLists.txt Includes the CIF reader.
src/​mctc/​io/​read/​cjson.F90 Uses shared lattice conversion.
src/​mctc/​io/​read/​cif.f90 Implements CIF parsing and symmetry expansion.
src/​mctc/​io/​read.f90 Registers CIF reader dispatch.
src/​mctc/​io/​periodic.f90 Centralizes cell/lattice conversions.
src/​mctc/​io/​meson.build Includes periodic helpers.
src/​mctc/​io/​filetype.f90 Adds CIF identification.
src/​mctc/​io/​CMakeLists.txt Includes periodic helpers.
README.md Lists CIF support.
man/​mctc-convert.1.adoc Adds CIF to the format table.
doc/​index.md Links CIF documentation.
doc/​format-cif.md Documents CIF behavior and limitations.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/mctc/io/read/cif.f90 Resolved
Comment thread src/mctc/io/read/cif.f90 Resolved
Comment thread src/mctc/io/read/cif.f90 Resolved
Comment thread src/mctc/io/read/cif.f90 Resolved
@Growl1234
Copy link
Copy Markdown
Contributor

Does it support mCIF (CIF with magnetic moments)?

Comment thread doc/format-cif.md Resolved
@Growl1234 Growl1234 mentioned this pull request Oct 20, 2026
@lmseidler
Copy link
Copy Markdown
Member Author

it now supports reading mcif files but ignores magnetic information. mctc-convert raises a warning about this (information is lost on conversion).

This branch has not been deployed

No deployments
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.

4 participants

0