File: dx_export.m

package info (click to toggle)
apbs 3.4.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 199,188 kB
  • sloc: ansic: 284,988; cpp: 60,416; fortran: 44,896; xml: 13,895; sh: 13,838; python: 8,105; yacc: 2,922; makefile: 1,428; f90: 989; objc: 448; lex: 294; awk: 266; sed: 205; java: 134; csh: 79
file content (55 lines) | stat: -rw-r--r-- 1,768 bytes parent folder | download | duplicates (19)
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
%This routine writes out dx format files

poteror=zeros(prod(dime),1);
for i=1:dime(1)
    for j=1:dime(2)
        for k=1:dime(3)
            pepe=(i-1)*dime(3)*dime(2)+(j-1)*dime(3)+k;
            poteror(pepe)=dxformat(i,j,k);
        end
    end
end
last_line=mod(prod(dime),3);
num_line=(prod(dime)-last_line)/3;
potelast(1:prod(dime)-last_line)=poteror(1:prod(dime)-last_line);
dxpotential=reshape(potelast, num_line,3);
if last_line>=1
lastline(1:last_line)=poteror(prod(dime)-last_line+1:prod(dime));
end
fid = fopen(outputfile, 'wt');
fprintf(fid,'# Data from MAPBS 0.0.0\n');
fprintf(fid,'#\n');
fprintf(fid,'# ');
fprintf(fid,'%s\n',namefile);
fprintf(fid,'#\n');
fprintf(fid,'object 1 class gridpositions counts ');
fprintf(fid,'%g %g %g\n',dime);
fprintf(fid,'origin ');
% fprintf(fid,' %e %e %e\n',rmin);
fprintf(fid,' %e %e %e\n',rmin);
fprintf(fid,'delta ');
fprintf(fid,'%e', h(1));
fprintf(fid,' 0.000000e+00 0.000000e+00\n');
fprintf(fid,'delta 0.000000e+00 ');
fprintf(fid,'%e', h(2));
fprintf(fid,' 0.000000e+00\n');
fprintf(fid,'delta 0.000000e+00 0.000000e+00 ');
fprintf(fid,'%e\n', h(3));
fprintf(fid,'object 2 class gridconnections counts ');
fprintf(fid,'%g %g %g\n', dime);
fprintf(fid,'object 3 class array type double rank 0 items ' );
fprintf(fid,'%g', prod(dime));
fprintf(fid,' data follows\n');
fprintf(fid, '%e %e %e\n', dxpotential);
if last_line==1
    fprintf(fid, '%e\n', lastline);
end
if last_line==2
    fprintf(fid, '%e %e\n', lastline);
end
fprintf(fid,'attribute "dep" string "positions"\n');
fprintf(fid,'object "regular positions regular connections" class field\n');
fprintf(fid,'component "positions" value 1\n');
fprintf(fid,'component "connections" value 2\n');
fprintf(fid,'component "data" value 3\n');
fclose(fid);