1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """Module containing the 'palmer' user function class for controlling the Modelfree4 software."""
25 __docformat__ = 'plaintext'
26
27
28 from base_class import User_fn_class
29 import arg_check
30 from generic_fns import palmer
31
32
34 """Class for interfacing with Art Palmer's Modelfree 4."""
35
36 - def create(self, dir=None, force=False, binary='modelfree4', diff_search='none', sims=0, sim_type='pred', trim=0, steps=20, constraints=True, heteronuc_type='15N', atom1='N', atom2='H', spin_id=None):
37 """Function for creating the Modelfree4 input files.
38
39 Keyword Arguments
40 ~~~~~~~~~~~~~~~~~
41
42 dir: The directory to place the files.
43
44 force: A flag which if set to True will cause the results file to be overwritten if it
45 already exists.
46
47 binary: The name of the executable Modelfree program file.
48
49 diff_search: See the Modelfree4 manual for 'diffusion_search'.
50
51 sims: The number of Monte Carlo simulations.
52
53 sim_type: See the Modelfree4 manual.
54
55 trim: See the Modelfree4 manual.
56
57 steps: See the Modelfree4 manual.
58
59 constraints: A flag specifying whether the parameters should be constrained. The default
60 is to turn constraints on (constraints=True).
61
62 heteronuc_type: A three letter string describing the heteronucleus type, ie 15N, 13C, etc.
63
64 atom1: The symbol of the X heteronucleus in the pdb file.
65
66 atom2: The symbol of the H nucleus in the pdb file.
67
68 spin_id: The spin identification string.
69
70
71 Description
72 ~~~~~~~~~~~
73
74 The following files are created
75
76 'dir/mfin',
77 'dir/mfdata',
78 'dir/mfpar',
79 'dir/mfmodel',
80 'dir/run.sh'.
81
82 The file 'dir/run.sh' contains the single command,
83
84 'modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out',
85
86 which can be used to execute modelfree4.
87
88 If you would like to use a different Modelfree executable file, change the keyword argument
89 'binary' to the appropriate file name. If the file is not located within the environment's
90 path, include the full path infront of the binary file name.
91 """
92
93
94 if self._exec_info.intro:
95 text = self._exec_info.ps3 + "palmer.create("
96 text = text + "dir=" + repr(dir)
97 text = text + ", force=" + repr(force)
98 text = text + ", binary=" + repr(binary)
99 text = text + ", diff_search=" + repr(diff_search)
100 text = text + ", sims=" + repr(sims)
101 text = text + ", sim_type=" + repr(sim_type)
102 text = text + ", trim=" + repr(trim)
103 text = text + ", steps=" + repr(steps)
104 text = text + ", constraints=" + repr(constraints)
105 text = text + ", heteronucleus=" + repr(heteronuc_type)
106 text = text + ", atom1=" + repr(atom1)
107 text = text + ", atom2=" + repr(atom2)
108 text = text + ", spin_id=" + repr(spin_id) + ")"
109 print(text)
110
111
112 arg_check.is_str(dir, 'directory name', can_be_none=True)
113 arg_check.is_bool(force, 'force flag')
114 arg_check.is_str(binary, 'Modelfree executable file')
115 arg_check.is_str(diff_search, 'diffusion search')
116 arg_check.is_int(sims, 'number of Monte Carlo simulations')
117 arg_check.is_str(sim_type, 'simulation type')
118 arg_check.is_num(trim, 'trimming')
119 arg_check.is_int(steps, 'steps')
120 arg_check.is_bool(constraints, 'constraints flag')
121 arg_check.is_str(heteronuc_type, 'heteronucleus')
122 arg_check.is_str(atom1, 'atom1')
123 arg_check.is_str(atom2, 'atom2')
124
125
126 palmer.create(dir=dir, force=force, binary=binary, diff_search=diff_search, sims=sims, sim_type=sim_type, trim=trim, steps=steps, constraints=constraints, heteronuc_type=heteronuc_type, atom1=atom1, atom2=atom2, spin_id=spin_id)
127
128
129 - def execute(self, dir=None, force=False, binary='modelfree4'):
130 """Function for executing Modelfree4.
131
132 Keyword Arguments
133 ~~~~~~~~~~~~~~~~~
134
135 dir: The directory to place the files.
136
137 force: A flag which if set to True will cause the results file to be overwritten if it
138 already exists.
139
140 binary: The name of the executable Modelfree program file.
141
142
143 Description
144 ~~~~~~~~~~~
145
146 Modelfree 4 will be executed as
147
148 $ modelfree4 -i mfin -d mfdata -p mfpar -m mfmodel -o mfout -e out
149
150 If a PDB file is loaded and non-isotropic diffusion is selected, then the file name will be
151 placed on the command line as '-s pdb_file_name'.
152
153
154 If you would like to use a different Modelfree executable file, change the keyword argument
155 'binary' to the appropriate file name. If the file is not located within the environment's
156 path, include the full path in front of the binary file name.
157 """
158
159
160 if self._exec_info.intro:
161 text = self._exec_info.ps3 + "palmer.execute("
162 text = text + "dir=" + repr(dir)
163 text = text + ", force=" + repr(force)
164 text = text + ", binary=" + repr(binary) + ")"
165 print(text)
166
167
168 arg_check.is_str(dir, 'directory name', can_be_none=True)
169 arg_check.is_bool(force, 'force flag')
170 arg_check.is_str(binary, 'Modelfree executable file')
171
172
173 palmer.execute(dir=dir, force=force, binary=binary)
174
175
177 """Function for extracting data from the Modelfree4 'mfout' star formatted file.
178
179 Keyword Arguments
180 ~~~~~~~~~~~~~~~~~
181
182 dir: The directory where the file 'mfout' is found.
183 """
184
185
186 if self._exec_info.intro:
187 text = self._exec_info.ps3 + "palmer.extract("
188 text = text + "dir=" + repr(dir) + ")"
189 print(text)
190
191
192 arg_check.is_str(dir, 'directory name', can_be_none=True)
193
194
195 palmer.extract(dir=dir)
196