SSCHAcode / python-sscha

The python implementation of the Stochastic Self-Consistent Harmonic Approximation (SSCHA).
GNU General Public License v3.0
55 stars 21 forks source link

AiiDAEnsemble: add missing `self.init()` #335

Closed bastonero closed 3 months ago

bastonero commented 3 months ago

Fixes #334

The version update v1.4.1 missed to add the new init function to the compute_ensemble method of the auxiliary class AiiDAEnsemble. The simple fix makes the calculation using this class comparable to the traditional Ensemble class.

mesonepigreco commented 3 months ago

@diegomartinez2 The new version has a different def init(self) that initializes the variables for the calculation of the Gradient in fourier space. This initialization perform the fourier transform of the displacements and the forces. In this case, it is necessary to have already generated both the displacements and computed the forces before doing the initialization of the fourier calculation. This is the reason why it is required to run self.init() (which is not the init used to create the ensemble) after the forces and displacements of the ensemble have been computed.

We have this in Ensemble.compute_ensemble

if timer:
      timer.execute_timed_function(self.init)
else:
      self.init()

Since the AiiDA Ensemble is overwriting the compute_ensemble, by missing the self.init there prevents the correct initialization of the fourier gradient calculation (and consequently the wrong minimization).

mesonepigreco commented 3 months ago

We could use this patch for 1.4.2 since a long time is probably required for 1.5, and we have tons of small fixes to tdscha and cell constructor that have occurred since the last release.