Skip to content

Improving parameterized inferrence#1162

Merged
swails merged 5 commits into
ParmEd:masterfrom
anabiman:patch1
Apr 12, 2021
Merged

Improving parameterized inferrence#1162
swails merged 5 commits into
ParmEd:masterfrom
anabiman:patch1

Conversation

@anabiman

Copy link
Copy Markdown
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.

Comment thread parmed/structure.py Outdated
# 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
Copy Markdown
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
Copy Markdown
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>

@anabiman anabiman left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bump

@anabiman

anabiman commented Apr 7, 2021

Copy link
Copy Markdown
Contributor Author

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>')

@swails swails left a comment

Copy link
Copy Markdown
Contributor

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