Home   Manual

Customizing Input Generators for Avogadro2

Hi all,
I want to add the word “atom” before the x,y, and z coordinates for each element for an input generator. I know this can be done manually in the text editor but I would like to automate the process and incorporate this into the python code. I am only a beginner in python, but how should I modify the output:

output += ‘$$coords:xyz_S$$’

in order to add a string “atom” before the coordinates?

The $$coords$$ options will format a whole block, so that won’t quite work for you.

I’d take a look at the dalton.py script. Dalton requires sorting atoms by element type, so it’s not quite what you want, but something like this might help:

    coords3d = cjson['atoms']['coords']['3d']
    for z in cjson['atoms']['elements']['number']:
        coords = coords3d[start:start + 3]
        coordfile += 'atom %15.5f%15.5f%15.5f %s\n' % (
                coords[0], coords[1], coords[2], symbols[z])
        start += 3

Happy to help - always looking for more generator scripts. :slight_smile:

Thank you so much for your help!. This is exactly what I needed.

Let me know when you finish the script - we’re working on a system to distribute new plugins.

By the way, what program are you using? (e.g., what’s the program for the input generator?)

I was creating an input generator for the FHI-aims package. I finished the script, and have uploaded it on GitHub. It produces the required “geometry.in” input file.


Do you need the unit cell information / fractional coordinates? I should have asked earlier. For cases with a unit cell, you can get lattice vectors and coordinates in fractional unit cell coords too.

Dear Francesca

Did you finish the FHI-aims input generator? I saw your Github, but there were no plugins there! I’ll be happy to help.