3

Background

I want to spatially model systems of atoms. Atoms have the shape of a sphere and the diameter for all spheres is the same. Spheres cannot deform, they tend to touch each other but overlaps are not allowed.

Desirable features

The GUI shall allow to place spheres in a 3d-environment and render different views. It would be helpful if the program considers that the spheres cannot overlap and arrange the spheres in touch with each other, align them in a line, or bring a sphere in touch with three other spheres on a triangular grid. There are not more than ten spheres to arrange in a scence. Easy placement is possible if I can control which spheres are touching or the program suggests suitable positions.

Optional features

Esthetics or special artistic effects are not important, it would be sufficient if the color of any sphere can be selected. Setting transparency of a sphere would be optional. Also optional would be the creation of animations of moving spheres.

Examples for programs that are not comfortable

I could use Blender but this is a general-purpose software and not comfortable for my purpose. A code-based renderer like Povray oder OpenSCAD is also quite cumbersome.

1 Answer 1

0

You can use a parametric program such as OpenSCAD (text based, free, multi-platform) which would require you to provide the math necessary to keep the spheres apart. The alignment portion would be based on the locations provided at the point of creation, while the just-touching aspect also applies.

For example:

openscad spheres

I'm not a programmer. The code below generates the image as an example to illustrate the simplest arrangement in which spheres are aligned and also tangent to each other. Greater complexity can be had with more complex math. Note that the code below uses assignments, although one could place numeric values in place of the parameters. Greater flexibility is to be had using parameters.

$fn = 90;
atom_dia = 4;

color("blue")
sphere(atom_dia);

translate([atom_dia * 2, 0, 0])
color("red")
sphere(atom_dia);

translate([atom_dia * 4, 0, 0])
color("green")
sphere(atom_dia);

translate([atom_dia * -2, 0, 0])
color("yellow")
sphere(atom_dia);

translate([0, atom_dia * 2, 0])
color("purple")
sphere(atom_dia);

The "camera" angles and placement can be configured as desired prior to rendering the image. Animation is also possible with OpenSCAD, although I am not qualified to advise to that feature.

1
  • That's not what I am looking for. It is just a renderer without GUI. Nov 10, 2021 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.