The fillDbVasp program has three possible main functions:
- Delete and recreate the model database table. This function is rarely used.
- Delete and recreate the contrib database table. This function is rarely used.
- Analyze the contents of a directory corresponding to a single wrapId, and ingest the data into the database. This is the function invoked by wrapReceive.py.
Continuing with the third choice ...
For each relative subdir specified in the wrapId.json file, fillDbVasp finds the reconstructed directory and calls fillRow to handle the directory. The fillRow method calls readVasp.py to read the vasprun.xml file. The readVasp.py program returns a map (Python dictionary) and adds a single row to the model table.
Finally, fillDbVasp adds a single row to the contrib table with information about the wrapId covering the entire set of directories.
Reads a dir tree and adds rows to the database table “model”. The function is determined by the -func parameter; see below.
This function is called by wrapReceive.py.
Command line parameters:
Parameter | Type | Description |
---|---|---|
-bugLev | integer | Debug level. Normally 0. |
-func | string | Function. See below. |
-useCommit | boolean | false/true: do we commit changes to the DB. |
-requireIcsd | boolean | no/yes: do we require that the file path names contain ICSD info. See notes below. |
-allowExc | boolean | false/true: continue after error. |
-modType | string | SQL mod type: insert or update. |
-readType | string | if outcar: OUTCAR; if xml: for vasprun.xml. 2014-06-10: now we only support outcar, since some info is not in vasprun.xml. |
-deleteTable | boolean | false/true: If func is create*, do we delete the old table first. |
-wrapPrefix | string | Prefix of dir names before wrapId. |
-topDir | string | Top of dir tree. |
-dirList | string | File containing dirs to be ingested. If a dir name ends with “metadata”, the “metadata” part is stripped. |
-zzflag | string | Input file from wrapUpload.py. |
-inSpec | string | JSON file containing DBMS parameters. See below. |
Values for the -func Parameter:
inSpec File Parameters:
Parameter | Description |
---|---|
dbhost | Database hostname. |
dbport | Database port number. |
dbuser | Database user name. |
dbpswd | Database password. |
dbname | Database database name. |
dbschema | Database schema name. |
dbtablemodel | Database name of the “model” table. |
inSpec file example::
{
"dbhost" : "scctest",
"dbport" : "6432",
"dbuser" : "x",
"dbpswd" : "x",
"dbname" : "cidlada",
"dbschema" : "satom",
"dbtablemodel" : "model"
}
requireIcsd:
If requireIcsd is true, getIcsdMap() must be able to extract ICSD info from the file names. File names must be like:
.../icsd_083665/icsd_083665.cif/ls-anti-ferro-7/relax_cellshape/1
^^^^^^ ^^^^^^^^ ^ ^^^^^^^^^^^^^^^ ^
icsdNum magType magNum relaxType relaxNum
Reads a dir tree and adds rows to the database table “model”.
Parameters:
bugLev (int): Debug level. Normally 0.
func (str): Overall function. One of the following:
- 'createTableModel' Drop and create the model table.
- 'fillTable' Read a dir tree and add rows to the database table “model”.
useCommit (boolean): If True, we commit changes to the DB.
requireIcsd (boolean): if True, the absTopDir string must contain ICSD info that getIcsdMap() can extract.
allowExc (boolean): If True, continue after error
modType (string): SQL mod type: insert or update.
readType (string): If outcar use OUTCAR; if xml use vasprun.xml.
deleteTable (boolean): If True and func is create*, delete the specified table before creating it.
wrapPrefix (str): Prefix of dir names before wrapId.
topDir (str): Top of the directory tree.
dirList (str): File containing dirs to be ingested. If a dir name ends with “metadata”, the “metadata” part is stripped.
zzflag (str): Input file from wrapUpload.py.
See description at main().
Returns
Creates the database table “model”.
Parameters:
Returns
Adds one row to the model table, corresponding to relDir.
Parameters:
bugLev (int): Debug level. Normally 0.
useCommit (boolean): If True, we commit changes to the DB.
requireIcsd (boolean): if True, the absTopDir string must contain ICSD info that getIcsdMap() can extract.
allowExc (boolean): If True, we continue after an error.
modType (string): SQL mod type: insert or update.
readType (string): If outcar use OUTCAR; if xml use vasprun.xml.
wrapId (str): Arbitrary name for this set of data.
this tree containing a metadata file.
this tree containing a metadata file.
conn (psycopg2.connection): Open DB connection
cursor (psycopg2.cursor): Open DB cursor
dbschema (str): Database schema name
dbtablemodel (str): Database name of the “model” table.
Returns
Formats a Python array into SQL format.
Recursively formats a Python array, so the Python array `` [[11.1, 22.2], [33.3, 44.4]]`` is formatted into the string: 'array[array[11.1,22.2],array[33.3,44.4]]'
Parameters:
Returns