Thank you for pointing out this subtle difference. I tried the following method, but still failed.
In my situation, there are two wl script files opened in Mathematica. In one file, I created the following two functions and evaluated them:
toRep//ClearAll;
toRep[gen_?StringQ]:=Block[{coef,x,y,z},
coef=CoefficientArrays[gen,{x,y,z}]//Normal;
AffineTransform[{coef[[2]],coef[[1]]}]//TransformationMatrix
]
toReps//ClearAll;
toReps[gens_?StringQ]:=Block[{s,x,y,z},
s=StringSplit[gens,"\n"];
toRep/@("{"<>#<>"}"&/@s//ToExpression)
]
Then in another wl file, I evaluated the following code snippet:
In[42]:= (*
The Space Group has been identified as (No. )
Input generators
-y, -z, -x
y, -x, -z
1/8 + x, 1/8 + y, 1/8 + z
Transformation Matrix to the standard/default setting
(
)
*)
SGGenSetWrongXYZ="-y,-z,-x
y,-x,-z
x+1/8,1/8+ y,z+1/8";
(*StringSplit[SGGenSetWrongXYZ,"\n"];
SGGenSetWrong=toRep/@("{"<>#<>"}"&/@%//ToExpression);*)
toReps[SGGenSetWrongXYZ]
Out[43]= {toRep[{-y, -z, -x}], toRep[{y, -x, -z}],
toRep[{1/8 + x, 1/8 + y, 1/8 + z}]}
As you can see, a portion of the result still appears as unevaluated.
Regards,
Zhao