Skip to content

Settings generated from plams.AMSMDJob.restart_from cannot pickle #317

Description

@GiulioIlBen

In: https://github.com/SCM-NV/PLAMS/blob/trunk/src/scm/plams/recipes/md/amsmdjob.py

    @staticmethod
    def _get_restart_job_velocities_molecule(other_job, frame=None, settings=None, get_velocities_molecule=True):
        """
        other_job: str or some AMSMdJob

        get_velocities_molecule : bool
            Whether to get the velocities and molecule right now. Set to False to not access other_job.results (for use with MultiJob prerun() methods)

        Returns: (other_job [AMSJob], velocities, molecule, extra_settings [Settings])
        """
        if isinstance(other_job, str):
            other_job = AMSJob.load_external(other_job)
        if get_velocities_molecule:
            if frame:
                velocities = (other_job.results.rkfpath(), frame)
                molecule = other_job.results.get_history_molecule(frame)
            else:
                velocities = other_job
                molecule = other_job.results.get_main_molecule()

velocities = other_job means that velocities can be a plams.AMSJob object so if you do a copy.deepcopy of the settings it results:

TypeError: cannot pickle '_thread.lock' object

can we change it to velocities = other_job.results.rkfpath()?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions