-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuatfitPy-NEW.py
executable file
·84 lines (74 loc) · 2.26 KB
/
QuatfitPy-NEW.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#! /usr/bin/env python2.7
##############################################################################
# The program to superimpose atoms of two molecules by quaternion method
#
# David J. Heisterberg
# The Ohio Supercomputer Center
# 1224 Kinnear Rd.
# Columbus, OH 43212-1163
# (614)292-6036
# [email protected] [email protected] ohstpy::djh
#
# Translated to C from fitest.f program and interfaced with Xmol program
# by Jan Labanowski, [email protected] [email protected] ohstpy::jkl
#
# Translated to python from quatfit.c
# by Thomas J. L. Mustard, [email protected]
#
# Copyright: Ohio Supercomputer Center, David J. Heisterberg, 1990.
# The program can be copied and distributed freely, provided that
# this copyright in not removed. You may acknowledge the use of the
# program in published material as:
# David J. Heisterberg, 1990, unpublished results.
import sys
import getopt
import shutil
import os
import math
import quatfit
### --- Arguments --- ###
program = "QuatfitPy-CLASSICAL.py"
reffile = ''
fitfile = ''
ofile = ''
pairsfile = ''
statfile = ''
debug = 0
# Read command line args
try:
myopts, args = getopt.getopt(sys.argv[1:], "r:f:p:o:s:hd")
except getopt.GetoptError:
print program + " -r <ref> -f <fit> -p <pairs> -o <out> -s <stat> -h -d"
sys.exit(2)
###############################
# o == option
# a == argument passed to the o
###############################
for o, a in myopts:
if o == '-r':
reffile = a
elif o == '-f':
fitfile = a
elif o == '-o':
ofile = a
elif o == '-p':
pairsfile = a
elif o == '-s':
statfile = a
elif o == '-d':
debug += 1
elif o == '-h':
print program + " -r <ref> -f <fit> -p <pairs> -o <out> -s <stat> -h -d"
sys.exit(0)
else:
print("Usage: %s -r <ref> -f <fit> -p <pairs> -o <out> -s <stat> -h -d" % sys.argv[0])
sys.exit(0)
reffilelol = quatfit.parseXYZ(reffile)
fitfilelol = quatfit.parseXYZ(fitfile)
pairs, weights = quatfit.parsePairs(pairsfile)
fitfilelol, rms = quatfit.quatfitGetMolecule(reffilelol, fitfilelol, pairs, weights)
print "Weighted root mean square = " + str(rms)
quatfit.outputXYZ(ofile, fitfilelol, 1)
######################################################################
### END OF SCRIPT
######################################################################