Coverage for /builds/kinetik161/ase/ase/io/findsym.py: 100.00%

22 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-12-10 11:04 +0000

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(f'{formula}\n') 

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(f'{x:22.15f} {y:22.15f} {z:22.15f}\n') 

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(f'{x:22.15f} {y:22.15f} {z:22.15f}\n')