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

Stereoisomerism #331

Open
AlexW12344 opened this issue Oct 31, 2023 · 4 comments
Open

Stereoisomerism #331

AlexW12344 opened this issue Oct 31, 2023 · 4 comments

Comments

@AlexW12344
Copy link

Hey Mat,

Was there any solutions to do TIES transforms between stereoisomers? With the default setting it seems like the stero parts of the molecule are not seen as different and never included in the alchemical region?

Was the only way to get round this to use knowledge of the dihedrals to distinguish them (#283) or could RMSD be used as well?

Cheers,
Alex

@bieniekmateusz
Copy link
Contributor

bieniekmateusz commented Nov 1, 2023

Hey. There are weights now which can help prioritise a good RMSD. It should work. I haven't added dihedrals yet. Do you need it urgently? I think I have more example file inputs somewhere.

ps. I'll dig out an example with the RMSD, but I have to run now.

@adw62
Copy link
Collaborator

adw62 commented Nov 1, 2023

Thanks, I would be interested to see the RMSD example when you have time :) I guess the way it works is that the stero parts are forced into the alchemical region if you make the RMSD constraint very tight? I will try this on my end as well and let you know if it works for me.

@bieniekmateusz
Copy link
Contributor

Sure. Thanks, feedback on this would be really handy. So now there is two weights in the Config file, but I didn't connect them to the method at the back. This is a simple tuple (mcs_score_weight, rmsd_weight). See here. The overal score is:

mcs_score = (len(self.matched_pairs) * 2)   /   (len(self.top1) + len(self.top2))

Which is twice the number of matched pairs, over the cumulative number of atoms in topology 1 and 2. So it can only be equal to 1 if the topologies are equal.

The RMSD only currently is calculated only for the matched pairs.

So it uses the hard-coded cofactor of scoring. Can you modify the def extract_best_suptop(suptops, ignore_coords, weights=[1, 1], get_list=False) in topology_superimposer.py to see if it can get you to your destination? Ie weights=[1,2] to increase the importance of the RMSD.

I'll test this on #283 tomorrow when I get a minute and then update you here. Cheers

@AlexW12344
Copy link
Author

AlexW12344 commented Nov 2, 2023

Had a go with the most recent code and RMSD weights. For the main code with weights [1,1] I get large alchemical regions say 90% appearing and disappearing where as before the RMSD stuff 7faa5d9 I get 10-20%.

If I use weights [1,0] I dont recover the old result and now have alchemical regions of around 40%. These regions partially include the stero atoms (previously they were completely ignored) but the bonds of the stero region are messed up. Sorry I cant share the specific examples.

I got the best results using the older code and this option

TIES/ties/config.py

Lines 578 to 593 in 4987266

def manually_mismatched_pairs(self, value):
mismatch = []
# only allow the file for now
if value is not None:
path = pathlib.Path(value)
if not path.is_file():
print(f'Exception: the provided file for mismatching pairs cannot be found: {value}')
raise Exception('Could not find the file. ')
with open(path) as IN:
for left_atom, right_atom in csv.reader(IN, delimiter='-'):
mismatch.append((left_atom.strip(), right_atom.strip()))
self._manually_mismatched_pairs = mismatch
return self._manually_mismatched_pairs
to unmatch the stereo atoms.

With an automatic way to pass ties the names of stero atoms this might work more generally.

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

No branches or pull requests

3 participants