Closed FlemkMeserath closed 1 year ago
The warning is normal, it occurs because it convert the dynamical matrix at Gamma (which is defined as a real number) from the results it gets from the quantum-espresso FORTRAN symmetry subroutine (which works with complex values).
Does the minimization crash with some other error? Is it the last version of the code?
I forgot to mention that as soon as the minimization is interrupted I get the following error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[3], line 27
17 #io_func = sscha.Utilities.IOInfo()
18 #io_func.SetupSaving("frequencies.dat", save_each_step=True) # The file that will contain the frequencies is frequencies.dat
19
(...)
24 # sys.stdout = f # Change the standard output to the file we created.
25 # Lest start the minimization
26 minimizer.init()
---> 27 minimizer.run()
28 minimizer.finalize()
29 # sys.stdout = original_stdout # Reset the standard output to its original value
File ~/.conda/envs/SSCHA/lib/python3.9/site-packages/sscha/SchaMinimizer.py:1163, in SSCHA_Minimizer.run(self, verbose, custom_function_pre, custom_function_post, custom_function_gradient)
1161 # Perform the minimization step
1162 t1 = time.time()
-> 1163 self.minimization_step(custom_function_gradient)
1164 t2 = time.time()
1165 if verbose >=1:
File ~/.conda/envs/SSCHA/lib/python3.9/site-packages/sscha/SchaMinimizer.py:383, in SSCHA_Minimizer.minimization_step(self, custom_function_gradient)
381 CC.symmetries.CustomASR(dyn_grad[0,:,:])
382 else:
--> 383 qe_sym.SymmetrizeFCQ(dyn_grad, np.array(self.dyn.q_stars), asr = "custom")
384 #qe_sym.SymmetrizeFCQ(err, np.array(self.dyn.q_stars), asr = "custom")
385
386 # Just divide the error by the square root the number of symmetries
387 err /= np.sqrt(qe_sym.QE_nsym * np.prod(self.ensemble.supercell))
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
I have downloaded the version I'm using from the following two links: github.com/SSCHAcode/CellConstructor](https://github.com/SSCHAcode/CellConstructor github.com/SSCHAcode/python-sscha](https://github.com/SSCHAcode/python-sscha
However I have noticed that if instead try to install the sscha through pip I get a different version. So I am not entirely sure of which version I am using.
I have checked the versions and I am using the CellConstructor 1.2.2 and the SSCHA 1.2.1.
Sorry for the flurry of messages.
It looks like you are trying to fill a sequence of numbers into a single number slot in q_stars. Maybe your dimensions are wrong defined? (check if the array you have have different length or sequences). I will known more if I see your code for the minimization. You say you use the example for PbTe. Check if you are using a list instead of an array somewhere.
I think this error has been fixed in one of the latest branch (like #111 ). However, the branch cannot yet be deployed due to other bugs in the parallelized version of the gradient calculation. Maybe I can cherry-pick the commit with the fix. This needs to be fixed as soon as possible so I'm now pinning the issue.
This is the commit with the fix: https://github.com/SSCHAcode/python-sscha/pull/118/commits/579ab81630ab4ab79812dcd0c90cba89069b7716
It cannot be cherry picked as it uses inside the commit the new timing syntax of the #111 branch. I have the feeling that this error is caused by an update of numpy, anyway, it is a bug of the code and it needs to be fixed as soon as possible.
Lorenzo, in 'ShaMinimizer.py' of main there is this discrepancy in the code: line 383 --> qe_sym.SymmetrizeFCQ(dyn_grad, np.array(self.dyn.q_stars), asr = "custom") line 982 --> qe_sym.SymmetrizeFCQ(fcq, self.dyn.q_stars, asr = "custom")
Yes, the correct one is WITHOUT the np.array (as you can see from the commit
I committed the fix, let us wait for the testsuite to see if it works
Ok, the testsuite passed https://github.com/SSCHAcode/python-sscha/actions/runs/4251737035 Therefore the bug has been fixed. @FlemkMeserath You can install the latest version in the master branch and it should fix the problem
Dear developers,
I was running the SSCHA with python3.9 for one of my systems following the example for PbTe. Whenever executing the command
minimizer.run()
i get the following warning at the first step of the minimization:After this warning the minimization ends. I have noticed that if I change the flag
minimizer.neglect_symmetries
to True, the warning disappears and everything continues as normal. But then the minimization is performed without symmetries.Is there a way to fix this?