deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
174 stars 136 forks source link

`ASE-ABACUS` cannot recognize the `mag angle1 angle2` in STRU file #4203

Open xdzhu opened 6 months ago

xdzhu commented 6 months ago

Describe the bug

It seems that ASE-ABACUS cannot recognize the mag angle1 angle2 case. It should be noticed that the angle1 and angle2 are set in xyz axes but NOT in abc axes.

@1041176461 Please consider adding the support of this case. (I cannot sign up the Gitlab account so I submit issue here....)

(icu) [zhuxd@mu01 angle-read]$ python read-stru.py /home/zhuxd/Software/anaconda3/envs/icu/lib/python3.10/site-packages/ase/io/abacus.py:776: UserWarning: Non-colinear angle-settings are not yet supported for this interface. warnings.warn( Traceback (most recent call last): File "/home/zhuxd/abacus/LZ/1.hse-AHC/Fe/angle-read/read-stru.py", line 3, in atoms = read('STRU', format='abacus') File "/home/zhuxd/Software/anaconda3/envs/icu/lib/python3.10/site-packages/ase/io/formats.py", line 801, in read return next(_iread(filename, slice(index, None), format, io, File "/home/zhuxd/Software/anaconda3/envs/icu/lib/python3.10/site-packages/ase/parallel.py", line 285, in new_generator for result in generator(*args, kwargs): File "/home/zhuxd/Software/anaconda3/envs/icu/lib/python3.10/site-packages/ase/io/formats.py", line 868, in _iread for dct in io.read(fd, args, kwargs): File "/home/zhuxd/Software/anaconda3/envs/icu/lib/python3.10/site-packages/ase/io/formats.py", line 622, in wrap_read_function yield read(filename, kwargs) File "/home/zhuxd/Software/anaconda3/envs/icu/lib/python3.10/site-packages/ase/utils/init.py", line 487, in iofunc obj = func(fd, args, kwargs) File "/home/zhuxd/Software/anaconda3/envs/icu/lib/python3.10/site-packages/ase/io/abacus.py", line 782, in read_abacus m_index + 1:m_index + 4].astype(float) ValueError: could not convert string to float: 'angle1'

Expected behavior

No response

To Reproduce

  1. write a STRU file like:

    ATOMIC_SPECIES Fe 55.845 Fe.upf

    LATTICE_CONSTANT 1.889726125457828

    LATTICE_VECTORS 1.4349959999999999 1.4349959999999999 1.4349959999999999 -1.4349959999999999 1.4349959999999999 1.4349959999999999 -1.4349959999999999 -1.4349959999999999 1.4349959999999999

    ATOMIC_POSITIONS Direct

    Fe 0.000 1 0.000000000000 0.000000000000 0.000000000000 1 1 1 mag 2.31 angle1 90 angle2 0

  2. run python:

    from ase.io import read, write

    atoms = read('STRU', format='abacus') print(atoms)

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

1041176461 commented 6 months ago

@hongriTianqi Can you help fix this? I don’t know how to convert ABACUS settings to ASE magnetic moment settings.