CederGroupHub / chgnet

Pretrained universal neural network potential for charge-informed atomistic modeling https://chgnet.lbl.gov
https://doi.org/10.1038/s42256-023-00716-3
Other
215 stars 55 forks source link

Add `assign_magmoms=True` keyword to `StructOptimizer.relax()` #124

Closed janosh closed 4 months ago

janosh commented 4 months ago

f347536 update pre-commit and site/package.json deps 9c0b453 swap metrics table of full WBM test set for one restricted to unique+novel WBM prototypes 7409cf8 add assign_magmoms=True keyword to StructOptimizer.relax() 1d59310 cover assign_magmoms: True | False in test_relaxation()

Reason

magmoms and phonopy don't go great together. Makes using chgnet with phonopy more difficult. phonopy just bails when trying to determine symmetry on structures with magmoms (even though afaik spglib, which phonopy uses, handles magmoms just fine). symmetry is needed to generate efficient structure deformations.

2024-02-18 17:32:08,008 INFO generate_phonon_displacements failed with exception:
Traceback (most recent call last):
  File "jobflow/managers/local.py", line 114, in _run_job
    response = job.run(store=store)
               ^^^^^^^^^^^^^^^^^^^^
  File "jobflow/core/job.py", line 583, in run
    response = function(*self.function_args, **self.function_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "atomate2/src/atomate2/common/jobs/phonons.py", line 162, in generate_phonon_displacements
    phonon = Phonopy(
             ^^^^^^^^
  File "phonopy/api_phonopy.py", line 171, in __init__
    self._primitive_matrix = self._set_primitive_matrix(primitive_matrix)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "phonopy/api_phonopy.py", line 3794, in _set_primitive_matrix
    return guess_primitive_matrix(self._unitcell, symprec=self._symprec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "phonopy/structure/cells.py", line 1693, in guess_primitive_matrix
    raise RuntimeError(msg)
RuntimeError: Can not be used with the unit cell having magnetic moments.