rs-station / reciprocalspaceship

Tools for exploring reciprocal space
https://rs-station.github.io/reciprocalspaceship/
MIT License
28 stars 12 forks source link

Model-free alignment of isomorphous maps (alternative origins problem) #174

Closed JBGreisman closed 2 years ago

JBGreisman commented 2 years ago

This PR is still in progress, but I wanted to upload my initial classes to support this. The problem is broken down into two cases:

  1. Non-Polar spacegroups: easier case because they have a finite number of cases to evaluate
  2. Polar spacegroups: more challenging because of the continuous alternative origins.

These classes use the sum of the squared phase residual between two sets of phases as a loss function to minimize, which has been pretty effective in my hands.

The NonPolarTranslator does a brute-force search of the 64 possible cases to evaluate the optimal translation vector. The PolarTranslator does a global optimization to determine the optimal translation vector. This is a bit non-trivial -- its a bumpy loss landscape -- but I've found the scipy dual_annealing optimizer to work very well. Another trick has been to start at low-resolution and gradually increase to full resolution. After discussion with @kmdalton, we can also use a FFT-based method to come up with a sensible initial value for optimization.

My todo items:

JBGreisman commented 2 years ago

As per the comment in #31, this PR seems better suited for the rs-booster project because this is an application that uses rs, rather than a new core feature of the library. I am closing this PR here, and will add this via a PR in rs-booster.