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

Error: Lattice matrix undefined. #173

Closed
henrik-schopmans opened this issue Nov 24, 2021 · 5 comments
Closed

Error: Lattice matrix undefined. #173

henrik-schopmans opened this issue Nov 24, 2021 · 5 comments

Comments

@henrik-schopmans
Copy link

I am using PyXtal to generate atomic crystals of various space groups, and for most cases it works perfectly. However, for roughly 1 in 1000 crystals that I generate, I get the warning "Error: Lattice matrix undefined.". I was so far not able to find out why this happens.

Should I be worried about this? Or is this somehow handled internally? I was thinking about just skipping the structure if this error occurs and retry.

@qzhu2017
Copy link
Owner

Can you show me the exact script and output message?

@henrik-schopmans
Copy link
Author

Here is an example (it doesn't always happen, so I just repeat the random generation 100 times):

from pyxtal import pyxtal

my_crystal = pyxtal()

for i in range(0, 100):
    my_crystal.from_random(
        dim=3, group=14, species=["He"], numIons=[4],
    )

This is the warning:

UserWarning: Error: Could not generate lattice matrix.

UserWarning: Error: Lattice matrix undefined.
  warn(text)

qzhu2017 added a commit that referenced this issue Nov 25, 2021
@qzhu2017
Copy link
Owner

@Reignbeaux
I just made some fix. Can you update the code and run the following with more examples for your application?

from pyxtal import pyxtal

for i in range(0, 100):
    my_crystal = pyxtal()
    my_crystal.from_random(3, 14, ["He"], [4])
    print(i, my_crystal.valid)

Ideally, you should use the structure only when my_crystal.valid=True

Let me know how it works.

@henrik-schopmans
Copy link
Author

henrik-schopmans commented Nov 26, 2021

With your code, I now get the exception
unsupported operand type(s) for *: 'float' and 'NoneType'
whenever the mentioned warnings occur. my_crystal.valid is false. And again, this error only happens sometimes.

edit: Sorry, I was using the wrong environment with the old code... With your changes, it now works perfectly. Thank you very much!

@qzhu2017
Copy link
Owner

Great, I am closing this issue now...

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

No branches or pull requests

2 participants