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

Improving parameterized inferrence #1162

Merged
merged 5 commits into from
Apr 12, 2021
Merged

Improving parameterized inferrence #1162

merged 5 commits into from
Apr 12, 2021

Conversation

anabiman
Copy link
Contributor

In parmed.structure.Structure._ repr _, parameterization is inferred from bonds/bond types. However, for a system of non-bonded parameterized atoms, Structure appears unparameterized. An improvement is suggested here based on atom types.

# everything else... we don't want __repr__ to be super expensive
if len(self.bonds) > 0 and self.bonds[0].type is not None:
retstr.append('; parametrized>')
if self.atoms[0].type:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if self.atoms[0].type:
if self.atoms[0].atom_type is not UnassignedAtomType and self.atoms[0]._epsilon is None:

This is probably a better heuristic to use. It's possible to provide parameters without defining an explicit type string, but you really can't provide parameters and have the atoms have an UnassignedAtomType and the nonbonded L-J terms be not set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even better, but shouldn't the condition be the following?

if self.atoms[0].atom_type is not UnassignedAtomType and self.atoms[0]._epsilon is not None: 

Co-authored-by: Jason Swails <jason@entos.ai>
Copy link
Contributor Author

@anabiman anabiman left a comment

Choose a reason for hiding this comment

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

Bump

@anabiman
Copy link
Contributor Author

anabiman commented Apr 7, 2021

I went with the most logical criterion based on your suggestion:

if self.atoms[0].atom_type is UnassignedAtomType and self.atoms[0]._epsilon is None:
    retstr.append('; NOT parameterized>')
else:
    retstr.append('; parameterized>')

Copy link
Contributor

@swails swails left a comment

Choose a reason for hiding this comment

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

Thanks!

@swails swails merged commit 5f75d10 into ParmEd:master Apr 12, 2021
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