Skip to content
Novus Examples
cif877 B

CIF Parser Edge Cases — Quotes, Text Fields and Wrapped Loops (.cif)

A CIF built entirely out of the constructs that break naive parsers: quoted values containing apostrophes and hashes, a semicolon-delimited multi-line text field, the distinct '?' and '.' markers, a standard uncertainty written as 1.2345(7), and a loop whose rows wrap across lines. Every one of them is legal CIF.

Preview — first 36 linescif
data_parser_edge_cases
_simple_value                     42
_quoted_single                    'a value with spaces'
_quoted_double                    "another value, with a comma"
_apostrophe_inside                'the sample's label'
_hash_not_a_comment               'value with a # inside quotes'
_value_unknown                    ?
_value_inapplicable               .
_number_with_su                   1.2345(7)
_negative_number                  -0.00042
_exponent_number                  1.5e-3

_semicolon_text_field
;
A multi-line semicolon-delimited text field.
It may contain 'quotes', "double quotes", # hashes and a lone ; that is not
at the start of a line, and it ends only at a semicolon in column one.
;

loop_
_pair_name
_pair_value
  alpha  1
  beta   2
  gamma  3

loop_
_wrapped_a
_wrapped_b
_wrapped_c
  1 2
  3
  4 5 6

# a real comment, outside any value

Specifications

Tags
10
Loops
2
Semicolon Text Fields
1
Apostrophe Inside Quotes
true
Hash Inside Quotes
true
Unknown Marker
?
Inapplicable Marker
.
Standard Uncertainty Notation
1.2345(7)
Wrapped Loop Rows
values continue across lines

Testing contract

Expected to pass
Scenario
Parse the file and report the value of each tag plus the row count of both loops.
Expected result
The second loop yields two rows of three values despite wrapping across four lines, _value_unknown and _value_inapplicable are distinguished, and the hash inside quotes is not treated as a comment.

What is a .cif file?

CIF (Crystallographic Information File) is the IUCr's standard text format for crystal structures. It is a tagged plain-text format in which `_data_name value` pairs and `loop_` blocks carry unit-cell parameters, symmetry operations, atom sites with fractional coordinates and occupancies, and full experimental provenance. mmCIF, its macromolecular profile, is now the archival format of the Protein Data Bank.

How to use this file

Use an example .cif file to test crystallography parsers and structure viewers, exercising loop_ construct handling, quoted and multi-line semicolon-delimited values, and the reconstruction of Cartesian coordinates from fractional ones and the cell parameters.

How to use this file for testing

“CIF Parser Edge Cases — Quotes, Text Fields and Wrapped Loops (.cif)” is a deterministic Novus Examples fixture for Scientific data, Editor testing, Error handling. Citation catalogs (BibTeX, RIS), chemistry structures (MDL Molfile, PDB), and gridded binary data (NetCDF, FITS) — for testing reference managers, molecule viewers, and scientific-data loaders.

Documented properties for this file: CIF · 877 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Scientific fixtures are small, valid, and fully synthetic — no real organism, patient, sample, or observation. Point your parser or loader at the file and check it reads the documented records, variables, or headers; binary formats ship a readable twin or metadata listing for comparison.

Generated by generation/scientific.py. Free for any use, no attribution required — license.