Colvars / colvars

Collective variables library for molecular simulation and analysis programs
http://colvars.github.io/
GNU Lesser General Public License v3.0
195 stars 56 forks source link

Distance value incorrect #115

Closed tonigi closed 7 years ago

tonigi commented 7 years ago

Dears, I get a surprising value of distance CVs on the first frame (only) of at least one structure. I'm using VMD 1.9.3 Linux which includes version 2016-10-26 (apologies if it is fixed already). To reproduce...

mol pdbload 1KDX

set fr 0   ;# all other frames are ok

cv delete
cv molid top

set s {
    colvar {
        name d
        distance { 
        group1 { atomNumbers 1 }
        group2 { atomNumbers  200 }
        }
    }
}
# Cartesian is OK. DistanceZ is not.

cv config $s
cv frame $fr
cv update
cv printframe

measure bond {0 199} frame $fr  ;# Reference value

For fr=0 this yields...

0    5.36673904150653e-01    [the value computed by colvar]
22.444866180419922           [the reference one computed by VMD]

and correct results for other frames and structures. Thanks

giacomofiorin commented 7 years ago

This is a PBC issue: see the following lines in the 1KDX file:

REMARK 215 THE COORDINATES IN THIS ENTRY WERE GENERATED FROM SOLUTION           
REMARK 215 NMR DATA.  PROTEIN DATA BANK CONVENTIONS REQUIRE THAT                
REMARK 215 CRYST1 AND SCALE RECORDS BE INCLUDED, BUT THE VALUES ON              
REMARK 215 THESE RECORDS ARE MEANINGLESS.       
...  
CRYST1    1.000    1.000    1.000  90.00  90.00  90.00 P 1           1     

which means that the correct way to compute distances is to ignore such ill-defined PBCs.

However, by default Colvars uses the PBCs to preserve compatibility with MD simulations. You should tell Colvars to compute the variable without PBCs.

If you use the configuration:

set s {
    colvar {
        name d
        distance { 
                forceNoPBC yes
        group1 { atomNumbers 1 }
        group2 { atomNumbers  200 }
        }
    }
}

the values will match.

tonigi commented 7 years ago

Thanks. What's different in the configuration?

giacomofiorin commented 7 years ago

Sorry, I forgot the important line when copying/pasting. It's the "forceNoPBC" flag. (Comment amended)