htesp.write_potcar

Writing POTCAR file from POSCAR.

FIX(23): every third-party import in this module (pymatgen) is a core dependency of the package, so nothing needs deferring here; the module is imported by eight other modules and must stay cheap.

Module Attributes

POTCAR_HELP

printed once per run when a POTCAR is missing and cannot be built

Functions

ensure_potcar([directory, poscar, outfile])

Make sure directory has a POTCAR, building one from its POSCAR.

poscar2potcar([poscar, outfile])

Function to generate the POTCAR file based on the element potentials provided in config.json file.

stage_potcar(relax_dir[, work_dir])

Put a POTCAR in relax_dir if one can be had; never fail if not.

htesp.write_potcar.poscar2potcar(poscar='POSCAR', outfile='POTCAR')[source]

Function to generate the POTCAR file based on the element potentials provided in config.json file.

If config.json file is present in the current directory or its parent directory, the function retrieves the potential dictionary from the ‘pseudo’ key in the config.json file.

If the config.json file is not found, a message indicating the absence of the ‘pseudo’ keyword is displayed.

The function reads the POSCAR file to determine the elements present in the structure and generates the corresponding POTCAR file based on the potential dictionary.

htesp.write_potcar.ensure_potcar(directory='.', poscar='POSCAR', outfile='POTCAR')[source]

Make sure directory has a POTCAR, building one from its POSCAR.

FIX(38): POTCARs are licensed, so examples/ cannot ship them – the reference R<mpid>-<compound>/relax/ directories contain INCAR, KPOINTS and POSCAR but no POTCAR. Anything that stages those four files into a working directory (mainprogram convtest most visibly) then died with FileNotFoundError: 'R<...>/relax/POTCAR' even though HTESP can build one itself from the POSCAR and pseudo.pot.

Does nothing when a POTCAR is already there. Returns True when one exists afterwards, False when it could not be produced (no POSCAR, or pymatgen has no PMG_VASP_PSP_DIR – the caller decides whether that is fatal).

htesp.write_potcar.POTCAR_HELP = "VASP POTCARs are licensed, so HTESP cannot ship them and the reference\n  R<mpid>-<compound>/relax/ directories contain INCAR, KPOINTS and POSCAR\n  only.  To have HTESP build them from your own set:\n      htesp-check --config_vasp_pot /path/to/POT_GGA_PAW_PBE\n  (a raw VASP distribution needs pymatgen's reorganisation first:\n      pmg config -p /path/to/POT_GGA_PAW_PBE ~/PBE52\n      pmg config --add PMG_VASP_PSP_DIR ~/PBE52)\n  (give either that directory or its parent).  Until then the inputs are\n  written without a POTCAR and VASP will not run on them."

printed once per run when a POTCAR is missing and cannot be built

htesp.write_potcar.stage_potcar(relax_dir, work_dir=None)[source]

Put a POTCAR in relax_dir if one can be had; never fail if not.

FIX(40): a missing POTCAR is not an error. It cannot be shipped, it is not always configurable (a machine may simply have no VASP licence), and the rest of the input generation is still useful without it – so this reports what to do and lets the caller carry on rather than aborting the scan.

Returns True when relax_dir/POTCAR exists afterwards. The explanatory message is printed at most once per process, so a 60-material scan does not repeat it 60 times.