/usr/share/pyshared/ase/io/iwm.py is in python-ase 3.6.0.2515-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | from math import pi, cos, sin, sqrt, acos
import numpy as np
from ase.data import chemical_symbols
from ase.atoms import Atoms
from ase.parallel import paropen
iwm_symbols = {'1' : 'C',
'2' : 'Au',
'5' : 'Ag'}
def read_iwm(fileobj, index=-1):
if isinstance(fileobj, str):
fileobj = open(fileobj)
lines = fileobj.readlines()
L1 = lines[1].split()
if len(L1) == 1:
del lines[:3]
natoms = int(L1[0])
else:
natoms = len(lines)
images = []
positions = []
symbols = []
for line in lines[:natoms]:
symbol, mass, x, y, z = line.split()[:5]
if symbol in iwm_symbols:
symbols.append(iwm_symbols[symbol])
else:
symbols.append(chemical_symbols[int(symbol)])
positions.append([float(x), float(y), float(z)])
del(lines[natoms:3 * natoms + 3])
cell = []
for line in lines[natoms:natoms+3]:
x, y, z = line.split()[:3]
cell.append(np.array([float(x), float(y), float(z)]))
images.append(Atoms(symbols=symbols, positions=positions, cell=cell))
return images[index]
|