Python example
Start Blender, and open a Python console, and run
from batoms import Batoms
h2o = Batoms("h2o",
species = ["O", "H", "H"],
positions= [[0, 0, 0], [0, -0.76, -0.6], [0, 0.76, -0.6]])
Rendering the image
h2o.get_image(viewport = [1, 0 ,0], engine = "eevee", output = "h2o.png")
Use Blender to run the python script in the background
Save the aboved code as a python file (eg. yourfile.py), and run in the command line:
blender -b -P yourfile.py
Use
render
function frombatoms_api
to run Blender without run Blender explicitly.
>>> from ase.build import molecule
>>> from batoms_api import render
>>> atoms = molecule("H2O")
>>> render_input = {"viewport": [1, 1, 0], "engine": "cycles", "output": "h2o.png",}
>>> render(atoms, render_input=render_input)
Use
batoms
from command line:$ batoms "h2o.xyz" -m "1"