spinw icon indicating copy to clipboard operation
spinw copied to clipboard

spinw.gencoupling() generates negative hMax2 which causes an error

Open rockspore opened this issue 8 years ago • 3 comments

I think hMax2 = sum(obj.basisvector,2); can be replaced with hMax2 = abs(sum(obj.basisvector,2)); to solve this problem.

rockspore avatar Jun 12 '17 15:06 rockspore

Thank you for reporting this. Can you provide an example script that shows the bug?

tsdev avatar Jun 13 '17 07:06 tsdev

Thanks for the response.

cnn = spinw;
lc = [9.551 5.43683 16.75890];
agl = [90 125.6860 90];
cnn.genlattice('lat_const',lc,'angled',agl,'sym',14);
cnn.addatom('r',[0   0   0],'S',1,'label','M');
cnn.gencoupling('maxDistance',15);

The code above will trigger the error message saying index exceeds the dimension of cMat. As I said, my understanding is for certain basis vectors, hMax2 can have negative values and so do nC and cDim. This results in empty atom1 and atom2 which eventually reduces the dimension of cMat.

rockspore avatar Jun 13 '17 13:06 rockspore

I fixed the bug in 5a4097ce7c44e85ed69913f148d575a1638ececf using your suggestions, thanks!

tsdev avatar Aug 03 '17 06:08 tsdev