Skip to content

SameFileError when running sequential VASP jobs in the same directory #1248

@Andrew-S-Rosen

Description

@Andrew-S-Rosen

Describe the bug
When running a VASP Flow locally without creating new directories, I get back a SameFileError. This is not particularly surprising, but I am wondering if there is a better way for atomate2 to handle this. Perhaps we should just be overwriting the files that are there, like what would happen in a normal VASP job submitted without any workflow orchestration tool? The reason this came up was because I was troubleshooting by running jobs locally and did not bother to rely on create_folders=True when launching the calculations. This is with Atomate2 0.0.21.

from atomate2.vasp.jobs.matpes import MatPesGGAStaticMaker
from pymatgen.io.vasp.sets import MatPESStaticSet
from pymatgen.core import Structure
from jobflow import Flow
from jobflow import run_locally

structure = Structure.from_file("test.cif")

toy_input_set = MatPESStaticSet(user_incar_settings={"ENCUT": 400, "KSPACING": 0.5})
static1 = MatPesGGAStaticMaker(input_set_generator=toy_input_set).make(structure)

static2 = MatPesGGAStaticMaker(name="Test 2", input_set_generator=toy_input_set, copy_vasp_kwargs={"additional_vasp_files": ("WAVECAR",)}).make(static1.output.structure, prev_dir=static1.output.dir_name)

flow = Flow([static1, static2])

run_locally(flow)
Traceback (most recent call last):
  File "/u/rosen1/.local/lib/python3.11/site-packages/jobflow/managers/local.py", line 117, in _run_job
    response = job.run(store=store)
               ^^^^^^^^^^^^^^^^^^^^
  File "/u/rosen1/.local/lib/python3.11/site-packages/jobflow/core/job.py", line 604, in run
    response = function(*self.function_args, **self.function_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/u/rosen1/.local/lib/python3.11/site-packages/atomate2/vasp/jobs/base.py", line 214, in make
    copy_vasp_outputs(prev_dir, **self.copy_vasp_kwargs)
  File "/u/rosen1/.local/lib/python3.11/site-packages/atomate2/utils/file_client.py", line 586, in gen_file_client
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/u/rosen1/.local/lib/python3.11/site-packages/atomate2/vasp/files.py", line 89, in copy_vasp_outputs
    copy_files(
  File "/u/rosen1/.local/lib/python3.11/site-packages/atomate2/utils/file_client.py", line 588, in gen_file_client
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/u/rosen1/.local/lib/python3.11/site-packages/atomate2/common/files.py", line 73, in copy_files
    file_client.copy(from_file, to_file, src_host=src_host)
  File "/u/rosen1/.local/lib/python3.11/site-packages/atomate2/utils/file_client.py", line 240, in copy
    shutil.copy2(src_filename, dest_filename)
  File "/u/rosen1/.conda/envs/cms/lib/python3.11/shutil.py", line 448, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/u/rosen1/.conda/envs/cms/lib/python3.11/shutil.py", line 236, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: PosixPath('/work/nvme/bems/rosen1/test/test/INCAR.gz') and PosixPath('/work/nvme/bems/rosen1/test/test/INCAR.gz') are the same file

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions