PageRenderTime 52ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/apbs-1.3-source/tools/matlab/solver/MATLAB_PB_SOLVER_6/MATLAB_APBS_FOCUS.m

#
MATLAB | 774 lines | 280 code | 133 blank | 361 comment | 37 complexity | 3df77dd263f3a42684927c368b00b13c MD5 | raw file
Possible License(s): LGPL-2.0, BSD-3-Clause, GPL-2.0
  1. function varargout = MATLAB_APBS_FOCUS(varargin)
  2. % MATLAB_APBS_FOCUS M-file for MATLAB_APBS_FOCUS.fig
  3. % MATLAB_APBS_FOCUS, by itself, creates a new MATLAB_APBS_FOCUS or raises the existing
  4. % singleton*.
  5. %
  6. % H = MATLAB_APBS_FOCUS returns the handle to a new MATLAB_APBS_FOCUS or the handle to
  7. % the existing singleton*.
  8. %
  9. % MATLAB_APBS_FOCUS('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in MATLAB_APBS_FOCUS.M with the given input arguments.
  11. %
  12. % MATLAB_APBS_FOCUS('Property','Value',...) creates a new MATLAB_APBS_FOCUS or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before MATLAB_APBS_FOCUS_OpeningFcn gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to MATLAB_APBS_FOCUS_OpeningFcn via varargin.
  17. %
  18. % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
  19. % instance to run (singleton)".
  20. %
  21. % See also: GUIDE, GUIDATA, GUIHANDLES
  22. % Edit the above text to modify the response to help MATLAB_APBS_FOCUS
  23. % Last Modified by GUIDE v2.5 13-Dec-2009 09:49:05
  24. % Begin initialization code - DO NOT EDIT
  25. gui_Singleton = 1;
  26. gui_State = struct('gui_Name', mfilename, ...
  27. 'gui_Singleton', gui_Singleton, ...
  28. 'gui_OpeningFcn', @MATLAB_APBS_FOCUS_OpeningFcn, ...
  29. 'gui_OutputFcn', @MATLAB_APBS_FOCUS_OutputFcn, ...
  30. 'gui_LayoutFcn', [] , ...
  31. 'gui_Callback', []);
  32. if nargin && ischar(varargin{1})
  33. gui_State.gui_Callback = str2func(varargin{1});
  34. end
  35. if nargout
  36. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  37. else
  38. gui_mainfcn(gui_State, varargin{:});
  39. end
  40. % End initialization code - DO NOT EDIT
  41. % --- Executes just before MATLAB_APBS_FOCUS is made visible.
  42. function MATLAB_APBS_FOCUS_OpeningFcn(hObject, eventdata, handles, varargin)
  43. % This function has no output args, see OutputFcn.
  44. % hObject handle to figure
  45. % eventdata reserved - to be defined in a future version of MATLAB
  46. % handles structure with handles and user data (see GUIDATA)
  47. % varargin command line arguments to MATLAB_APBS_FOCUS (see VARARGIN)
  48. % Choose default command line output for MATLAB_APBS_FOCUS
  49. handles.output = hObject;
  50. handles.dime1=0;
  51. handles.dime2=0;
  52. handles.dime3=0;
  53. handles.glen1=0;
  54. handles.glen2=0;
  55. handles.glen3=0;
  56. handles.temp=0;
  57. handles.ionic=0;
  58. handles.solvent=0;
  59. handles.dielx='';
  60. handles.diely='';
  61. handles.dielz='';
  62. handles.pathdielx='';
  63. handles.kappa='';
  64. handles.mol1='';
  65. handles.mol2='';
  66. handles.cout='';
  67. handles.memorypath='.';
  68. handles.ener='calcenerno';
  69. handles.bc='sdh';
  70. handles.digit=6;
  71. handles.filename='focusname.inm';
  72. % Update handles structure
  73. guidata(hObject, handles);
  74. % UIWAIT makes MATLAB_APBS_FOCUS wait for user response (see UIRESUME)
  75. %uiwait(handles.figure1);
  76. % --- Outputs from this function are returned to the command line.
  77. function varargout = MATLAB_APBS_FOCUS_OutputFcn(hObject, eventdata, handles)
  78. % varargout cell array for returning output args (see VARARGOUT);
  79. % hObject handle to figure
  80. % eventdata reserved - to be defined in a future version of MATLAB
  81. % handles structure with handles and user data (see GUIDATA)
  82. % Get default command line output from handles structure
  83. varargout{1} = handles.output;
  84. function edit2_Callback(hObject, eventdata, handles)
  85. % hObject handle to edit2 (see GCBO)
  86. % eventdata reserved - to be defined in a future version of MATLAB
  87. % handles structure with handles and user data (see GUIDATA)
  88. % Hints: get(hObject,'String') returns contents of edit2 as text
  89. % str2double(get(hObject,'String')) returns contents of edit2 as a double
  90. handles.dime2=int16(str2double(get(hObject,'String')));
  91. guidata(hObject,handles);
  92. % --- Executes during object creation, after setting all properties.
  93. function edit2_CreateFcn(hObject, eventdata, handles)
  94. % hObject handle to edit2 (see GCBO)
  95. % eventdata reserved - to be defined in a future version of MATLAB
  96. % handles empty - handles not created until after all CreateFcns called
  97. % Hint: edit controls usually have a white background on Windows.
  98. % See ISPC and COMPUTER.
  99. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  100. set(hObject,'BackgroundColor','white');
  101. end
  102. function edit3_Callback(hObject, eventdata, handles)
  103. % hObject handle to edit3 (see GCBO)
  104. % eventdata reserved - to be defined in a future version of MATLAB
  105. % handles structure with handles and user data (see GUIDATA)
  106. % Hints: get(hObject,'String') returns contents of edit3 as text
  107. % str2double(get(hObject,'String')) returns contents of edit3 as a double
  108. handles.dime3=int16(str2double(get(hObject,'String')));
  109. guidata(hObject,handles);
  110. % --- Executes during object creation, after setting all properties.
  111. function edit3_CreateFcn(hObject, eventdata, handles)
  112. % hObject handle to edit3 (see GCBO)
  113. % eventdata reserved - to be defined in a future version of MATLAB
  114. % handles empty - handles not created until after all CreateFcns called
  115. % Hint: edit controls usually have a white background on Windows.
  116. % See ISPC and COMPUTER.
  117. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  118. set(hObject,'BackgroundColor','white');
  119. end
  120. function edit4_Callback(hObject, eventdata, handles,glen1)
  121. % hObject handle to edit4 (see GCBO)
  122. % eventdata reserved - to be defined in a future version of MATLAB
  123. % handles structure with handles and user data (see GUIDATA)
  124. % Hints: get(hObject,'String') returns contents of edit4 as text
  125. % str2double(get(hObject,'String')) returns contents of edit4 as a double
  126. handles.glen1=str2double(get(hObject,'String'));
  127. guidata(hObject,handles);
  128. % --- Executes during object creation, after setting all properties.
  129. function edit4_CreateFcn(hObject, eventdata, handles)
  130. % hObject handle to edit4 (see GCBO)
  131. % eventdata reserved - to be defined in a future version of MATLAB
  132. % handles empty - handles not created until after all CreateFcns called
  133. % Hint: edit controls usually have a white background on Windows.
  134. % See ISPC and COMPUTER.
  135. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  136. set(hObject,'BackgroundColor','white');
  137. end
  138. function edit5_Callback(hObject, eventdata, handles,glen2)
  139. % hObject handle to edit5 (see GCBO)
  140. % eventdata reserved - to be defined in a future version of MATLAB
  141. % handles structure with handles and user data (see GUIDATA)
  142. % Hints: get(hObject,'String') returns contents of edit5 as text
  143. % str2double(get(hObject,'String')) returns contents of edit5 as a double
  144. handles.glen2=str2double(get(hObject,'String'));
  145. guidata(hObject,handles);
  146. % --- Executes during object creation, after setting all properties.
  147. function edit5_CreateFcn(hObject, eventdata, handles)
  148. % hObject handle to edit5 (see GCBO)
  149. % eventdata reserved - to be defined in a future version of MATLAB
  150. % handles empty - handles not created until after all CreateFcns called
  151. % Hint: edit controls usually have a white background on Windows.
  152. % See ISPC and COMPUTER.
  153. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  154. set(hObject,'BackgroundColor','white');
  155. end
  156. function edit6_Callback(hObject, eventdata, handles,glen3)
  157. % hObject handle to edit6 (see GCBO)
  158. % eventdata reserved - to be defined in a future version of MATLAB
  159. % handles structure with handles and user data (see GUIDATA)
  160. % Hints: get(hObject,'String') returns contents of edit6 as text
  161. % str2double(get(hObject,'String')) returns contents of edit6 as a double
  162. handles.glen3=str2double(get(hObject,'String'));
  163. guidata(hObject,handles);
  164. % --- Executes during object creation, after setting all properties.
  165. function edit6_CreateFcn(hObject, eventdata, handles)
  166. % hObject handle to edit6 (see GCBO)
  167. % eventdata reserved - to be defined in a future version of MATLAB
  168. % handles empty - handles not created until after all CreateFcns called
  169. % Hint: edit controls usually have a white background on Windows.
  170. % See ISPC and COMPUTER.
  171. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  172. set(hObject,'BackgroundColor','white');
  173. end
  174. function edit7_Callback(hObject, eventdata, handles)
  175. % hObject handle to edit7 (see GCBO)
  176. % eventdata reserved - to be defined in a future version of MATLAB
  177. % handles structure with handles and user data (see GUIDATA)
  178. % Hints: get(hObject,'String') returns contents of edit7 as text
  179. % str2double(get(hObject,'String')) returns contents of edit7 as a double
  180. %handles.dielx=get(hObject,'String');
  181. %guidata(hObject,handles);
  182. %
  183. % if strcmp(handles.filename, 'focusname.inm')==1
  184. % set(hObject, 'Enable','on');
  185. % set(hObject, 'String','');
  186. % handles.dielx='';
  187. % guidata(hObject,handles);
  188. % end
  189. filespec = {'*.dx', 'Open Format files (*.dx)'};
  190. [handles.dielx, handles.pathdielx] = uigetfile(filespec, 'Select the Required File',handles.memorypath);
  191. if (ischar(handles.dielx)==0)
  192. handles.dielx='';
  193. elseif strcmp(handles.dielx, '')==0
  194. % addpath(handles.pathdielx)
  195. % [handles.rmin,handles.dime,handles.h]=gridinf(handles.dielx);
  196. handles.memorypath=handles.pathdielx;
  197. end
  198. set(hObject, 'String',handles.dielx);
  199. guidata(hObject,handles);
  200. % button = questdlg('Are you sure this is the correct file? You are not able to change it later!','Confirmation','Yes','No','Yes');
  201. % if strcmp(button, 'Yes')==1
  202. % set(hObject, 'Enable','off');
  203. % else
  204. % msgbox('please, press "enter" and try again, thanks','Confirmation','none');
  205. % set(hObject, 'String','');
  206. % guidata(hObject,handles);
  207. % end
  208. % --- Executes during object creation, after setting all properties.
  209. function edit7_CreateFcn(hObject, eventdata, handles)
  210. % hObject handle to edit7 (see GCBO)
  211. % eventdata reserved - to be defined in a future version of MATLAB
  212. % handles empty - handles not created until after all CreateFcns called
  213. % Hint: edit controls usually have a white background on Windows.
  214. % See ISPC and COMPUTER.
  215. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  216. set(hObject,'BackgroundColor','white');
  217. end
  218. function edit10_Callback(hObject, eventdata, handles)
  219. % hObject handle to edit10 (see GCBO)
  220. % eventdata reserved - to be defined in a future version of MATLAB
  221. % handles structure with handles and user data (see GUIDATA)
  222. % Hints: get(hObject,'String') returns contents of edit10 as text
  223. % str2double(get(hObject,'String')) returns contents of edit10 as a double
  224. handles.temp=str2double(get(hObject,'String'));
  225. guidata(hObject, handles);
  226. % --- Executes during object creation, after setting all properties.
  227. function edit10_CreateFcn(hObject, eventdata, handles)
  228. % hObject handle to edit10 (see GCBO)
  229. % eventdata reserved - to be defined in a future version of MATLAB
  230. % handles empty - handles not created until after all CreateFcns called
  231. % Hint: edit controls usually have a white background on Windows.
  232. % See ISPC and COMPUTER.
  233. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  234. set(hObject,'BackgroundColor','white');
  235. end
  236. function edit12_Callback(hObject, eventdata, handles)
  237. % hObject handle to edit12 (see GCBO)
  238. % eventdata reserved - to be defined in a future version of MATLAB
  239. % handles structure with handles and user data (see GUIDATA)
  240. % Hints: get(hObject,'String') returns contents of edit12 as text
  241. % str2double(get(hObject,'String')) returns contents of edit12 as a double
  242. %handles.diely=get(hObject,'String');
  243. %guidata(hObject, handles);
  244. %
  245. filespec = {'*.dx', 'Open Format files (*.dx)'};
  246. [handles.diely, handles.pathdielx] = uigetfile(filespec, 'Select the Required File',handles.memorypath);
  247. if (ischar(handles.diely)==0)
  248. handles.diely='';
  249. elseif strcmp(handles.diely, '')==0
  250. % addpath(handles.pathdielx)
  251. % [handles.rmin,handles.dime,handles.h]=gridinf(handles.dielx);
  252. handles.memorypath=handles.pathdielx;
  253. end
  254. set(hObject, 'String',handles.diely);
  255. guidata(hObject,handles);
  256. % button = questdlg('Are you sure this is the correct file? You are not able to change it later!','Confirmation','Yes','No','Yes');
  257. % if strcmp(button, 'Yes')==1
  258. % set(hObject, 'Enable','off');
  259. % else
  260. % msgbox('please, press "enter" and try again, thanks','Confirmation','none');
  261. % set(hObject, 'String','');
  262. % guidata(hObject,handles);
  263. % end
  264. % --- Executes during object creation, after setting all properties.
  265. function edit12_CreateFcn(hObject, eventdata, handles)
  266. % hObject handle to edit12 (see GCBO)
  267. % eventdata reserved - to be defined in a future version of MATLAB
  268. % handles empty - handles not created until after all CreateFcns called
  269. % Hint: edit controls usually have a white background on Windows.
  270. % See ISPC and COMPUTER.
  271. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  272. set(hObject,'BackgroundColor','white');
  273. end
  274. function edit13_Callback(hObject, eventdata, handles)
  275. % hObject handle to edit13 (see GCBO)
  276. % eventdata reserved - to be defined in a future version of MATLAB
  277. % handles structure with handles and user data (see GUIDATA)
  278. % Hints: get(hObject,'String') returns contents of edit13 as text
  279. % str2double(get(hObject,'String')) returns contents of edit13 as a double
  280. %handles.dielz=get(hObject,'String');
  281. %guidata(hObject, handles);
  282. %
  283. filespec = {'*.dx', 'Open Format files (*.dx)'};
  284. [handles.dielz, handles.pathdielx] = uigetfile(filespec, 'Select the Required File',handles.memorypath);
  285. if (ischar(handles.dielz)==0)
  286. handles.dielz='';
  287. elseif strcmp(handles.dielz, '')==0
  288. % addpath(handles.pathdielx)
  289. % [handles.rmin,handles.dime,handles.h]=gridinf(handles.dielx);
  290. handles.memorypath=handles.pathdielx;
  291. end
  292. set(hObject, 'String',handles.dielz);
  293. guidata(hObject,handles);
  294. % button = questdlg('Are you sure this is the correct file? You are not able to change it later!','Confirmation','Yes','No','Yes');
  295. % if strcmp(button, 'Yes')==1
  296. % set(hObject, 'Enable','off');
  297. % else
  298. % msgbox('please, press "enter" and try again, thanks','Confirmation','none');
  299. % set(hObject, 'String','');
  300. % guidata(hObject,handles);
  301. % end
  302. % --- Executes during object creation, after setting all properties.
  303. function edit13_CreateFcn(hObject, eventdata, handles)
  304. % hObject handle to edit13 (see GCBO)
  305. % eventdata reserved - to be defined in a future version of MATLAB
  306. % handles empty - handles not created until after all CreateFcns called
  307. % Hint: edit controls usually have a white background on Windows.
  308. % See ISPC and COMPUTER.
  309. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  310. set(hObject,'BackgroundColor','white');
  311. end
  312. function edit14_Callback(hObject, eventdata, handles)
  313. % hObject handle to edit14 (see GCBO)
  314. % eventdata reserved - to be defined in a future version of MATLAB
  315. % handles structure with handles and user data (see GUIDATA)
  316. % Hints: get(hObject,'String') returns contents of edit14 as text
  317. % str2double(get(hObject,'String')) returns contents of edit14 as a double
  318. % handles.kappa=get(hObject,'String');
  319. % guidata(hObject, handles);
  320. %
  321. filespec = {'*.dx', 'Open Format files (*.dx)'};
  322. [handles.kappa, handles.pathdielx] = uigetfile(filespec, 'Select the Required File',handles.memorypath);
  323. if (ischar(handles.kappa)==0)
  324. handles.kappa='';
  325. elseif strcmp(handles.kappa, '')==0
  326. % addpath(handles.pathdielx)
  327. % [handles.rmin,handles.dime,handles.h]=gridinf(handles.dielx);
  328. handles.memorypath=handles.pathdielx;
  329. end
  330. set(hObject, 'String',handles.kappa);
  331. guidata(hObject,handles);
  332. % button = questdlg('Are you sure this is the correct file? You are not able to change it later!','Confirmation','Yes','No','Yes');
  333. % if strcmp(button, 'Yes')==1
  334. % set(hObject, 'Enable','off');
  335. % else
  336. % msgbox('please, press "enter" and try again, thanks','Confirmation','none');
  337. % set(hObject, 'String','');
  338. % guidata(hObject,handles);
  339. % end
  340. % --- Executes during object creation, after setting all properties.
  341. function edit14_CreateFcn(hObject, eventdata, handles)
  342. % hObject handle to edit14 (see GCBO)
  343. % eventdata reserved - to be defined in a future version of MATLAB
  344. % handles empty - handles not created until after all CreateFcns called
  345. % Hint: edit controls usually have a white background on Windows.
  346. % See ISPC and COMPUTER.
  347. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  348. set(hObject,'BackgroundColor','white');
  349. end
  350. function edit15_Callback(hObject, eventdata, handles)
  351. % hObject handle to edit15 (see GCBO)
  352. % eventdata reserved - to be defined in a future version of MATLAB
  353. % handles structure with handles and user data (see GUIDATA)
  354. % Hints: get(hObject,'String') returns contents of edit15 as text
  355. % str2double(get(hObject,'String')) returns contents of edit15 as a double
  356. % handles.mol1=get(hObject,'String');
  357. % guidata(hObject, handles);
  358. %
  359. filespec = {'*.pqr', 'Format File (*.pqr)'};
  360. [handles.mol1, handles.pathdielx] = uigetfile(filespec, 'Select the Required File',handles.memorypath);
  361. if (ischar(handles.mol1)==0)
  362. handles.mol1='';
  363. elseif strcmp(handles.mol1, '')==0
  364. % addpath(handles.pathdielx)
  365. % [handles.rmin,handles.dime,handles.h]=gridinf(handles.dielx);
  366. handles.memorypath=handles.pathdielx;
  367. end
  368. set(hObject, 'String',handles.mol1);
  369. guidata(hObject,handles);
  370. % button = questdlg('Are you sure this is the correct file? You are not able to change it later!','Confirmation','Yes','No','Yes');
  371. % if strcmp(button, 'Yes')==1
  372. % set(hObject, 'Enable','off');
  373. % else
  374. % msgbox('please, press "enter" and try again, thanks','Confirmation','none');
  375. % set(hObject, 'String','');
  376. % guidata(hObject,handles);
  377. % end
  378. % --- Executes during object creation, after setting all properties.
  379. function edit15_CreateFcn(hObject, eventdata, handles)
  380. % hObject handle to edit15 (see GCBO)
  381. % eventdata reserved - to be defined in a future version of MATLAB
  382. % handles empty - handles not created until after all CreateFcns called
  383. % Hint: edit controls usually have a white background on Windows.
  384. % See ISPC and COMPUTER.
  385. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  386. set(hObject,'BackgroundColor','white');
  387. end
  388. function edit16_Callback(hObject, eventdata, handles)
  389. % hObject handle to edit16 (see GCBO)
  390. % eventdata reserved - to be defined in a future version of MATLAB
  391. % handles structure with handles and user data (see GUIDATA)
  392. % Hints: get(hObject,'String') returns contents of edit16 as text
  393. % str2double(get(hObject,'String')) returns contents of edit16 as a double
  394. % handles.mol2=get(hObject,'String');
  395. % guidata(hObject, handles);
  396. %
  397. filespec = {'*.pqr', 'Format File (*.pqr)'};
  398. [handles.mol2, handles.pathdielx] = uigetfile(filespec, 'Select the Required File',handles.memorypath);
  399. if (ischar(handles.mol2)==0)
  400. handles.mol2='';
  401. elseif strcmp(handles.mol2, '')==0
  402. % addpath(handles.pathdielx)
  403. % [handles.rmin,handles.dime,handles.h]=gridinf(handles.dielx);
  404. handles.memorypath=handles.pathdielx;
  405. end
  406. set(hObject, 'String',handles.mol2);
  407. guidata(hObject,handles);
  408. % button = questdlg('Are you sure this is the correct file? You are not able to change it later!','Confirmation','Yes','No','Yes');
  409. % if strcmp(button, 'Yes')==1
  410. % set(hObject, 'Enable','off');
  411. % else
  412. % msgbox('please, press "enter" and try again, thanks','Confirmation','none');
  413. % set(hObject, 'String','');
  414. % guidata(hObject,handles);
  415. % end
  416. % --- Executes during object creation, after setting all properties.
  417. function edit16_CreateFcn(hObject, eventdata, handles)
  418. % hObject handle to edit16 (see GCBO)
  419. % eventdata reserved - to be defined in a future version of MATLAB
  420. % handles empty - handles not created until after all CreateFcns called
  421. % Hint: edit controls usually have a white background on Windows.
  422. % See ISPC and COMPUTER.
  423. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  424. set(hObject,'BackgroundColor','white');
  425. end
  426. function edit17_Callback(hObject, eventdata, handles)
  427. % hObject handle to edit17 (see GCBO)
  428. % eventdata reserved - to be defined in a future version of MATLAB
  429. % handles structure with handles and user data (see GUIDATA)
  430. % Hints: get(hObject,'String') returns contents of edit17 as text
  431. % str2double(get(hObject,'String')) returns contents of edit17 as a double
  432. handles.digit=int8(str2double(get(hObject,'String')));
  433. guidata(hObject, handles);
  434. % --- Executes during object creation, after setting all properties.
  435. function edit17_CreateFcn(hObject, eventdata, handles)
  436. % hObject handle to edit17 (see GCBO)
  437. % eventdata reserved - to be defined in a future version of MATLAB
  438. % handles empty - handles not created until after all CreateFcns called
  439. % Hint: edit controls usually have a white background on Windows.
  440. % See ISPC and COMPUTER.
  441. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  442. set(hObject,'BackgroundColor','white');
  443. end
  444. function edit18_Callback(hObject, eventdata, handles)
  445. % hObject handle to edit18 (see GCBO)
  446. % eventdata reserved - to be defined in a future version of MATLAB
  447. % handles structure with handles and user data (see GUIDATA)
  448. % Hints: get(hObject,'String') returns contents of edit18 as text
  449. % str2double(get(hObject,'String')) returns contents of edit18 as a double
  450. handles.ionic=str2double(get(hObject,'String'));
  451. guidata(hObject, handles);
  452. % --- Executes during object creation, after setting all properties.
  453. function edit18_CreateFcn(hObject, eventdata, handles)
  454. % hObject handle to edit18 (see GCBO)
  455. % eventdata reserved - to be defined in a future version of MATLAB
  456. % handles empty - handles not created until after all CreateFcns called
  457. % Hint: edit controls usually have a white background on Windows.
  458. % See ISPC and COMPUTER.
  459. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  460. set(hObject,'BackgroundColor','white');
  461. end
  462. function edit19_Callback(hObject, eventdata, handles)
  463. % hObject handle to edit19 (see GCBO)
  464. % eventdata reserved - to be defined in a future version of MATLAB
  465. % handles structure with handles and user data (see GUIDATA)
  466. % Hints: get(hObject,'String') returns contents of edit19 as text
  467. % str2double(get(hObject,'String')) returns contents of edit19 as a double
  468. handles.solvent=str2double(get(hObject,'String'));
  469. guidata(hObject, handles);
  470. % --- Executes during object creation, after setting all properties.
  471. function edit19_CreateFcn(hObject, eventdata, handles)
  472. % hObject handle to edit19 (see GCBO)
  473. % eventdata reserved - to be defined in a future version of MATLAB
  474. % handles empty - handles not created until after all CreateFcns called
  475. % Hint: edit controls usually have a white background on Windows.
  476. % See ISPC and COMPUTER.
  477. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  478. set(hObject,'BackgroundColor','white');
  479. end
  480. function edit23_Callback(hObject, eventdata, handles)
  481. % hObject handle to edit23 (see GCBO)
  482. % eventdata reserved - to be defined in a future version of MATLAB
  483. % handles structure with handles and user data (see GUIDATA)
  484. % Hints: get(hObject,'String') returns contents of edit23 as text
  485. % str2double(get(hObject,'String')) returns contents of edit23 as a double
  486. % handles.cout=get(hObject,'String');
  487. % guidata(hObject, handles);
  488. %
  489. handles.cout = uigetdir(handles.memorypath,'please, select Directory to Open');
  490. if (ischar(handles.cout)==0)
  491. handles.cout='';
  492. end
  493. set(hObject, 'String',handles.cout);
  494. %handles.cout=get(hObject,'String');
  495. guidata(hObject,handles);
  496. % button = questdlg('Are you sure this is the the correct Directory? You are not able to change it later!','Confirmation','Yes','No','Yes');
  497. % if strcmp(button, 'Yes')==1
  498. % set(hObject, 'Enable','off');
  499. % else
  500. % msgbox('please, press "Enter" and try again, thanks','Confirmation','none');
  501. % set(hObject, 'String','');
  502. % guidata(hObject,handles);
  503. % end
  504. % --- Executes during object creation, after setting all properties.
  505. function edit23_CreateFcn(hObject, eventdata, handles)
  506. % hObject handle to edit23 (see GCBO)
  507. % eventdata reserved - to be defined in a future version of MATLAB
  508. % handles empty - handles not created until after all CreateFcns called
  509. % Hint: edit controls usually have a white background on Windows.
  510. % See ISPC and COMPUTER.
  511. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  512. set(hObject,'BackgroundColor','white');
  513. end
  514. function edit24_Callback(hObject, eventdata, handles)
  515. % hObject handle to edit24 (see GCBO)
  516. % eventdata reserved - to be defined in a future version of MATLAB
  517. % handles structure with handles and user data (see GUIDATA)
  518. % Hints: get(hObject,'String') returns contents of edit24 as text
  519. % str2double(get(hObject,'String')) returns contents of edit24 as a double
  520. handles.dime1=int16(str2double(get(hObject,'String')));
  521. guidata(hObject,handles);
  522. % --- Executes during object creation, after setting all properties.
  523. function edit24_CreateFcn(hObject, eventdata, handles)
  524. % hObject handle to edit24 (see GCBO)
  525. % eventdata reserved - to be defined in a future version of MATLAB
  526. % handles empty - handles not created until after all CreateFcns called
  527. % Hint: edit controls usually have a white background on Windows.
  528. % See ISPC and COMPUTER.
  529. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  530. set(hObject,'BackgroundColor','white');
  531. end
  532. % --- Executes on button press in radiobutton1.
  533. function radiobutton1_Callback(hObject, eventdata, handles)
  534. % hObject handle to radiobutton1 (see GCBO)
  535. % eventdata reserved - to be defined in a future version of MATLAB
  536. % handles structure with handles and user data (see GUIDATA)
  537. %bt1=get(hObject,'Value')
  538. if (get(hObject,'Value') == get(hObject,'Max'))
  539. handles.bc='sdh';
  540. guidata(hObject, handles);
  541. else
  542. handles.bc='focusname.inm';
  543. guidata(hObject, handles);
  544. end
  545. % Hint: get(hObject,'Value') returns toggle state of radiobutton1
  546. % --- Executes on button press in radiobutton2.
  547. function radiobutton2_Callback(hObject, eventdata, handles)
  548. % hObject handle to radiobutton2 (see GCBO)
  549. % eventdata reserved - to be defined in a future version of MATLAB
  550. % handles structure with handles and user data (see GUIDATA)
  551. %bt2=get(hObject,'Value')
  552. if (get(hObject,'Value') == get(hObject,'Max'))
  553. handles.bc='focusname.inm';
  554. guidata(hObject, handles);
  555. else
  556. handles.bc='sdh';
  557. guidata(hObject, handles);
  558. end
  559. % Hint: get(hObject,'Value') returns toggle state of radiobutton2
  560. % --- Executes on button press in radiobutton3.
  561. function radiobutton3_Callback(hObject, eventdata, handles)
  562. % hObject handle to radiobutton3 (see GCBO)
  563. % eventdata reserved - to be defined in a future version of MATLAB
  564. % handles structure with handles and user data (see GUIDATA)
  565. %bt3=get(hObject,'Value')
  566. if (get(hObject,'Value') == get(hObject,'Max'))
  567. handles.ener='calceneryes';
  568. guidata(hObject, handles);
  569. else
  570. handles.ener='calcenerno';
  571. guidata(hObject, handles);
  572. end
  573. % Hint: get(hObject,'Value') returns toggle state of radiobutton3
  574. % --- Executes on button press in radiobutton4.
  575. function radiobutton4_Callback(hObject, eventdata, handles)
  576. % hObject handle to radiobutton4 (see GCBO)
  577. % eventdata reserved - to be defined in a future version of MATLAB
  578. % handles structure with handles and user data (see GUIDATA)
  579. %bt4=get(hObject,'Value')
  580. if (get(hObject,'Value') == get(hObject,'Max'))
  581. handles.ener='calcenerno';
  582. guidata(hObject, handles);
  583. else
  584. handles.ener='calceneryes';
  585. guidata(hObject, handles);
  586. end
  587. % Hint: get(hObject,'Value') returns toggle state of radiobutton4
  588. % --- Executes on button press in pushbutton2.
  589. function pushbutton2_Callback(hObject, eventdata, handles)
  590. % hObject handle to pushbutton2 (see GCBO)
  591. % eventdata reserved - to be defined in a future version of MATLAB
  592. % handles structure with handles and user data (see GUIDATA)
  593. %data=guidata(hOject);
  594. dime(1)=handles.dime1;
  595. dime(2)=handles.dime2;
  596. dime(3)=handles.dime3;
  597. glen(1)=handles.glen1;
  598. glen(2)=handles.glen2;
  599. glen(3)=handles.glen3;
  600. bulk(1)=handles.ionic;
  601. bulk(2)=handles.solvent;
  602. fid = fopen(handles.filename, 'wt');
  603. fprintf(fid,'%g %g %g\n',dime);
  604. fprintf(fid,'%f %f %f\n', glen);
  605. fprintf(fid,'%f\n', handles.temp);
  606. fprintf(fid,'%f %f\n', bulk);
  607. fprintf(fid,'%s\n',handles.bc);
  608. fprintf(fid,'%g\n',handles.digit);
  609. fprintf(fid,'%s\n',handles.dielx);
  610. fprintf(fid,'%s\n',handles.diely);
  611. fprintf(fid,'%s\n',handles.dielz);
  612. fprintf(fid,'%s\n',handles.kappa);
  613. fprintf(fid,'%s\n',handles.mol1);
  614. fprintf(fid,'%s\n',handles.mol2);
  615. fprintf(fid,'%s\n',handles.ener);
  616. fprintf(fid,'%s\n',handles.pathdielx);
  617. fprintf(fid,'%s\n',handles.cout);
  618. fclose(fid);
  619. %close
  620. button = questdlg('Are you sure you provided the correct information? You wont be able to change it later!','Confirmation','Yes','No','Yes');
  621. if strcmp(button, 'No')==1
  622. % set(hObject, 'Enable','off');
  623. % else
  624. msgbox('Please, make all the neccessary corrections and then press "Generate Input Files" again, thanks.!!','Confirmation','none');
  625. % set(hObject, 'String','');
  626. % guidata(hObject,handles);
  627. else
  628. thi=msgbox('The focusname.inm was successfully generated. Please, press Run MAPBS','!!GREAT!!','none');
  629. waitfor(thi)
  630. end
  631. % --- Executes on button press in pushbutton3.
  632. function pushbutton3_Callback(hObject, eventdata, handles)
  633. % hObject handle to pushbutton3 (see GCBO)
  634. % eventdata reserved - to be defined in a future version of MATLAB
  635. % handles structure with handles and user data (see GUIDATA)
  636. close
  637. th=msgbox('The MAPBS will run in your MATLAB command window. you can close any other matlab windows anytime.','MAPBS Calculation','none','modal');
  638. waitfor(th)
  639. clear
  640. clc
  641. MAPBS('inputfile.inm')