Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions src/custodian/vasp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,3 @@ def is_valid_poscar(filename: str, directory: str = "./") -> bool:
except Exception as exc:
logger.warning(f"{filename} could not be parsed: {exc}")
return False


def copy_contcar_to_poscar_if_valid(directory: str = "./") -> list[dict]:
"""Return action to copy CONTCAR to POSCAR only if CONTCAR is valid.

This prevents copying incomplete CONTCAR files that may result from
terminating VASP mid-write.

Args:
directory: Directory containing CONTCAR

Returns:
List containing the copy action if CONTCAR is valid, empty list otherwise.
"""
if is_valid_poscar("CONTCAR", directory):
return [{"file": "CONTCAR", "action": {"_file_copy": {"dest": "POSCAR"}}}]
logger.warning("CONTCAR is not valid, skipping copy to POSCAR")
return []
Loading