Skip to content

Mismatched elements with COS calculations involving large structures and frozen atoms #327

@RaphaelRobidas

Description

@RaphaelRobidas

Describe the bug

I have been getting this error after the internal coordinates of some large systems are rebuilt. Many atoms are frozen and this seems to be part of the problem.

Spent 0.0 s preparing the first cycle.
               cycle     Δ(energy)  max(|force|)    rms(force)   max(|step|)     rms(step)  s/cycle
        --------------------------------------------------------------------------------------------
/home/raphael/env/lib/python3.10/site-packages/distributed/client.py:3371: UserWarning: Sending large graph of size 313.08 MiB.
This may cause some slowdown.
Consider loading the data with Dask directly
 or using futures or delayed objects to embed the data into the graph without repetition.
See also https://docs.dask.org/en/stable/best-practices.html#load-data-with-dask for more information.
  warnings.warn(
                   0           nan*     0.220976      0.015385      0.100000*     0.006962*  48.141 
        	String=  2+2 HEI=03/04 (E_hei-E_0)= 137.2 kJ/mol norm(forces_true,hei)=0.651163 E_h/a_0
Rebuilt internal coordinates!
Traceback (most recent call last):
  File "/home/raphael/env/bin/pysis", line 7, in <module>
    sys.exit(run())
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/run.py", line 2047, in run
    run_result = run_from_dict(run_dict, **run_kwargs)
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/run.py", line 1985, in run_from_dict
    run_result = main(run_dict, restart, cwd, scheduler)
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/run.py", line 1484, in main
    opt_result = run_opt(
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/drivers/opt.py", line 177, in run_opt
    opt.run()
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/optimizers/Optimizer.py", line 1260, in run
    next(self.run_generator)
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/optimizers/Optimizer.py", line 1168, in get_run_generator
    reparametrized = self.geometry.reparametrize(
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/cos/GrowingString.py", line 472, in reparametrize
    self.reparam_dlc(
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/cos/GrowingString.py", line 341, in reparam_dlc
    self.set_coords(reparam_image, reparam_coords)
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/cos/GrowingString.py", line 158, in set_coords
    image.coords = coords
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/Geometry.py", line 602, in coords
    self.set_coords(coords)
  File "/home/raphael/env/lib/python3.10/site-packages/pysisyphus/Geometry.py", line 521, in set_coords
    np.testing.assert_allclose(self.coords3d, self.internal.coords3d)
  File "/home/raphael/env/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 1715, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/home/raphael/env/lib/python3.10/site-packages/numpy/testing/_private/utils.py", line 921, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

Mismatched elements: 618 / 942 (65.6%)
Max absolute difference among violations: 0.10516438
Max relative difference among violations: 0.12901405
 ACTUAL: array([[  4.599424,  22.799393,   4.660049],
       [  8.144009,  26.95792 ,  18.875058],
       [ 10.037771,  25.803907,  19.728792],...
 DESIRED: array([[  4.599424,  22.799393,   4.660049],
       [  8.144009,  26.95792 ,  18.875058],
       [ 10.037771,  25.803907,  19.728792],...

While debugging just before the assertion of line 521 in Geometry.py, I can see that all the mismatches are associated with frozen atoms:

(Pdb) p np.allclose(self.coords3d, self.internal.coords3d)
False
(Pdb) p np.where(np.linalg.norm(self.coords3d - self.internal.coords3d, axis=1) != 0.)
(array([  7,   8,   9,  19,  20,  21,  48,  49,  50,  51,  78,  79,  80,
        81,  82,  83,  88,  89,  95, 102, 103, 104, 105, 106, 107, 109,
       110, 112, 113, 114, 115, 116, 120, 122, 124, 127, 128, 129, 133,
       134, 135, 136, 137, 138, 140, 142, 143, 144, 145, 146, 147, 148,
       149, 150, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
       163, 164, 166, 167, 168, 169, 172, 173, 174, 175, 176, 177, 178,
       179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192,
       193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
       206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
       219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
       232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
       245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
       258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
       271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
       284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296,
       297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307]),)

Expected behavior
I would expect the calculation to not throw any exception and just complete successfully, like for other systems.

To Reproduce
Inputs and full log can be found here: crash.zip

OS and Python:

  • OS: NixOS
  • Python version: 3.10.16

Pysisyphus version
This run is with the current dev branch (commit d950a4f), but the same occurs on the master branch.

Apologies for the large structure! I tried reproducing the error with a small structure, but the calculation worked as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions