Skip to content

Converts .xyz coordinate files to povray scenes

License

Notifications You must be signed in to change notification settings

nbehrnd/xyz2pov

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xyz2pov

This implementation in Python and numpy converts a structure described by an xyz coordinate file into POV-Ray scenes by

python ./xyz2povray.py input.xyz

with files input.pov and input.ini. Subsequently, either

  • run povray ./input.pov to write a single bitmap input.png (800 × 600 px), or
  • run povray ./input.ini to generate a sequence of 36 frames (640 × 420 px) to rotate the structure around POV-Ray's x-axis. This can be used to generate an animated gif (for instance on ezgif) as shown below for a cyclic form of glucose.

Example for glucose

All atoms starting from atomic number 1 (hydrogen, H) up to 96 (curium, Cm) are supported by a color scheme close to the one used by Jmol. If the interatomic distance is less or equal the sum of the corresponding covalent radii compiled by Wikipedia, two atoms are considered to be bound together; the model depicts them as connected by a tube. An atom "too far out" to bind with an other atom is going to be displayed as a sphere.

The camera is automatically directed to the molecule's center of mass and placed at an appropriate distance. Two lights are placed relative to the camera automatically.

alternatives to xyz2pov

Alternative programs to describe a structure in the PovRay format include Jmol (see instructions), and Avogadro (see instructions), or CCDC's Mercury (see instructions) with a GUI. Equally, openbabel allows the generation from the CLI (see instructions).

At time of writing, reserve about 93MB permanent memory for a virtual Python environment to support the script xyz2mol.py. Consider about 2MB in addition for the script and its documentation.

future compatibility with numpy2

For February 1st, 2024, numpy2 is scheduled to be published as replacement for numpy (see for instance here). Though ruff (version 0.1.13) does not identify an issue in xyz2pov.py related to this transition, for now, requirements.txt constrains the installation of numpy to be any version greater or equal to 1.24.0, but less than version 2.0.

About

Converts .xyz coordinate files to povray scenes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%