A recent post (http://quantumwise.com/forum/index.php?topic=4.0
) asked about importing XYZ files into VNL. Here is a way to export
XYZ files from VNL! It is not possible as a direct function in the program, but it is relatively simple anyway, by using just a few lines of NanoLanguage code.
1. Open an editor (it can be the Script Editor
in VNL) and make a NanoLanguage script that contains the following code:
from ATK.KohnSham import *
def printXYZFile (configuration):
elements = configuration.elements()
coordinates = configuration.cartesianCoordinates()
print 'From VNL'
for elem,coords in zip(elements,coordinates):
for i in coords:
2. If you are using Windows, you first need to make a new directory called site-packages
in the directory atk\lib
in the VNL installation.
On Linux, this directory already exists, but is located in atk\lib\python2.4
3. Save the file in the directory site-packages
. Call it xyzexport.py
4. Now, assume we have a molecule in VNL, built e.g. in the Molecular Builder
. Drag the molecule from the Molecular Builder to the Script Editor
(make sure the editor is empty, in case you used it to create the script above). The corresponding NanoLanguage code will be shown in the editor. Now add these two lines at the bottom of the script:
from xyzexport import printXYZFile
5. Drop the script on the Job Manager
, and behold - an XYZ listing of the molecule will be printed in the Log Window
. From there, you can just copy/paste the lines and save them as an XYZ file. (To copy lines from the Log Window, mark them and press Ctrl-C!)
In the future, whenever you want to export an XYZ file, you just follow steps 4 and 5 each time.
A ready file xyzexport.py
is attached for convenience, you can copy it into the site-packages
- Note that this trick is generally useful. Any Python files that are placed in site-packages can be imported directly in NanoLanguage scripts that are executed in the Job Manager.
- In order to make the same script available also in NanoLanguage scripts executed with ATK, you just copy the same file to the same directory in the ATK installation.