pos2pkl.py

Script to convert structre data into init_struc_data.pkl. The default input format is init_POSCARS. Single structure data such as POSCAR and cif files can be optionally converted. Output is init_struc_data.pkl. Structure data can be added to an already existing init_struc_data.pkl. The structure ID is not taken into account and is newly assigned. If the number of atoms is different, an error is generated.

init_struc_data.pkl can be loaded at the start of the simulation in CrySPY.

Usage

usage: pos2pkl.py [-h] [-s [SINGLE ...]] [infile ...]

positional arguments:
  infile                input file: init_POSCARS

optional arguments:
  -h, --help            show this help message and exit
  -s [SINGLE ...], --single [SINGLE ...]
                        input file: single structure file (POSCAR, cif)

Examples

init_POSCARS –> init_struc_data.pkl

It can be used to convert init_POSCARS generated by CrySPY to init_struc_data.pkl in another machine such as a supercomputer. Multiple input files can be converted.

$ python3 pos2pkl.py init_POSCARS

Converted. The number of structures: 4
Save init_struc_data.pkl

Multiple inputs:

$ python3 pos2pkl.py init_POSCARS init_POSCARS2 init_POSCARS3

Converted. The number of structures: 12
Save init_struc_data.pkl

If init_struc_data.pkl already exists in the current directory and you want to append to it:

$ python3 pos2pkl.py init_POSCARS
init_struc_data.pkl already exists.
Append to init_struc_data.pkl? [y/n]: y

Load init_struc_data. The number of structures: 12

Converted. The number of structures: 16
Save init_struc_data.pkl

POSCAR or cif –> init_struc_data.pkl

Single structure data such as POSCAR and cif files can also be converted. -s/--single option is required.

$ python3 pos2pkl.py -s POSCAR test.cif

Converted. The number of structures: 2
Save init_struc_data.pkl

init_POSCARS, POSCAR –> init_struc_data.pkl

$ python3 pos2pkl.py init_POSCARS -s POSCAR

Converted. The number of structures: 5
Save init_struc_data.pkl

The following is wrong. The init_POSCARS is also treated as a single structure.

$ python3 pos2pkl.py -s POSCAR init_POSCARS