Skip to content

Add sanity check for number of primitives#176

Open
susilehtola wants to merge 2 commits intowavefunction91:masterfrom
susilehtola:shell_size_max
Open

Add sanity check for number of primitives#176
susilehtola wants to merge 2 commits intowavefunction91:masterfrom
susilehtola:shell_size_max

Conversation

@susilehtola
Copy link
Contributor

There's no check in GauXC on the maximum allowed number of primitives. I think any faulty code might error out even earlier due to overflows in the passed-in arrays, but this check will at least crash the code after the memory violation has occurred instead of producing faulty results.

Copy link
Owner

@wavefunction91 wavefunction91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Minor comment

nprim_( nprim.get() ), l_( l.get() ), pure_( pure.get() ) {

if(nprim_ > detail::shell_nprim_max)
throw std::out_of_range("Shell has too many primitives!\n");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to add the actual values (max val + actual val) here to aid users in finding the problem

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

Successfully merging this pull request may close these issues.

2 participants