I created the filter which allow to load files with Cartesian geometry into
viewmol. These files have a number of atoms in the first line and comments in the second one. Next description of all atoms goes. In each line there are: symbol of element and location of atom (x,y and z vectors). You can obtained this kind of files i.e. from molden program. The filter script is written in python:
#!/usr/bin/python
from sys import *
def change(a,linia):
return float(linia.split()[a])
def reading (file_inp):
factor=1
a_number=int(file_inp.readline())
file_inp.readline()
for i in range (a_number):
linia=file_inp.readline()
atom.append(linia.split()[0])
x.append(change(1,linia)*factor)
y.append(change(2,linia)*factor)
z.append(change(3,linia)*factor)
file_inp.close
return(atom,x,y,z,a_number)
atom=[]
x=[]
y=[]
z=[]
atom,x,y,z,a_number=reading(open(argv[1]))
print('$title')
print(argv[1])
print('$coord')
for n in range(a_number):
print('%14.4f %10.4f %10.4f %7c'% (x[n],y[n],z[n],atom[n]))
print('$end')
To use it you have to copy xyz.py file into your
$VIEWMOLPATH (usually in
/usr/lib/viewmol), and modify your viewmolrc file (it should be located in your
$VIEWMOLPATH). You have to add one line :
option xyz $VIEWMOLPATH/xyz.py '%s' "SCF Done"
Now you can read your xyz file into viewmol using commandline option:
viewmol -xyz name_of_file
No comments:
Post a Comment