Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rockspore opened this issue Jun 12, 2017 · 3 comments
Open
Labels

Comments

@rockspore
Copy link

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

@tsdev
Copy link
Owner

tsdev commented Jun 13, 2017

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

@tsdev tsdev added the bug label Jun 13, 2017
@tsdev tsdev changed the title new gencoupling.m sometimes generates negative hMax2 and causes errors. spinw.gencoupling() generates negative hMax2 which causes an error Jun 13, 2017
@rockspore
Copy link
Author

rockspore commented Jun 13, 2017

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.

@tsdev
Copy link
Owner

tsdev commented Aug 3, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants