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

Test that we can make a sample molecule for every atom type. #1661

Merged
merged 9 commits into from
May 17, 2023
Merged

Commits on May 16, 2023

  1. Test that we can make a sample molecule for every atom type.

    This unit test was inspired by efforts to debug something in some
    changes to the database, which caused a segfault when running
    the database Tests, but was in fact caused by an undetected bug in RMG. This should detect similar bugs.
    The idea is that for every atomType, such as 'Cds', the
    method Group().make_sample_molecule() can create a molecule
    from the group definition, eg.
      1  Cd  ux
    should make the molecule
      1 C u0 p0 c0 {2,D} {3,S} {4,S}
      2 C u0 p0 c0 {1,D} {5,S} {6,S}
      3 H u0 p0 c0 {1,S}
      4 H u0 p0 c0 {1,S}
      5 H u0 p0 c0 {2,S}
      6 H u0 p0 c0 {2,S}
    
    Many work, but quite a few fail.
    Updated to RMG3/Python3.
    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    ac65f3c View commit details
    Browse the repository at this point in the history
  2. Add undeclared charged atom type in group.make_sample_molecule()

    We have a hard-coded list of charged atom types here. It was missing one.
    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    ed2eca3 View commit details
    Browse the repository at this point in the history
  3. Replace hard-coded list of charged atomtypes with check for charge.

    The atomtypes each have a charge list - let's just see if it matches.
    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    316f840 View commit details
    Browse the repository at this point in the history
  4. Include N5bd as a benzene "carbon" when generating sample molecules.

    When you create a molecule from a functional group definition that 
    declares implicit benzene rings by using a "benzene" atom type,
    it creates benzene rings.
    
    This algorithm contains a list of "benzene" atom types.
    It's hard-coded. And missing some. This adds one, to check that 
    adding one fixes things.
    
    With this fix, the following line works:
    
    rmgpy.molecule.Group().from_adjacency_list('1 N5bd ux').make_sample_molecule()
    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    14795ec View commit details
    Browse the repository at this point in the history
  5. Group.is_benzene_explicit() checks more benzenic atom types.

    Before it had a hard-coded list (that was missing some).
    Now any atomtype that is declared as having at least one benzene bond
    is counted.
    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    1046d13 View commit details
    Browse the repository at this point in the history
  6. Added more aromatic atom types to classify_benzene_carbons()

    This helps generating sample molecules for certain atomtypes.
    Now lines like this work:
    rmgpy.molecule.Group().from_adjacency_list('1 P3b ux').make_sample_molecule()
    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    2a63daf View commit details
    Browse the repository at this point in the history
  7. Make failing atomtype tests into "work in progress"

    Fixing O4b and S4b will be nontrivial, so rather than fix them
    I'm marking them as "work in progress" (expected to fail)
    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    049e92f View commit details
    Browse the repository at this point in the history
  8. Fix typo

    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    bb09fcc View commit details
    Browse the repository at this point in the history
  9. Added a work in progress atomtype test: make sample molecule.

    Ideally we could make a molecule from every atom type definition
    that matches that atom type. 
    
    This is a work in progress test, because we can't.
    Two (marked in previous tests) crash. Some others create molecules,
    but they don't seem to match the functional group they were designed
    to match.
    rwest committed May 16, 2023
    Configuration menu
    Copy the full SHA
    15ca27e View commit details
    Browse the repository at this point in the history