Appendix: Data file format (.bsmd file)
The app uses human-readable plain text XML files (file-extension: .bsmd) for importing/exporting model data. You can write or edit data-file directly with ordinary text editors (such as notepad) to give the app model data containing a lot of items or to alter properties of many items at once.
Ball & Stick XML elements
The app defines four kinds of XML elements to be used in data files; "Model", "Group", "Ball" and "Stick". Element names and attribute names are all case sensitive.
Example: Data file for Methane Molecule
<?xml version="1.0" encoding="utf-8"?> <Model xmlns="http://atom.fourelem.com/ns/2016"> <Group> <Ball Id="C" Position="0,0,0" Radius="0.5" Color="Black"/> <Ball Id="H1" Position="1,-1,-1" Radius="0.4" Color="GhostWhite"/> <Ball Id="H2" Position="-1,1,-1" Radius="0.4" Color="GhostWhite"/> <Ball Id="H3" Position="-1,-1,1" Radius="0.4" Color="GhostWhite"/> <Ball Id="H4" Position="1,1,1" Radius="0.4" Color="GhostWhite"/> </Group> <Group> <Stick Id="S1" BallIds="C,H1" Radius="0.08" Color="Silver"/> <Stick Id="S2" BallIds="C,H2" Radius="0.08" Color="Silver"/> <Stick Id="S3" BallIds="C,H3" Radius="0.08" Color="Silver"/> <Stick Id="S4" BallIds="C,H4" Radius="0.08" Color="Silver"/> </Group> </Model>
Root element: <Model> </Model>
"Model" must be the only one root element in a data file, which contains all other elements. You can optionally define Matrix* in its attribute that is to be applied to ball coordinates.
Example: Model element
<Model xmlns="http://atom.fourelem.com/ns/2016" Matrix="1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -0.5, -0.5, -0.5, 1"> <!-- Put all other elements here --> </Model>
Model element attributes:
- Matrix (optional): Write down 16 components of matrix in row major order.
Grouping element: <Group> </Group>
Group is an optional container element for Ball and/or Stick items. Optionally you can specify default Radius and/or Color that are to be applied to children that don't have those attributes.
Example: Group element
<Group BallColor="Gold" StickRadius="0.02"> <!-- Put Ball and/or Stick elements here --> </Group>
Group element attributes:
- BallRadius (optional): Set default Radius for child ball items
- BallColor (optional): Set default Color for child ball items
- StickRadius (optional): Set default Radius for child stick items
- StickColor (optional): Set default Color for child stick items
Ball item element: <Ball/>
Ball element defines a single ball item. Ball element must have Id and Position attributes.
Example: Ball elements
<Ball Id="B1" Position="0.0, 0.0, 0.0" Radius="0.25" Color="Blue"/> <Ball Id="B2" Position="1.0, 0.0, 0.0" Radius="0.25" Color="Red"/>
Ball element attributes:
- Id (required): Specify a unique alphanumeric id for the ball
- Position (required): X,Y,Z
- Radius (optional): Radius of the ball
- Color (optional): Color of the ball (see the last section for details)
Stick item element: <Stick/>
Stick element defines a single stick item. Stick element must have Id and BallIds attributes.
Example: Stick element
<Stick Id="S1" BallId="B1,B2" Radius="0.05" Color="Silver"/>
Stick element attributes:
- Id (required): Specify a unique alphanumeric id for the stick
- BallIds (required): Specify a pair of ball item Ids to connect
- Radius (optional): Radius of the stick
- Color (optional): Color of the stick (see the next section for details)
Color attributes
You can specify Color either by name (such as "Red", "Blue", "Green" etc.) or hexadecimal RGB form ("#RRGGBB") as is used in HTML,CSS or SVG.
The app supports following 140 named-colors (listed in hue order)