Hello,
I would like to write a python script having as input an atom selection, to be used by ASE to define constraints and run some calculators. Could it be possible to get the corresponding lines of code, just the list of selected atoms?
Thanks in advance.
1 Like
Yes, there’s a bit in the script documentation on getting the selected atoms:
https://two.avogadro.cc/develop/scripts/example2.html#support-for-selection
Basically, if you look in the cjson
attribute in a script, you can do something like this:
cjson[“atoms”][“selected”] # a list of True / False values (1, 0) for each atom
Incidentally, while I haven’t finished merging constraints into the code (or cjson) those will also be exposed so that you can set a constraint in Avogadro and pass them to ASE or whatever package you want.
1 Like