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

Implement Spinner optimizer with docs and tests. #356

Merged
merged 16 commits into from
Jul 6, 2021

Conversation

andrewtarzia
Copy link
Collaborator

Requested Reviewers: @lukasturcani
Note for Reviewers: If you accept the review request add a 👍 to this post

Simply add another optimizer called Spinner, which is made to optimize/generate conformers of host-guest pairs. This is most crucial for systems with multiple guests that may have overlapping structures.

I followed the same approach as the mchammer optimizers (effectively the same interface and code).

Adds a new dependency. It is small, but worth making the decision about its inclusion.

minimum working example (tests also included) - compare the two output structures.:

import stk

host = stk.ConstructedMolecule(
    topology_graph=stk.cage.FourPlusSix(
        building_blocks=(
            stk.BuildingBlock('BrCCBr', [stk.BromoFactory()]),
            stk.BuildingBlock(
                smiles='BrCC(Br)CBr',
                functional_groups=[stk.BromoFactory()],
            ),
        ),
    ),
)
host = stk.BuildingBlock.init_from_molecule(host)
guest1_bb = stk.BuildingBlock('c1ccccc1')
guest1 = stk.host_guest.Guest(
    building_block=guest1_bb,
    start_vector=guest1_bb.get_direction(),
    end_vector=(1., 0., 0.),
    displacement=(0, 0, 0),
)
guest2_bb = stk.BuildingBlock('C1CCCC1')
guest2 = stk.host_guest.Guest(
    building_block=guest2_bb,
    start_vector=guest2_bb.get_direction(),
    end_vector=(0., 1., 0.),
    displacement=(0, 0, 0),
)

complex.write('complex_2.mol')
complex = stk.ConstructedMolecule(
    topology_graph=stk.host_guest.Complex(
        host=host,
        guests=(guest1, guest2),
    ),
)
complex.write('complex_3.mol')

complex = stk.ConstructedMolecule(
    topology_graph=stk.host_guest.Complex(
        host=host,
        guests=(guest1, guest2),
        optimizer=stk.Spinner(),
    ),
)
complex.write('complex_3_opt.mol')

@lukasturcani lukasturcani self-requested a review June 30, 2021 17:40
@lgtm-com
Copy link

lgtm-com bot commented Jun 30, 2021

This pull request introduces 1 alert when merging 34e9ce4 into ca4d260 - view on LGTM.com

new alerts:

  • 1 for 'import *' may pollute namespace

@lgtm-com
Copy link

lgtm-com bot commented Jun 30, 2021

This pull request introduces 1 alert when merging bfdef8a into 0071184 - view on LGTM.com

new alerts:

  • 1 for 'import *' may pollute namespace

Copy link
Owner

@lukasturcani lukasturcani left a comment

Choose a reason for hiding this comment

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

This is amazing work, thank you so much @andrewtarzia. Just some very minor nits.

@lukasturcani
Copy link
Owner

There are two warnings in the docs compilation, which I think were introduced by #352. Do you mind fixing them in this PR?

@andrewtarzia
Copy link
Collaborator Author

There are two warnings in the docs compilation, which I think were introduced by #352. Do you mind fixing them in this PR?

Could you send the info? - very happy to make the changes.

@lukasturcani
Copy link
Owner

lukasturcani commented Jul 5, 2021

At the bottom of the github page you will have a "All checks have passed" row, which has a "Show all checks button". If you click on that and scroll through the different checks, there should be one for readthedocs. If you click on it, it will take you to the docs. If you lick the "v:356" in the bottom left corner and then on "builds". You can go through the builds until you find "356". there you will see the different steps. click on the last one and scroll of the way down. You will see a warning (there's only one tbh, not two, I think you must have fixed the previous ones already). You have to scroll up a bit to find the actual warning.

The warning itself is because you didn't run remake-modules. WHich is fine cos thats autodamted now.

So you dont actually have to do anything. But I figured I would post this for future reference.

@andrewtarzia
Copy link
Collaborator Author

Ahhh amazing- I always forget about that. Will do other changes Wed.

@lgtm-com
Copy link

lgtm-com bot commented Jul 5, 2021

This pull request introduces 1 alert when merging 2c5bb7b into f1ebeda - view on LGTM.com

new alerts:

  • 1 for 'import *' may pollute namespace

@lukasturcani
Copy link
Owner

@andrewtarzia actually you probably should run remake-modules, becaues without it you cannot see the compiled docs for Spinner, so its hard to make sure everything is OK.

@lgtm-com
Copy link

lgtm-com bot commented Jul 6, 2021

This pull request introduces 1 alert when merging a1ea33d into f1ebeda - view on LGTM.com

new alerts:

  • 1 for 'import *' may pollute namespace

@lukasturcani lukasturcani merged commit 953060f into lukasturcani:master Jul 6, 2021
@andrewtarzia andrewtarzia deleted the spinner_optimizer branch July 6, 2021 12:31
@lgtm-com
Copy link

lgtm-com bot commented Jul 6, 2021

This pull request introduces 1 alert when merging 3c155bd into 45170de - view on LGTM.com

new alerts:

  • 1 for 'import *' may pollute namespace

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