DIG
DIG copied to clipboard
fix a bug in geometric_computing.py
First of all, torsion index should be calculated in the "use_torsion" mode. And in line 61, torsion mask should consider the situation that, k and reference node n are the same node. This will save a "angle" level computation time, though this situation can be detected in line 76.
Maybe there is a better way to fix this, I just didn't figure it out.
As far as I can tell, the inconsistency between angle and torsion may be caused by some nodes that only have 2 neighbors. Thus they don't have a reference node. In the old version, the torsion will be set to 6.28. And in my version, it simply disappear. Maybe this is a cause to the inconsistency. And I can't understand why there are zeros.
Hi @Franklalalala, thanks for your pull request. Firstly, the number of angles and torsions need to be consistent for the model. I think it is ok that the torsion is 2*pi if a node only has 2 neighbors. This is because, for a node k, the reference node is selected as its previous node in the anticlockwise direction. If a node only has 2 neighbors, the reference node for k is still k (the previous one in the anticlockwise direction). Therefore, I think 2*pi is ok. Maybe you can change this line torsion1[torsion1<=0]+=2*PI
to change 2*pi to 0.