jvermaas / vmd-tprreader

Molfileplugin for VMD that lets me read in GROMACS tpr files
7 stars 2 forks source link

Wrong box size from tpr #2

Open liuyujie714 opened 3 years ago

liuyujie714 commented 3 years ago

Question one: For non-orthogonal system, vmd read wrong box size. I attached a sample test, which from https://github.com/RashmiKumari/g_mmpbsa/tree/master/test/data

1EBZ.zip

I changed below code : https://github.com/jvermaas/vmd-tprreader/blob/98d3065b8b61b54562be539fac8495ce4641e060/tprplugin.C#L669 to:

        ts->A = sqrt(tpr->boxdims[0]*tpr->boxdims[0] + tpr->boxdims[1]*tpr->boxdims[1] + tpr->boxdims[2] * tpr->boxdims[2]) * 10;
        ts->B = sqrt(tpr->boxdims[3]*tpr->boxdims[3] + tpr->boxdims[4]*tpr->boxdims[4] + tpr->boxdims[5] * tpr->boxdims[5]) * 10;
        ts->C = sqrt(tpr->boxdims[6]*tpr->boxdims[6] + tpr->boxdims[7]*tpr->boxdims[7] + tpr->boxdims[8] * tpr->boxdims[8]) * 10;

        if(ts->A <= 0 || ts->B <= 0 || ts->C <=0)
        {
            ts->A     = ts->B    = ts->C     = 0;
            ts->alpha = ts->beta = ts->gamma = 0;
        }
        else {
            ts->gamma = acos((tpr->boxdims[0]*tpr->boxdims[3] + tpr->boxdims[1]*tpr->boxdims[4] + tpr->boxdims[2]*tpr->boxdims[5])*100/(ts->A*ts->B)) * 90.0 / M_PI_2;
            ts->beta  = acos((tpr->boxdims[0]*tpr->boxdims[6] + tpr->boxdims[1]*tpr->boxdims[7] + tpr->boxdims[2]*tpr->boxdims[8])*100/(ts->A*ts->C)) * 90.0 / M_PI_2;
            ts->alpha = acos((tpr->boxdims[3]*tpr->boxdims[6] + tpr->boxdims[4]*tpr->boxdims[7] + tpr->boxdims[5]*tpr->boxdims[8])*100/(ts->B*ts->C)) * 90.0 / M_PI_2;
        }

Qusetion two: You can add some code for GROMACS2021! Because 2021 is released...

jvermaas commented 3 years ago

I've committed the box dimension changes.

In terms of GROMACS 2021 it looks like they changed the generator... AGAIN. I've attached the diff against 2020. It looks like for the most part the changes are harmless, but the tpr files now have extra data that needs to be read and skipped. It will take me a while to get this updated, so if you want to take a stab at this, you are more than welcome to. tpxio.2020.2021.log

jvermaas commented 3 years ago

Ok, GROMACS 2021 updates have been made. They weren't as bad as I thought.

liuyujie714 commented 3 years ago

Ok, GROMACS 2021 updates have been made. They weren't as bad as I thought.

Good job! Thanks