3

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?

Domen
  • 23,608
  • 1
  • 27
  • 45
lotus2019
  • 2,091
  • 5
  • 10
  • The error message seems pretty clear here, the thing you are passing to StringReplace is not a string. – Jason B. Nov 17 '23 at 13:46

1 Answers1

4

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

eldo
  • 67,911
  • 5
  • 60
  • 168