Working with Atoms

Next define some general methods for working with atoms:

Options[MoveAtom]={"x"->0,"y"->0,"z"->0};
MoveAtom[a_Atom,
 x:_?NumericQ:Automatic,
 y:_?NumericQ:Automatic,
 z:_?NumericQ:Automatic,
 OptionsPattern[]]:=(a["Position"]=(a["Position"]+{
  Replace[x,Automatic:>OptionValue["x"]],
  Replace[y,Automatic:>OptionValue["y"]],
  Replace[z,Automatic:>OptionValue["z"]]
  }));
Options[DisplayAtom]=Flatten@{
 FilterRules[Options@Graphics3D,
  Except[Boxed|Lighting|ImageSize]
  ],
 Boxed->False,
 Lighting->"Neutral",
 ImageSize->Small,
 Scaled->.25
 };
DisplayAtom[a_Atom,ops:OptionsPattern[]]:=Graphics3D[{
  a["Color"],
  Sphere[a["Position"],Replace[OptionValue[Scaled],Except[_?NumericQ]:>1]QuantityMagnitude@UnitConvert[a["Radius"],"Angstroms"]]
  },
 FilterRules[{ops,Options@DisplayAtom},Options@Graphics3D]
 ];

Note that these are just a few of the functions we can define. Later, once our whole framework is set up we can define reams more.

results matching ""

    No results matching ""