Created
July 19, 2017 11:38
-
-
Save andersx/063badb0958dfa5c7b21632727abb994 to your computer and use it in GitHub Desktop.
Convert TINKER xyz to regular xyz format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from __future__ import print_function | |
| import sys | |
| def tinker2xyz(filename): | |
| f = open(filename, "r") | |
| lines = f.readlines() | |
| f.close() | |
| natoms = len(lines) - 1 | |
| print(natoms) | |
| print() | |
| for line in lines[1:]: | |
| tokens = line.split() | |
| print(" %-s %12s %12s %12s" % (tokens[1][0], tokens[2], tokens[3], tokens[4])) | |
| return | |
| if __name__ == "__main__": | |
| filename = sys.argv[1] | |
| tinker2xyz(filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment