-
Notifications
You must be signed in to change notification settings - Fork 208
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
pyscf driver does no checking on input arguments at instantiation #28
Comments
There is a finite amount of checking that is done and also things are passed to the driver for interpretation too, like the molecule since different formats are possible XYZ, Z_matrix etc. Things like basis set are dependent on driver. Even if the format is correct it may still be semantically incorrect in which case these types of errors, incorrect basis set name etc are caught by the driver and the error reported is what it gives. It maybe possible to improve for specific cases but in general the input is passed to the drivers and it relies on whatever the driver reports to report back - trying to do syntactic and semantic checking is a huge undertaking given the driver complexity of capabilities and not something that is in any way practical. Having said there there maybe room for some minor incremental improvement but its not going to avoid seeing the sort of error you show. |
But then the end user has no idea what is actually a valid input for most of the inputs. In the case of basis, there must be a finite number of options. In the case of pyscf, a quick glace at their docs gives: 'sto3g' as as valid inputs. Again, |
Maybe something can be said around the basis sets to make it clearer we expect users to look to the driver documentation for whatever these are. The set in PySCF is much much larger than you indicate - more like this here https://sunqm.github.io/pyscf/_modules/pyscf/gto/basis.html The 'electronic structure computation` should also have the source exception from PySCF that this was re-raised from. That is as much information that is available as to why PySCF failed in the computation. As to this message
the molecule is shown in the docs as something of type Molecule - and you passed in a string. I imagine the code then looks for the geometry attribute on the molecule instance - whatever type you passed, in this case a 'str', it did not have it. |
Ok then it seems you already know where to find the basis options. Can just refer the user there in the docs. As for molecule, you would expect that the driver would error if something that was not a molecule instance was passed. |
Other attributes have refs. to more specifics in PySCF that detail the value so it seems reasonable to give one here.
It did error - the error it threw when it attempted to access a field it expected on the instance that was passed. I agree its not so easy to figure from the error perhaps but then this can often be the case with Python as its not a strongly typed language and type checking is really against the philiosphy of duck typing so its not normally done. If you look at the docs/typehints its says it should be Molecule. If you edit in an IDE, such as PyCharm, they recognise the typehints from the code and would alert you to the type mismatch when you were editing. |
Information
What is the current behavior?
for example:
does not generate an error when the object is built. The
unit
kwarg does look for an enum, but that is it. This leads to hard to read errors down the line:e.g. the above gives:
or
gives:
Steps to reproduce the problem
What is the expected behavior?
Suggested solutions
The text was updated successfully, but these errors were encountered: