File: score-size.py

package info (click to toggle)
python-ase 3.26.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (31 lines) | stat: -rw-r--r-- 810 bytes parent folder | download
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
# creates: score-size-fcc2sc.svg

import glob
import json
import os

import matplotlib.pyplot as plt

for fname in glob.glob('Popt*2*.json'):
    tag = os.path.basename(fname).replace('Popt-', '').replace('.json', '')

    with open(fname) as data_file:
        data = json.load(data_file)
    x = []
    y = []
    for nuc, rec in sorted(data.items()):
        x.append(int(nuc))
        y.append(rec['dev'])

    plt.figure(figsize=(4, 3))
    plt.text(
        1950,
        0.35,
        tag.replace('2', r' $\rightarrow$ '),
        horizontalalignment='right',
    )
    plt.xlabel(r'Number of primitive unit cells $N_{uc}$')
    plt.ylabel(r'Optimality measure $\bar \Delta$')
    plt.axis([0, 2000, -0.025, 0.4])
    plt.plot(x, y, 'bo')
    plt.savefig('score-size-%s.svg' % tag, bbox_inches='tight')