ncrystal
ncrystal copied to clipboard
Labels and elements in NCMATComposer objects from CIF
As we discussed, when you create an NCMATComposer object from a CIF file, it can be a bit confusing that the labels are not elements even for simple cases:
> c_Bi = NC.NCMATComposer('codid::9008576')
> printc_Bi()
[...]
@CELL
lengths 4.54634 !! 11.8619
angles 90 90 120
@SPACEGROUP
166
@ATOMPOSITIONS
Bi 0 0 .237
Bi 0 0 .763
Bi 1/3 2/3 .42966666666666667
Bi 1/3 2/3 .90366666666666667
Bi 2/3 1/3 .09633333333333333
Bi 2/3 1/3 .57033333333333333
@DYNINFO
# WARNING: Using fallback Debye temperature value!
element Bi
fraction 1
type vdosdebye
debye_temp 300
> c_Bi.set_dyninfo_debyetemp('Bi', debye_temp=100)
> print(c_Bi())
[...]
NCBadInput: Some atoms with dynamic information are missing atomic positions: "Bi"
> c_Bi.get_labels()
{'Bi', 'cif_species_0'}
And instead:
> c_Bi = NC.NCMATComposer('codid::9008576')
> c_Bi.set_dyninfo_debyetemp(c_Bi.find_label('Bi'), debye_temp=100)
> print(c_Bi())
[...]
@CELL
lengths 4.54634 !! 11.8619
angles 90 90 120
@SPACEGROUP
166
@ATOMPOSITIONS
Bi 0 0 .237
Bi 0 0 .763
Bi 1/3 2/3 .42966666666666667
Bi 1/3 2/3 .90366666666666667
Bi 2/3 1/3 .09633333333333333
Bi 2/3 1/3 .57033333333333333
@DYNINFO
element Bi
fraction 1
type vdosdebye
debye_temp 100
Right, thanks. I will (probably after 3.6.0 is out) try to see if I can improve the error diagnostics, to produce a more helpful message in this case.
It might also be good with a way to rename labels on NCMATComposer objects, inspect the composition of labels, etc.