23 lines
598 B
Mathematica
23 lines
598 B
Mathematica
|
(*
|
||
|
Usage: Please set the fowllowing variables from outside as
|
||
|
command line arguments, like this:
|
||
|
wolframscript -file psi4_value.wl psi4_file x y z
|
||
|
for example:
|
||
|
wolframscript -file psi4_value.wl psi4.txt 1.2 2.1 3.4
|
||
|
*)
|
||
|
|
||
|
(* Parsing arguments *)
|
||
|
argv = Rest@$ScriptCommandLine;
|
||
|
(* Print[argv] *)
|
||
|
Check[
|
||
|
psi4file = argv[[1]];
|
||
|
{x, y, z} = ToExpression[argv[[2]]];
|
||
|
,
|
||
|
Print["Error: Check your command line arguments!"];Abort[]
|
||
|
];
|
||
|
|
||
|
psi4[r_, theta_, phi_] = ToExpression[Import[psi4file, "Text"] ]/.{t->0};
|
||
|
|
||
|
result = psi4@@ToSphericalCoordinates[{x,y,z}]
|
||
|
Print[Re@result, " ", Im@result]
|