ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/pcm7.c
(Generate patch)
# Line 19 | Line 19
19          int nstrbnd, **isb;
20          float *ksb1, *ksb2;
21          } strbnd;
22 + EXTERN struct t_improp {
23 +        int nimptors, **iiprop;
24 +        float *v1, *v2, *v3;
25 +        int   *ph1, *ph2, *ph3;        
26 +        } improp;
27              
28   EXTERN struct t_minim_control {
29          int type, method, field, added_const;
# Line 57 | Line 62
62   int setup_calculation(void);
63   void end_calculation(void);
64  
65 < void ebond(int nbnd,int **,int *type,int *tclass,int *use,double *x,double *y,double *z,double *bl,double *bk,double *estr);
66 < void ebond1(int natom,int nbnd,int **,int *type,int *tclass,int *use,double *x,double *y,double *z,double *bl,double *bk,double *estr,double **deb);
65 > void ebond(int nbnd,int **,int *use,double *x,double *y,double *z,double *bl,double *bk,double *estr);
66 > void ebond1(int natom,int nbnd,int **,int *use,double *x,double *y,double *z,double *bl,double *bk,double *estr,double **deb);
67   void eangle(int nang,int **,int *use,double *x,double *y,double *z,int *angin,int *angtype,float *anat,float *acon,double *ebend);
68   void eangle1(int nang,int natom,int **,int *use,double *x,double *y,double *z,int *angin,int *angtype,float *anat,float *acon,double *ebend,double **dea);
69   void ebufcharge(int natom,int *use,int **skip,double *x,double *y,double *z,double *charge,double chrgcut,double *eu);
# Line 95 | Line 100
100                float *ksb2,float **hessx,float **hessy,float **hessz);
101   void esolv2(int ia,int natom,double chrgcut,double *charge,double *x,double *y,double *z,float **hessx,float **hessy,float **hessz);
102   void egeom2(int ,int natom,int *use,double *x,double *y,double *z,float **hessx,float **hessy,float **hessz);
103 + // gaff and amber
104 + void eimptors(int nimptors,int **iiprop,int *use,int *type,double *x,double *y,double *z,float *v1in,float *v2in,float *v3in,int *ph1in,int *ph2in,int *ph3in, double *e_imp);
105 + void eimptors1(int nimptors,int natom,int **iiprop,int *use,int *type,double *x,double *y,double *z,float *v1in,float *v2in,float *v3in,int *ph1in,int *ph2in,int *ph3in,
106 +           double *e_imp,double **deimprop);
107 + void eimptors2(int iatom,int nimptors,int **iiprop,int *use,int *type,double *x,double *y,double *z,float *v1in,float *v2in,float *v3in,int *ph1in,int *ph2in,int *ph3in,
108 +           float **hessx,float **hessy,float **hessz);
109 + void elj(int natom,int *type,int *use,double *x,double *y,double *z,double vdwcut,int **skip,double **vrad,double **veps,double *evdw,double *e14);
110 + void elj1(int natom,int *type,int *use,double *x,double *y,double *z,double vdwcut,int **skip,double **vrad,double **veps,double *evdw,double *e14,
111 +           double **devdw,double **de14);
112 + void elj2(int iatom,int natom,int *type,int *use,double *x,double *y,double *z,double vdwcut,int **skip,double **vrad,double **veps,
113 +           float **hessx,float **hessy,float **hessz);
114 + void echarge(void);
115 + void echarge1(void);
116 + void echarge2(int);
117 + //
118  
119   int  kbond(void);
120   void kangle(void);
# Line 105 | Line 125
125   void kvdw(int natom,int *type,int *atomnum);
126   void ksolv(int natom,int *atomnum,int **iat,int **bo);
127  
128 + // gaff
129 + void kimptors(void);
130 +
131   void get_memory(void);
132   void free_memory(void);
133   void gradient(void);
# Line 126 | Line 149
149   int use_bufcharge(void);
150   int use_geom(void);
151   int use_solv(void);
152 + int use_imptor(void);
153 + int use_lj(void);
154  
155   // ==================================================================
156   int setup_calculation()
# Line 137 | Line 162
162      potoff(); // turn off all force field terms before resetting
163      if (minim_control.field == MMFF94)
164      {
140        // copy mm3 types into type file and retype
165          set_field(MMFF94);
166          set_atomtypes(MMFF94);
167          if (minim_control.added_const)
168             get_added_const();
169 <    } else
169 >    } else if (minim_control.field == GAFF)
170 >      {
171 >        set_field(GAFF);
172 >        set_atomtypes(GAFF);
173 >      } else
174      {
175          if (minim_control.added_const)
176          {
# Line 201 | Line 229
229       if (use_angle() || use_opbend_wilson()) kopbend(atom.type,atom.tclass);
230       if (use_tors()  || use_strtor()) ktorsion(atom.type,atom.tclass,atom.iat,atom.bo);
231       if (use_strbnd()) kstrbnd();
232 +     if (use_imptor()) kimptors();
233        
234       if (use_hal()) kvdw(natom,atom.type,atom.atomnum);
235       if (use_charge() || use_bufcharge()) kcharge(natom,atom.type,atom.atomnum,atom.flags,atom.iat,atom.bo,
# Line 268 | Line 297
297          }
298        }
299    
300 <      if (use_bond())ebond1(natom,bonds_ff.nbnd,bonds_ff.i12,atom.type,atom.tclass,atom.use,atom.x,atom.y,atom.z,bonds_ff.bl,bonds_ff.bk,&energies.estr,deriv.deb);
300 >      if (use_bond())ebond1(natom,bonds_ff.nbnd,bonds_ff.i12,atom.use,atom.x,atom.y,atom.z,bonds_ff.bl,bonds_ff.bk,&energies.estr,deriv.deb);
301        if (use_angle())eangle1(angles.nang,natom, angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.angtype,angles.anat,angles.acon,&energies.ebend,deriv.dea);
273      if (use_opbend_wilson()) eopbend_wilson1(natom,angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.copb,&energies.eopb,deriv.deopb);
302        if (use_tors())etorsion1(natom,torsions.ntor,torsions.i14,atom.use,atom.x,atom.y,atom.z,torsions.ph1,torsions.ph2,torsions.ph3,torsions.ph4,torsions.ph5,torsions.ph6,
303                                   torsions.v1,torsions.v2,torsions.v3,torsions.v4,torsions.v5,torsions.v6,&energies.etor,deriv.detor);
304 +      // mmff
305        if (use_strbnd())estrbnd1(natom,strbnd.nstrbnd,strbnd.isb,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.anat,bonds_ff.bl,bonds_ff.bk,strbnd.ksb1,strbnd.ksb2,
306                                    &energies.estrbnd,deriv.destb);
307 <      // mmff
307 >      if (use_opbend_wilson()) eopbend_wilson1(natom,angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.copb,&energies.eopb,deriv.deopb);
308        if (use_hal()) ehal1(natom,atom.type,atom.use,atom.x,atom.y,atom.z,cutoffs.vdwcut,skip,nonbond.vrad,nonbond.veps,&energies.evdw,&energies.e14,deriv.devdw,deriv.de14);
309        if (use_bufcharge()) ebufcharge1(natom,atom.use,skip,atom.x,atom.y,atom.z,atom.charge,cutoffs.chrgcut,&energies.eu,deriv.deqq);
310 +      // gaff
311 +      if (use_imptor()) eimptors1(improp.nimptors,natom,improp.iiprop,atom.use,atom.type,atom.x,atom.y,atom.z,improp.v1,improp.v2,improp.v3,improp.ph1,improp.ph2,improp.ph3,
312 +              &energies.eimptors,deriv.deimprop);
313 +      if (use_lj()) elj1(natom,atom.type,atom.use,atom.x,atom.y,atom.z,cutoffs.vdwcut,skip,nonbond.vrad,nonbond.veps,&energies.evdw,&energies.e14,deriv.devdw,deriv.de14);
314 +      // if (use_charge())
315  
316        if (use_geom()) egeom1(natom,atom.use,atom.x,atom.y,atom.z,&energies.egeom,deriv.degeom);
317        if (use_solv()) esolv1(natom,cutoffs.chrgcut,skip,atom.use,atom.charge,atom.x,atom.y,atom.z,&energies.esolv,deriv.desolv,deriv.drb);
# Line 349 | Line 383
383        energies.egeom = 0.0;
384  
385  
386 <      if (use_bond())ebond(bonds_ff.nbnd,bonds_ff.i12,atom.type,atom.tclass,atom.use,atom.x,atom.y,
353 <         atom.z,bonds_ff.bl,bonds_ff.bk,&energies.estr);
386 >      if (use_bond())ebond(bonds_ff.nbnd,bonds_ff.i12,atom.use,atom.x,atom.y,atom.z,bonds_ff.bl,bonds_ff.bk,&energies.estr);
387        if (use_angle())eangle(angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.angtype,angles.anat,angles.acon,&energies.ebend);
355      if (use_opbend_wilson()) eopbend_wilson(angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.copb,&energies.eopb);
388        if (use_tors())etorsion(torsions.ntor,torsions.i14,atom.use,atom.type,atom.x,atom.y,atom.z,torsions.ph1,torsions.ph2,torsions.ph3,torsions.ph4,torsions.ph5,
389             torsions.ph6,torsions.v1,torsions.v2,torsions.v3,torsions.v4,torsions.v5,torsions.v6,&energies.etor);
390 +      // mmff
391        if (use_strbnd())estrbnd(strbnd.nstrbnd,strbnd.isb,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.anat,bonds_ff.bl,bonds_ff.bk,strbnd.ksb1,strbnd.ksb2,
392                                    &energies.estrbnd);
393 <      // mmff
393 >      if (use_opbend_wilson()) eopbend_wilson(angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.copb,&energies.eopb);
394        if (use_hal()) ehal(natom,atom.type,atom.use,atom.x,atom.y,atom.z,cutoffs.vdwcut,skip,nonbond.vrad,nonbond.veps,&energies.evdw,&energies.e14);
395        if (use_bufcharge()) ebufcharge(natom,atom.use,skip,atom.x,atom.y,atom.z,atom.charge,cutoffs.chrgcut,&energies.eu);
396  
397 +      // gaff
398 +      if (use_imptor()) eimptors(improp.nimptors,improp.iiprop,atom.use,atom.type,atom.x,atom.y,atom.z,improp.v1,improp.v2,improp.v3,improp.ph1,improp.ph2,improp.ph3,&energies.eimptors);
399 +      if (use_lj()) elj(natom,atom.type,atom.use,atom.x,atom.y,atom.z,cutoffs.vdwcut,skip,nonbond.vrad,nonbond.veps,&energies.evdw,&energies.e14);
400 +      // if (use_charge())
401 +
402        if (use_geom()) egeom(natom,atom.use,atom.x,atom.y,atom.z,&energies.egeom);
403        if (use_solv()) esolv(natom,cutoffs.chrgcut,skip,atom.use,atom.charge,atom.x,atom.y,atom.z,&energies.esolv);
404                                
# Line 395 | Line 433
433        energies.egeom = 0.0;
434  
435  
436 <      if (use_bond())ebond(bonds_ff.nbnd,bonds_ff.i12,atom.type,atom.tclass,atom.use,atom.x,atom.y,
399 <         atom.z,bonds_ff.bl,bonds_ff.bk,&energies.estr);
436 >      if (use_bond())ebond(bonds_ff.nbnd,bonds_ff.i12,atom.use,atom.x,atom.y,atom.z,bonds_ff.bl,bonds_ff.bk,&energies.estr);
437        if (use_angle())eangle(angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.angtype,angles.anat,angles.acon,&energies.ebend);
401      if (use_opbend_wilson()) eopbend_wilson(angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.copb,&energies.eopb);
438        if (use_tors())etorsion(torsions.ntor,torsions.i14,atom.use,atom.type,atom.x,atom.y,atom.z,torsions.ph1,torsions.ph2,torsions.ph3,torsions.ph4,torsions.ph5,
439             torsions.ph6,torsions.v1,torsions.v2,torsions.v3,torsions.v4,torsions.v5,torsions.v6,&energies.etor);
440 +      // mmff
441 +      if (use_opbend_wilson()) eopbend_wilson(angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.copb,&energies.eopb);
442        if (use_strbnd())estrbnd(strbnd.nstrbnd,strbnd.isb,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.anat,bonds_ff.bl,bonds_ff.bk,strbnd.ksb1,strbnd.ksb2,
443                                    &energies.estrbnd);
406      // mmff
444        if (use_hal()) ehal(natom,atom.type,atom.use,atom.x,atom.y,atom.z,cutoffs.vdwcut,skip,nonbond.vrad,nonbond.veps,&energies.evdw,&energies.e14);
445        if (use_bufcharge()) ebufcharge(natom,atom.use,skip,atom.x,atom.y,atom.z,atom.charge,cutoffs.chrgcut,&energies.eu);
446 +
447 +      // gaff
448 +      if (use_imptor()) eimptors(improp.nimptors,improp.iiprop,atom.use,atom.type,atom.x,atom.y,atom.z,improp.v1,improp.v2,improp.v3,improp.ph1,improp.ph2,improp.ph3,&energies.eimptors);
449 +      if (use_lj()) elj(natom,atom.type,atom.use,atom.x,atom.y,atom.z,cutoffs.vdwcut,skip,nonbond.vrad,nonbond.veps,&energies.evdw,&energies.e14);
450 +      // if (use_charge())
451        
452        if (use_geom()) egeom(natom,atom.use,atom.x,atom.y,atom.z,&energies.egeom);
453        if (use_solv()) esolv(natom,cutoffs.chrgcut,skip,atom.use,atom.charge,atom.x,atom.y,atom.z,&energies.esolv);
# Line 466 | Line 508
508        {
509          if (use_bond())ebond2(i,bonds_ff.i12,atom.iat,atom.bo,atom.x,atom.y,atom.z,bonds_ff.bl,bonds_ff.bk,hess.hessx,hess.hessy,hess.hessz);
510          if (use_angle())eangle2(i,angles.nang,angles.i13,angles.angin,atom.x,atom.y,atom.z,angles.acon,angles.anat,deriv.dea,hess.hessx,hess.hessy,hess.hessz);
469        if (use_strbnd())estrbnd2(i,strbnd.nstrbnd,strbnd.isb,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.anat,bonds_ff.bl,bonds_ff.bk,strbnd.ksb1,strbnd.ksb2,
470                                    hess.hessx,hess.hessy,hess.hessz);
471        if (use_opbend_wilson()) eopbend_wilson2(i,angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.copb,hess.hessx,hess.hessy,hess.hessz);
511          if (use_tors())etorsion2(i,torsions.ntor,torsions.i14,atom.use,atom.x,atom.y,atom.z,torsions.ph1,torsions.ph2,torsions.ph3,torsions.ph4,torsions.ph5,
512                                     torsions.ph6,torsions.v1,torsions.v2,torsions.v3,torsions.v4,torsions.v5,torsions.v6,hess.hessx,hess.hessy,hess.hessz);
513          
514 +        // mmff
515 +        if (use_strbnd())estrbnd2(i,strbnd.nstrbnd,strbnd.isb,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.anat,bonds_ff.bl,bonds_ff.bk,strbnd.ksb1,strbnd.ksb2,
516 +                                    hess.hessx,hess.hessy,hess.hessz);
517 +        if (use_opbend_wilson()) eopbend_wilson2(i,angles.nang,angles.i13,atom.use,atom.x,atom.y,atom.z,angles.angin,angles.copb,hess.hessx,hess.hessy,hess.hessz);
518          if (use_hal())ehal2(i,natom,atom.type,atom.use,atom.x,atom.y,atom.z,cutoffs.vdwcut,skip,nonbond.vrad,nonbond.veps,hess.hessx,hess.hessy,hess.hessz);  
519          if (use_bufcharge())ebufcharge2(i,natom,atom.use,skip,atom.x,atom.y,atom.z,atom.charge,cutoffs.chrgcut,hess.hessx,hess.hessy,hess.hessz);
520  
521 +        // gaff
522 +        if (use_imptor()) eimptors2(i,improp.nimptors,improp.iiprop,atom.use,atom.type,atom.x,atom.y,atom.z,improp.v1,improp.v2,improp.v3,improp.ph1,improp.ph2,improp.ph3,hess.hessx,
523 +                                   hess.hessy,hess.hessz);
524 +        if (use_lj()) elj2(i,natom,atom.type,atom.use,atom.x,atom.y,atom.z,cutoffs.vdwcut,skip,nonbond.vrad,nonbond.veps,hess.hessx,hess.hessy,hess.hessz);
525 +        //if (use_charge())
526 +
527          if (use_geom()) egeom2(i,natom,atom.use,atom.x,atom.y,atom.z,hess.hessx,hess.hessy,hess.hessz);
528          if (use_solv()) esolv2(i,natom,cutoffs.chrgcut,atom.charge,atom.x,atom.y,atom.z,hess.hessx,hess.hessy,hess.hessz);
529  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines