Bispectrum descriptor issues

Issue #221 new
Muammar El Khatib created an issue

It has been reported in this thread that bispectrum descriptor is presenting the following problems:

1) For a calculator set in the following way:

calc = Amp(descriptor=Bispectrum(jmax=7, elements=['Si']), 
                   model=NeuralNetwork(hiddenlayers={'Si': (32)}, activation="linear"), 
                   label=outdir)

The traceback is:

Traceback (most recent call last):
  File "/Users/yunshengliu/miniconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 673, in <module>
    result[key] = calc.calculate(image, key)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 261, in calculate
    indexfp = self.get_fingerprint(index, symbol, neighborsymbols, Rs)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 346, in get_fingerprint
    rs, psis, thetas, phis)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 367, in calculate_B
    n_symbols, rs, psis, thetas, phis)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 409, in calculate_c
    cutoff_fxn(r)
UnboundLocalError: local variable 'cutoff_fxn' referenced before assignment

2) The descriptor is not being computed. Amp just determines neighborlists and gets stuck. When killing the script, the generated traceback is:

Traceback (most recent call last):
  File "/Users/yunshengliu/miniconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 679, in <module>
    result[key] = calc.calculate(image, key)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 261, in calculate
    indexfp = self.get_fingerprint(index, symbol, neighborsymbols, Rs)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 350, in get_fingerprint
    rs, psis, thetas, phis)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 371, in calculate_B
    n_symbols, rs, psis, thetas, phis)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 414, in calculate_c
    np.conjugate(U(j, m, mp, psi, theta, phi, factorial)) * \
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 525, in U
    WignerD(j, mpp, mp, phi, -theta, -phi, factorial)
  File "/Users/yunshengliu/miniconda3/lib/python3.6/site-packages/amp/descriptor/bispectrum.py", line 472, in WignerD
    for k in range(int(2 * j + 1)):
KeyboardInterrupt

Comments (2)

  1. Muammar El Khatib reporter

    So, I went ahead and put some print statements to see if the calculation was stuck or something was happening. It turns out that setting jmax=1 made the fingerprint calculation to finish on my workstation. jmax according to the docstring refers to the degree of spherical harmonics. That variable is used to build the attribute list self.factorial that is used by calculate_B, calculate_c and other functions. It seems that to fix 2) we have to implement fortran.

  2. Alireza Khorshidi

    What about raising and error saying that "fortran is not implemented. Set fortran=False." for the case when user tries to set "fortran=True" to fix the second issue?

    As for the first issue, it has nothing to do with fortran, right? It should be easy to figure out why cutoff_fxn is not calculated, right?

  3. Log in to comment