3
$\begingroup$

Following the tutorial on Exploring Symmetries of Crystal Systems and using the code below:

Clear["Global`*"]; symmetryprops = {"Entity", "RequiredPointGroupSymmetries", "CrystallographicPointGroups", "CrystallographicSpaceGroups", "BravaisLattices", "LatticeSystems"}; symmetryheader = StringReplace[ Prepend[CommonName[ EntityProperty["CrystalFamily", #] & /@ Rest[symmetryprops]], CommonName[Entity["CrystalSystem"]]], "crystallographic" -> ""]; TextGrid[ Prepend[MapAt[Length, EntityValue["CrystalSystem", symmetryprops], {All, 3 ;; 5}], symmetryheader], Sequence[Dividers -> All, Background -> {Automatic, {{LightBlue, None}}}]] 

Mathematica gives me warning messages:

Error: CommonName:Entity[CrystalSystem] is not an entity. StringReplace:Stringorlistofstringsexpectedatposition1inStringReplace[{CommonName[Entity[CrystalSystem]],requiredpointgroupsymmetry,crystallographicpointgroups,crystallographicspacegroups,Bravaislattice,latticesystems},crystallographic]

Why?

$\endgroup$
1
  • $\begingroup$ The error message seems pretty clear here, the thing you are passing to StringReplace is not a string. $\endgroup$ Commented Nov 17, 2023 at 13:46

1 Answer 1

4
$\begingroup$

CommonName must be mapped over x

Replace CommonName[Entity[CrystalSystem]] with CrystalSystem

Clear["Global`*"]; symmetryprops = {"Entity", "RequiredPointGroupSymmetries", "CrystallographicPointGroups", "CrystallographicSpaceGroups", "BravaisLattices", "LatticeSystems"}; x = EntityProperty["CrystalFamily", #] & /@ Rest[symmetryprops]; symmetryheader = StringReplace[Prepend[CommonName /@ x, "CrystalSystem"], "crystallographic" -> ""] TextGrid[ Prepend[MapAt[Length, EntityValue["CrystalSystem", symmetryprops], {All, 3 ;; 5}], symmetryheader], Sequence[Dividers -> All, Background -> {Automatic, {{LightBlue, None}}}]] 

enter image description here

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.