Skip to content

DifferentPrimitivesException in some COS calculations #278

@RaphaelRobidas

Description

@RaphaelRobidas

Describe the bug
A small, but constant portion of growing string calculations I launch end up crashing with this exception:

Traceback (most recent call last):
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/intcoords/helpers.py", line 36, in get_tangent
    tangent = prims2 - prims1
              ~~~~~~~^~~~~~~~
ValueError: operands could not be broadcast together with shapes (341,) (340,) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/robidasr/goldenv_3.11/bin/pysis", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/run.py", line 2054, in run
    run_result = run_from_dict(run_dict, **run_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/run.py", line 1993, in run_from_dict
    run_result = main(run_dict, restart, cwd, scheduler)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/run.py", line 1516, in main
    opt_result = run_opt(
                 ^^^^^^^^
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/drivers/opt.py", line 151, in run_opt
    opt.run()
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/optimizers/Optimizer.py", line 928, in run
    reparametrized = self.geometry.reparametrize()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/cos/GrowingString.py", line 474, in reparametrize
    self.reparam_dlc(desired_param_density, thresh=self.reparam_tol)
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/cos/GrowingString.py", line 299, in reparam_dlc
    cur_param_density = self.get_cur_param_density()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/cos/GrowingString.py", line 88, in get_cur_param_density
    diffs = [
            ^
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/cos/GrowingString.py", line 89, in <listcomp>
    image - self.images[max(i - 1, 0)] for i, image in enumerate(self.images)
    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/Geometry.py", line 360, in __sub__
    diff = -get_tangent(
            ^^^^^^^^^^^^
  File "/home/robidasr/goldenv_3.11/lib/python3.11/site-packages/pysisyphus/intcoords/helpers.py", line 38, in get_tangent
    raise DifferentPrimitivesException
pysisyphus.intcoords.exceptions.DifferentPrimitivesException

This is very similar to a bug I previously reported (#218)

To Reproduce
The crash occurs repeatably using these input files:
input_files.zip

Expected behavior
I would expect either the calculation to work or Pysisyphus to handle this exception and stop gracefully.

OS and Python:

  • OS: Debian trixie
  • Python version: 3.11.6

Pysisyphus version
This kind of crash has been occurring randomly for at least two months (although most calculations worked fine) and I confirmed that the behavior is the same with the latest commit on master (5950976)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions