-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrefmac5runscriptcreator.py
112 lines (106 loc) · 2.82 KB
/
refmac5runscriptcreator.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env python
# -*- coding: latin-1 -*-
from process_multi_util_functions import safe_write_script
import sys,os
class Refmac5RunScriptCreator(object):
def __init__(self,phaseroutput_root,auriga_output_directory_root):
self.mtzfile = phaseroutput_root.strip() + ".1.mtz"
self.pdbfile = phaseroutput_root.strip() + ".1.pdb"
self.phaseroutput_root = phaseroutput_root.strip()
self.proj_name = os.path.split(phaseroutput_root)[-1]
self.auriga_output_directory_root = auriga_output_directory_root
self.outputdir = os.path.join(self.auriga_output_directory_root,self.proj_name)
if os.path.exists(self.mtzfile) and os.path.exists(self.pdbfile):
pass
else:
pass
def write_runscript_and_return_name(self):
self.comstring = """#!/bin/csh
#
# Example of refinement by refmac
#
set inmtz={self.outputdir}/{self.proj_name}_trnfreeR.mtz
start:
set name = {self.proj_name}
set last = 1
set cycles = 1
set count = 0
while ($count != $cycles)
echo '*******************************************************************'
echo $count
echo '*******************************************************************'
@ curr = $last + 1
#
# Refmac
#
refmac:
refmac5 \
HKLIN $inmtz \
HKLOUT {self.outputdir}/{self.proj_name}.${{curr}}.mtz \
XYZIN {self.outputdir}/{self.proj_name}.${{last}}.pdb \
XYZOUT {self.outputdir}/{self.proj_name}.${{curr}}.pdb \
<< eor
#
#####Do not add hydrogens
#
MAKE_restraints HYDRogens No
#
#####Do not check correctness of all monomers. Rely on users naming
#####One should be careful in using this option.
#
MAKE CHECk 0
#
####Input mtz labels.
#
LABIN FP=FP_{self.proj_name} SIGFP=SIGFP_{self.proj_name} FREE=FreeR_flag
#
####Output mtz labels
#
LABO FC=FC PHIC=PHIC FWT=2FOFCWT PHWT=PH2FOFCWT -
DELFWT=FOFCWT PHDELWT=PHFOFCWT
#
####Restrained refinement. Reflections between 20 1.5Å resolution will be used
#
REFI TYPE RESTrained RESOLUTION 20 1.10
#
####Use maximum likelihood residual
####Use maximum likelihood residual
#
REFI RESI MLKF
#
####Refine isotropic B values.
#
REFI BREF ISOTropic
#
####Use 0.35 as weighting between X-ray and geometry
#
WEIGHT AUTO
#
####Scaling parameters. Use BULK solvent based on Babinet's principle.
####NB: Unless otherwise SOLVENT NO given contribution of bulk solvent
####based on constant value will be used.
#
SCALe TYPE BULK
#
####Fix Babinet's bulk solvent B value to 200.0
#
SCALe LSSCale FIXBulk 200.0
#
####number of refinement cycles
#
NCYC 2
#
####Monitor only overall statistics
#
MONI MEDIUM
end
eor
if ($status) exit
#
@ last++
@ count++
end
""".format(self=self)
self.mycomfile = open(os.path.join(self.outputdir,self.proj_name + "_refmac5_input.sh"),"w")
safe_write_script(self.comstring,self.mycomfile)
return self.mycomfile.name