ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/get_mem.c
(Generate patch)
# Line 8 | Line 8
8   #include "utility.h"
9   #include "nonbond.h"
10   #include "torsions.h"
11 #include "solv.h"
12 #include "pot.h"
11  
12   void max_torsions(void);
13 + void get_molecule_memory(int);
14 + int use_solv(void);
15  
16  
17   #define STILL 1
# Line 19 | Line 19
19  
20   EXTERN struct t_solvent {
21      int type;
22 +    double EPSin, EPSsolv;
23      double doffset, p1,p2,p3,p4,p5;
24      double *shct,*asolv,*rsolv,*vsolv,*gpol,*rborn;
25      } solvent;
26  
27 + // =======================================
28 + /*void get_molecule_memory(int niatom)
29 + {
30 +  int i,j;
31 +
32 +  atom.type = ivector(0,niatom+10);
33 +  atom.tclass = ivector(0,niatom+10);
34 +  atom.mmx_type = ivector(0,niatom+10);
35 +  atom.mm3_type = ivector(0,niatom+10);
36 +  atom.mmff_type = ivector(0,niatom+10);
37 +  atom.atomnum = ivector(0,niatom+10);
38 +  atom.use = ivector(0,niatom+10);
39 +  atom.flags = ilvector(0,niatom+10);
40 +  atom.iat = imatrix(0, niatom+10,0,MAXIAT);
41 +  atom.bo = imatrix(0,niatom+10, 0, MAXIAT);
42 +  atom.x = dvector(0,niatom+10);
43 +  atom.y = dvector(0,niatom+10);
44 +  atom.z = dvector(0,niatom+10);
45 +  atom.charge = dvector(0,niatom+10);
46 +  atom.formal_charge = dvector(0,niatom+10);
47 +  atom.sigma_charge = dvector(0,niatom+10);
48 +  atom.atomwt = dvector(0,niatom+10);
49 +  atom.radius = dvector(0,niatom+10);
50 +
51 +
52 +  for (i=0; i <= niatom; i++)
53 +    {
54 +      atom.type[i] = 0;
55 +      atom.tclass[i] = 0;
56 +      atom.mmx_type[i] = 0;
57 +      atom.mm3_type[i] = 0;
58 +      atom.mmff_type[i] = 0;
59 +      atom.atomnum[i] = 0;
60 +      atom.use[i] = 0;
61 +      atom.flags[i] = 0;
62 +      atom.x[i] = 0.0;
63 +      atom.y[i] = 0.0;
64 +      atom.z[i] = 0.0;
65 +      atom.charge[i] = 0.0;
66 +      atom.formal_charge[i] = 0.0;
67 +      atom.sigma_charge[i] = 0.0;
68 +      atom.atomwt[i] = 0.0;
69 +      for (j=0; j < MAXIAT; j++)
70 +        {
71 +          atom.iat[i][j] = 0;
72 +          atom.bo[i][j] = 0;
73 +        }
74 +    }
75  
76 + }*/
77   /* ================================================================ */
78   void get_memory()
79   {
# Line 62 | Line 112
112      for (i=1; i <= natom; i++)
113      {
114          found = FALSE;
115 <        if (atom[i].type > nonbond.maxnbtype)
116 <           nonbond.maxnbtype = atom[i].type;
115 >        if (atom.type[i] > nonbond.maxnbtype)
116 >           nonbond.maxnbtype = atom.type[i];
117          for (j=0; j < ntypes; j++)
118          {
119 <            if (atom[i].type == itype[j])
119 >            if (atom.type[i] == itype[j])
120              {
121                  found = TRUE;
122                  break;
# Line 74 | Line 124
124          }
125          if (found == FALSE)
126          {
127 <            itype[ntypes] = atom[i].type;
127 >            itype[ntypes] = atom.type[i];
128              ntypes++;
129          }
130      }
# Line 86 | Line 136
136      nonbond.nonbond = j;    
137      nonbond.iNBtype = imatrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
138      nonbond.ipif =    imatrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
139 <    nonbond.vrad = matrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
140 <    nonbond.veps = matrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
141 <    nonbond.vrad14 = matrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
142 <    nonbond.veps14 = matrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
139 >    nonbond.vrad = dmatrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
140 >    nonbond.veps = dmatrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
141 >    nonbond.vrad14 = dmatrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
142 >    nonbond.veps14 = dmatrix(0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
143  
144      max_torsions();
145      ntor = torsions.ntor;
# Line 157 | Line 207
207              hess.hessz[i][j] = 0.0;
208          }
209      }
210 <    if (pot.use_solv)
210 >    if (use_solv())
211      {
212          solvent.asolv = dvector(0,natom+1);
213          solvent.rsolv = dvector(0,natom+1);
# Line 197 | Line 247
247      
248      free_imatrix(nonbond.iNBtype ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
249      free_imatrix(nonbond.ipif ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
250 <    free_matrix(nonbond.vrad ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
251 <    free_matrix(nonbond.veps ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
252 <    free_matrix(nonbond.vrad14 ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
253 <    free_matrix(nonbond.veps14 ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
250 >    free_dmatrix(nonbond.vrad ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
251 >    free_dmatrix(nonbond.veps ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
252 >    free_dmatrix(nonbond.vrad14 ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
253 >    free_dmatrix(nonbond.veps14 ,0,nonbond.maxnbtype+1, 0,nonbond.maxnbtype+1);
254  
255   //    ntor = 9*natom;
256      ntor = torsions.ntor;
# Line 230 | Line 280
280      free_imatrix(attached.i13 ,0, 20, 0,natom+1);
281      free_imatrix(attached.i14 ,0,144, 0,natom+1);
282  
283 <    if (pot.use_solv)
283 >    if (use_solv())
284      {
285          free_dvector(solvent.asolv ,0,natom+1);
286          free_dvector(solvent.rsolv ,0,natom+1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines