CLI Usage¶
The cdl command-line tool provides parsing, validation, and exploration of CDL notation.
Installation¶
The CLI is installed automatically with the package:
Commands¶
Parse¶
Parse and display a CDL string:
Output:
Validate¶
Validate a CDL string without parsing:
Output:
Invalid input:
Output:
JSON Output¶
Output parsed result as JSON:
Output:
{
"system": "cubic",
"point_group": "m3m",
"forms": [
{
"miller": {"h": 1, "k": 1, "l": 1},
"scale": 1.0
}
],
"modifications": [],
"twin": null
}
List Options¶
List available crystal systems:
Output:
List point groups:
Output:
Point Groups by System:
cubic: m3m, 432, -43m, m-3, 23
tetragonal: 4/mmm, 422, 4mm, -42m, 4/m, -4, 4
...
List named forms:
Output:
List twin laws:
Output:
Twin Laws:
spinel - Spinel law (111) contact twin
brazil - Brazil law quartz twin
japan - Japan law quartz twin
fluorite - Fluorite interpenetration twin
iron_cross - Iron cross pyrite twin
Examples¶
Basic Parsing¶
# Simple octahedron
cdl parse "cubic[m3m]:{111}"
# Diamond-like truncated octahedron
cdl parse "cubic[m3m]:{111}@1.0 + {100}@1.3"
# Quartz prism with rhombohedron
cdl parse "trigonal[-3m]:{10-10}@1.0 + {10-11}@0.8"
Using Named Forms¶
# Using named form instead of Miller index
cdl parse "cubic[m3m]:octahedron"
# Combining named forms
cdl parse "cubic[m3m]:cube + octahedron@0.5"
Twin Specifications¶
# Spinel-law twinned octahedron
cdl parse "cubic[m3m]:{111} | twin(spinel)"
# Japan law quartz twin
cdl parse "trigonal[-3m]:{10-10} + {10-11} | twin(japan)"
Scripting¶
Use with shell scripting:
# Validate multiple CDL strings
for cdl in "cubic[m3m]:{111}" "cubic[m3m]:{100}" "invalid"; do
if cdl validate "$cdl" 2>/dev/null; then
echo "$cdl: valid"
else
echo "$cdl: invalid"
fi
done
Process JSON output with jq: