jkitchin / vasp

New ASE compliant Python interface to VASP
122 stars 58 forks source link

Added write2db function #15

Closed jboes closed 8 years ago

jboes commented 8 years ago

Hi John,

I'm unsure whether the following function should be separated from the current "write_db" function, or not. "write_db" seems specifically tailored for manipulations in a 1 entry database, so I opted to make a separate function for this, although both are very similar and could conceivably be made one function.

I would like to incorporate a database writing function into vaspy with the following:

  1. Parsing for key-value-pairs from the directory name.
  2. Calculators separate from atoms objects so an identical calculator can be attached to multiple trajectory images.
  3. Room to easily incorporate other types of commonly used data, such as DOS, ADOS, or BEEF ensembles.

Here's an example of how this would work:

EDIT: function merged with existing write_db function.

from ase.lattice.cubic import FaceCenteredCubic as fcc
from vasp import Vasp
from vasp.vasprc import VASPRC
import numpy as np
VASPRC['queue.walltime'] = '24:00:00'

atoms = fcc('Pd',
            directions=[[0, 1, 1],
                        [1, 0, 1],
                        [1, 1, 0]])

# We will sample a large range of energy cutoffs
calcs = [Vasp('DFT/bulk=fcc/conv=encut/encut={}'.format(k),
              xc='pbe',
              kpts=[16]*3,
              encut=k,
              nsw=0,
              atoms=atoms)
         for k in np.arange(300, 1050, 50)]
nrg = [calc.potential_energy for calc in calcs]
Vasp.stop_if(None in nrg)

# Write all entries to database
[calc.write_db('DFT.db', parser='=', overwrite=False) for calc in calcs]
jboes commented 8 years ago

Another version of the write_db function which reduces a lot of the repetitive code of the write2db function.

jboes commented 8 years ago

Hi John. This functionality is becoming increasingly used by members of the group. I've been directing them to my own branch, but I'd rather establish this as part of the regular package.

Please consider it for merge and let me know if you find problems with it.