THUNLP-MT / dyMEAN

This repo contains the codes for our paper "End-to-End Full-Atom Antibody Design"
https://arxiv.org/abs/2302.00203
MIT License
89 stars 8 forks source link

Unit in the openmm_relax function #21

Closed TangYiChing closed 2 months ago

TangYiChing commented 4 months ago

Hi,

It seems that the openmm's Simulation.minimizeEnergy() method has a default unit set to kilojoule/model, while kilocalories_per_mole was used at the beginning of the openmm_relax function in the script relax. py. What would you suggest to make sure the units are consistent?

minimizeEnergy(tolerance=Quantity(value=10.000000000000004, unit=kilojoule/mole), maxIterations=0)

ref: (http://docs.openmm.org/7.3.0/api-python/generated/simtk.openmm.app.simulation.Simulation.html)

kxz18 commented 4 months ago

Looks like you are right. The codes for relaxation are originally copied from here, where the value of the tolerance is manually multiplied with the unit kcal/mol. About 4 months ago, the codes would throw an error maybe due to some updates of openmm, and thus I dropped the unit (here). I just tried again, and it now looks ok to recover the unit specification.

Further, I found that the codes I referenced above is actually a simplified version adapted from AlphaFold 2 amber relax, so maybe it will be helpful to take a look at the AF2 codes if you are still not sure about some configurations during the relaxation.

TangYiChing commented 2 months ago

Just in case someone has the same issue, I modified the script to fix the issue:

from openmm import unit
def openmm_relax(pdb, out_pdb=None, excluded_chains=None, inverse_exclude=False):

    tolerance = 2.39 * unit.kilojoules_per_mole/unit.nanometer
    stiffness = 10.0 * unit.kilojoules_per_mole/unit.nanometer / (angstroms ** 2)
    #tolerance = 2.39 * kilocalories_per_mole
    #stiffness = 10.0 * kilocalories_per_mole / (angstroms ** 2)