Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1def write_findsym(fileobj, images): 

2 symbols = images[0].get_chemical_symbols() 

3 natoms = len(symbols) 

4 

5 for atoms in images: 

6 formula = atoms.get_chemical_symbols() 

7 accuracy = 1.0e-4 

8 

9 # Write Comment 

10 fileobj.write('%s\n' % formula) 

11 fileobj.write('%f accuracy\n' % accuracy) 

12 fileobj.write('1 vectors in cartesian coordinates\n') 

13 

14 # Write cartesian coordinates of vectors 

15 for x, y, z in atoms.cell: 

16 fileobj.write('%22.15f %22.15f %22.15f\n' % (x, y, z)) 

17 

18 fileobj.write('1 no known centering\n') 

19 

20 fileobj.write('1 0 0 \n') 

21 fileobj.write('0 1 0 \n') 

22 fileobj.write('0 0 1 \n') 

23 

24 fileobj.write('%d\n' % natoms) 

25 

26 numbers = atoms.get_atomic_numbers() 

27 for n in numbers: 

28 fileobj.write('%d ' % (n)) 

29 

30 fileobj.write('\n') 

31 

32 for x, y, z in atoms.get_positions(): 

33 fileobj.write('%22.15f %22.15f %22.15f\n' % (x, y, z))