Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug for constraints type "xyz" in run_json.py #85

Closed
yudongqiu opened this issue Apr 18, 2019 · 3 comments
Closed

Bug for constraints type "xyz" in run_json.py #85

yudongqiu opened this issue Apr 18, 2019 · 3 comments

Comments

@yudongqiu
Copy link
Contributor

Source code:
const_rep.extend([x + 1 for x in constraint["indices"]])

Explanation:

Four constraint types are supported, namely ["xyz", "distance", "angle", "dihedral"], the current implementation is correct for the last three, such as distance 1 2 or angle 1 2 3, but is incorrect for the "xyz", because to freeze the xyz of atoms 0-2, it will generate string "xyz 1 2 3", which will trigger an error by geomeTRIC. The correct string should be "xyz 1-3" or "xyz 1,2,3"

Solution:

For the special case of constraint type "xyz", it would be useful to call the nifty.commadash() function instead of adding indices:
old:

const_rep.extend([x + 1 for x in constraint["indices"]])

new:

from geometric.nifty import commadash
...

if constraint["type"] == "xyz":
    const_rep.append(commadash(constraint["indices"]))
else:
    const_rep.extend([x + 1 for x in constraint["indices"]])
@leeping
Copy link
Owner

leeping commented Apr 18, 2019

Could you submit a PR with this change? :) Does this affect anything outside of geomeTRIC (i.e. things on the QCFractal side)?

@yudongqiu
Copy link
Contributor Author

Sure. I think if QCFractal tries to call geometric.run_json.geometric_run_json() with the "xyz" constraints, it will result in an error in the current implementation. Fixing the bug here should fix it for QCFractal, too.

@dgasmith
Copy link
Contributor

+1 for @yudongqiu's comment. Since we pass through options this will work just fine.

@leeping leeping closed this as completed Apr 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants