mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
211 stars 124 forks source link

Abins Not Identifying Deuterium Species #38352

Open cailafinn opened 3 weeks ago

cailafinn commented 3 weeks ago

Original reporter: Pablo Gila-Herranz (Via Error Reporter)

Describe the bug Seems like the AbINS program does not properly identify deuterium species for CASTEP phonon calculations, identified whether with the 'D' nor the 'H2' flag.

phonon_Efield.phonon.zipo

To Reproduce

For example

  1. Load in the file using the Abins algorithm.

Expected behavior Loading should identify the Deuterium symbol.

Platform/Version (please complete the following information):

Additional context

Error in execution of algorithm Abins:
Invalid value of symbol: D.
  at line 100 in '/Applications/MantidWorkbench.app/Contents/Resources/plugins/python/algorithms/Abins.py'
  caused by line 52 in '/Applications/MantidWorkbench.app/Contents/Resources/scripts/abins/abinsdata.py'
  caused by line 195 in '/Applications/MantidWorkbench.app/Contents/Resources/scripts/abins/input/abinitioloader.py'
  caused by line 39 in '/Applications/MantidWorkbench.app/Contents/Resources/scripts/abins/input/casteploader.py'
  caused by line 165 in '/Applications/MantidWorkbench.app/Contents/Resources/scripts/abins/input/abinitioloader.py'
  caused by line 73 in '/Applications/MantidWorkbench.app/Contents/Resources/scripts/abins/atomsdata.py'
  caused by line 73 in '/Applications/MantidWorkbench.app/Contents/Resources/scripts/abins/atomsdata.py'
  caused by line 111 in '/Applications/MantidWorkbench.app/Contents/Resources/scripts/abins/atomsdata.py'
ajjackson commented 3 weeks ago

I can reproduce the behaviour; at the moment arbitrary species labels are not supported as we need to somehow infer the z-number without looking at the pseudopotential file.

The supported syntax for this is element:tag. Although CASTEP will allow any 3-character species name (as long as the mass and pseudopotential are provided), this "tag" syntax is used in a few places to help CASTEP infer what element is being used:

e.g.

%BLOCK LATTICE_CART
 6.000000  0.000000  0.000000
 0.000000  7.526478  0.000000
 0.000000  0.000000  6.596309
%ENDBLOCK LATTICE_CART

%BLOCK POSITIONS_ABS
O  3.000000  3.763239  3.596309
H  3.000000  4.526478  3.000000
H:D  3.000000  3.000000  3.000000
%ENDBLOCK POSITIONS_ABS

%BLOCK SPECIES_MASS
H:D 2.0
%ENDBLOCK SPECIES_MASS

is a valid .cell file and CASTEP won't complain about the missing SPECIES_POT. (It still doesn't ascribe any special significance to "D" so we have to specify a mass.)

I suggest that for now our user changes "D" or "H2" to "H:D" or "H:2".

We could implement a special case for "D" as it is quite common. But given that CASTEP itself does not, perhaps it is more helpful to address the general case in the documentation.