Exemplo n.º 1
0
#!/usr/bin/python

# Plot E(V) curve.

from pwtools import sql, mpl, io

db = sql.SQLiteDB('calc.db')
data = db.get_array("select volume,etot from calc order by volume")
natoms = io.cpickle_load('results/0/traj.pk').natoms

# plotting
fig,ax = mpl.fig_ax()
ax.plot(data[:,0]/float(natoms), data[:,1]/float(natoms))
ax.set_ylabel('energy/atom [eV]')
ax.set_xlabel('volume/atom [Ang^3]')

mpl.plt.show()
Exemplo n.º 2
0
db = sql.SQLiteDB('calc.db', table='calc')
idx_lst = db.get_list1d("select idx from calc")

cols = [
    ('etot', 'float'),  # eV
    ('pressure', 'float'),  # GPa
    ('volume', 'float'),  # Ang**3
    ('forces_rms', 'float'),  # eV / Ang
    ('sxx', 'float'),  # GPa
    ('syy', 'float'),  # GPa
    ('szz', 'float'),  # GPa
]
db.add_columns(cols)

for idx in idx_lst:
    print(idx)
    struct = io.cpickle_load('results/%i/traj.pk' % idx)[-1]
    db.execute("update calc set etot=? where idx==?", (struct.etot, idx))
    db.execute("update calc set volume=? where idx==?", (struct.volume, idx))
    db.execute("update calc set pressure=? where idx==?",
               (struct.pressure, idx))
    db.execute("update calc set sxx=? where idx==?",
               (struct.stress[0, 0], idx))
    db.execute("update calc set syy=? where idx==?",
               (struct.stress[1, 1], idx))
    db.execute("update calc set szz=? where idx==?",
               (struct.stress[2, 2], idx))
    db.execute("update calc set forces_rms=? where idx==?",
               (num.rms(struct.forces), idx))
db.commit()
Exemplo n.º 3
0
# Load parsed results and put some values in the database.

from pwtools import sql, io, num

db = sql.SQLiteDB('calc.db', table='calc')
idx_lst = db.get_list1d("select idx from calc")

cols = [('etot', 'float'),          # eV
        ('pressure', 'float'),      # GPa
        ('volume', 'float'),        # Ang**3
        ('forces_rms', 'float'),    # eV / Ang
        ('sxx', 'float'),           # GPa
        ('syy', 'float'),           # GPa
        ('szz', 'float'),           # GPa
        ]
db.add_columns(cols)

for idx in idx_lst:
    print idx
    struct = io.cpickle_load('results/%i/traj.pk' %idx)[-1]
    db.execute("update calc set etot=? where idx==?", (struct.etot, idx))
    db.execute("update calc set volume=? where idx==?", (struct.volume, idx))
    db.execute("update calc set pressure=? where idx==?", (struct.pressure, idx))
    db.execute("update calc set sxx=? where idx==?", (struct.stress[0,0], idx))
    db.execute("update calc set syy=? where idx==?", (struct.stress[1,1], idx))
    db.execute("update calc set szz=? where idx==?", (struct.stress[2,2], idx))
    db.execute("update calc set forces_rms=? where idx==?",
               (num.rms(struct.forces), idx))
db.commit()
Exemplo n.º 4
0
# Load parsed results and put some values in the database.

from pwtools import sql, io, num

db = sql.SQLiteDB('calc.db', table='calc')
idx_lst = db.get_list1d("select idx from calc")

cols = [('etot', 'float'),          # eV
        ('pressure', 'float'),      # GPa
        ('volume', 'float'),        # Ang**3
        ('forces_rms', 'float'),    # eV / Ang
        ('sxx', 'float'),           # GPa
        ('syy', 'float'),           # GPa
        ('szz', 'float'),           # GPa
        ]
db.add_columns(cols)

for idx in idx_lst:
    print idx
    struct = io.cpickle_load('results/%i/struct.pk' %idx)
    db.execute("update calc set etot=? where idx==?", (struct.etot, idx))
    db.execute("update calc set volume=? where idx==?", (struct.volume, idx))
    db.execute("update calc set pressure=? where idx==?", (struct.pressure, idx))
    db.execute("update calc set sxx=? where idx==?", (struct.stress[0,0], idx))
    db.execute("update calc set syy=? where idx==?", (struct.stress[1,1], idx))
    db.execute("update calc set szz=? where idx==?", (struct.stress[2,2], idx))
    db.execute("update calc set forces_rms=? where idx==?",
               (num.rms(struct.forces), idx))
db.commit()
Exemplo n.º 5
0
# Load parsed results and put some values in the database.

from pwtools import sql, io, num

db = sql.SQLiteDB('calc.db', table='calc')
idx_lst = db.get_list1d("select idx from calc")

cols = [('etot', 'float'),          # eV
        ('pressure', 'float'),      # GPa
        ('volume', 'float'),        # Ang**3
        ('forces_rms', 'float'),    # eV / Ang
        ('sxx', 'float'),           # GPa
        ('syy', 'float'),           # GPa
        ('szz', 'float'),           # GPa
        ]
db.add_columns(cols)

for idx in idx_lst:
    print(idx)
    struct = io.cpickle_load('results/%i/struct.pk' %idx)
    db.execute("update calc set etot=? where idx==?", (struct.etot, idx))
    db.execute("update calc set volume=? where idx==?", (struct.volume, idx))
    db.execute("update calc set pressure=? where idx==?", (struct.pressure, idx))
    db.execute("update calc set sxx=? where idx==?", (struct.stress[0,0], idx))
    db.execute("update calc set syy=? where idx==?", (struct.stress[1,1], idx))
    db.execute("update calc set szz=? where idx==?", (struct.stress[2,2], idx))
    db.execute("update calc set forces_rms=? where idx==?",
               (num.rms(struct.forces), idx))
db.commit()
Exemplo n.º 6
0
#!/usr/bin/python

# Plot E(V) curve.

from pwtools import sql, mpl, io

db = sql.SQLiteDB('calc.db')
data = db.get_array("select volume,etot from calc order by volume")
natoms = io.cpickle_load('results/0/traj.pk').natoms

# plotting
fig, ax = mpl.fig_ax()
ax.plot(data[:, 0] / float(natoms), data[:, 1] / float(natoms))
ax.set_ylabel('energy/atom [eV]')
ax.set_xlabel('volume/atom [Ang^3]')

mpl.plt.show()