madscatt / zazzie

development branch
GNU General Public License v3.0
2 stars 3 forks source link

Convert MMC to Python 3 #186

Open madscatt opened 3 weeks ago

madscatt commented 3 weeks ago

Extensions have been converted to C (from Fortran), and the code has been run through 2to3. Currently, two problems:

monomer_monte_carlo_filter rejects PDB check on min3.pdb; currently the check is skipped.

Which leads to the following error:

  File "/home/curtisj/anaconda3/lib/python3.9/site-packages/sassie/util/module_utilities.py", line 59, in general_setup
    module_variables = other_self.module_variables
AttributeError: 'monomer_monte_carlo' object has no attribute 'module_variables'

So perhaps the "partial conversion" to the module API is incomplete?

madscatt commented 3 weeks ago

input_filter was not working in python3 (check_binary). This has been fixed.

madscatt commented 3 weeks ago

Cleared out a series of incorrectly defined mvars and avars objects. The current bug is in overlap.overlap:

  File "/home/curtisj/anaconda3/lib/python3.9/site-packages/sassie/simulate/monomer_monte_carlo/dihedral_rotate.py", line 408, in rotate
    check = overlap.overlap(basis_coor[0], float(cut))
TypeError: array must contain floats

I will create an issue to create a test for the converted overlap.c code (see issue #187)

madscatt commented 3 weeks ago

Program runs from start to finish, but all moves are rejected based on overlap constraints. Look at python2.7 version and the module test to debug.

madscatt commented 3 weeks ago

Okay, get_coor_using_mask needs to return an explicit numpy.float32 for overlap to work correctly. numpy.array(basis_coor[0], numpy.float32). This is a zazmol function. See issue: https://github.com/madscatt/zazmol/issues/84#issue-2336370014

madscatt commented 3 weeks ago

align in zazmol is no longer the same:

            m1.align(frame, coor_sub_m2, com_sub_m2, coor_sub_m1, com_sub_m1)

is changed to

            molecule_2.align(molecule_1, basis_1, basis_2)

which, now in hindsight, is sub-optimal as in MMC you calculate the sub molecules during initialization, while the new align requires only the basis. Thus the new method re-calculates the basis mask for each call, which is not efficient. Need a secondary align method in zazmol for this. See: https://github.com/madscatt/zazmol/issues/83#issue-2336353521