ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/pcm7.c
(Generate patch)
# Line 3 | Line 3
3   #include "pcwin.h"
4   #include "pcmod.h"
5  
6 #include "energies.h"
6   #include "angles.h"
7 +
8 + #include "energies.h"
9   #include "rings.h"
10   #include "torsions.h"
11   #include "bonds_ff.h"
# Line 15 | Line 16
16   #include "utility.h"
17   #include "solv.h"  
18   #include "field.h"
19 <
19 < EXTERN struct  t_optimize {
20 <        int param_avail, converge;
21 <        float initial_energy, final_energy, initial_heat, final_heat;
22 <        } optimize_data;
23 < EXTERN struct t_units {
24 <        double bndunit, cbnd, qbnd;
25 <        double angunit, cang, qang, pang, sang, aaunit;
26 <        double stbnunit, ureyunit, torsunit, storunit, v14scale;
27 <        double aterm, bterm, cterm, dielec, chgscale;
28 <        } units;
19 > #include "dipmom.h"
20                  
21   struct t_cbonds {
22          int nbnd, icbonds[MAXCBND][3], lpd[MAXCBND], ia1[MAXCBND],ia2[MAXCBND];
# Line 39 | Line 30
30          int type, method, field, added_const;
31          char added_path[256],added_name[256];
32          } minim_control;
42
43 struct t_dipolemom {
44        double total, xdipole, ydipole, zdipole;
45       }  dipolemom;
33          
34   EXTERN struct t_minim_values {
35          int iprint, ndc, nconst;
# Line 67 | Line 54
54   int iscoord_bond(int, int);
55   void get_coordbonds(void);
56   int isbond(int, int);
70 int isangle(int,int);
57   int ishbond(int, int);
58   int istorsion(int, int);
59   void get_hbond(void);
# Line 75 | Line 61
61   void reset_atom_data(void);
62   int initialise(void);
63   void get_bonds(void);
78 void get_angles(void);
64   void get_torsions(void);
65   void get_rings(void);
66   void set_field(void);
# Line 158 | Line 143
143   void attach(void);
144   void eheat(void);
145   void pirite(void);
161 void charge_dipole(void);
162 void dipole_dipole(void);
146   void piden(void);
147   void hdel(int);
148   void set_atomtypes(int);
# Line 213 | Line 196
196          minim_values.iprint = FALSE;
197       }
198                  
216      optimize_data.initial_energy = energies.total;
217
199        if (minim_control.type == 1)  // single point calculation
200           return;
201  
# Line 228 | Line 209
209        else
210           etot = energy();
211  
231      optimize_data.final_energy = energies.total;
232
212   //    compute dipole moment here
213        dipolemom.xdipole = 0.0;
214        dipolemom.ydipole = 0.0;
215        dipolemom.zdipole = 0.0;
216 <      if (pot.use_charge || pot.use_bufcharge || use_gast_chrg) charge_dipole();
217 <      if (pot.use_dipole && !use_gast_chrg) dipole_dipole();
216 >      if (pot.use_charge || pot.use_bufcharge) charge_dipole();
217 >      if (pot.use_dipole) dipole_dipole();
218        dipolemom.total = sqrt(dipolemom.xdipole*dipolemom.xdipole +
219                               dipolemom.ydipole*dipolemom.ydipole +
220                               dipolemom.zdipole*dipolemom.zdipole);
# Line 342 | Line 321
321       if (nRet == FALSE) // use end_calc to free memory
322       {
323         //         message_alert("Parameters missing. See pcmod.err for information","Error");
345         optimize_data.param_avail = 1;
324           //         fclose(errfile);
325           energies.total = 9999.;
326           return FALSE;
# Line 353 | Line 331
331       if (pot.use_strbnd) kstrbnd();
332        
333        if (pot.use_buck || pot.use_hal || pot.use_lj) kvdw();
334 <      if ((pot.use_charge || pot.use_bufcharge || pot.use_ewald) && !use_external_chrg && !use_gast_chrg) kcharge();
334 >      if ((pot.use_charge || pot.use_bufcharge || pot.use_ewald)) kcharge();
335  
336         if (Missing_constants == TRUE)
337         {
338           //           message_alert("Parameters missing. See pcmod.err for information","Error");
339           //           fclose(errfile);
362           optimize_data.param_avail = 1;
340             energies.total = 9999.0;
341             return (FALSE);
342         } else
# Line 400 | Line 377
377        energies.eimptors = 0.0;
378        energies.eurey = 0.0;
379        energies.esolv = 0.0;
380 +      energies.egeom =0.0;
381  
382        virial.virx = 0.0;
383        virial.viry = 0.0;
# Line 425 | Line 403
403              deriv.deimprop[i][j] = 0.0;
404              deriv.dehb[i][j] = 0.0;
405              deriv.desolv[i][j] = 0.0;
406 +            deriv.degeom[i][j] = 0.0;
407          }
408        }
409    
# Line 437 | Line 416
416        // mmff
417        if (pot.use_hal) ehal1();
418        if (pot.use_bufcharge) ebufcharge1();
419 +
420 +      if (pot.use_geom) egeom1();
421      
422        energies.total =  energies.estr + energies.ebend + energies.etor + energies.estrbnd + energies.e14+
423                          energies.evdw + energies.eu + energies.ehbond + energies.eangang + energies.estrtor +
424 <                        energies.eimprop + energies.eimptors + energies.eopb + energies.eurey + energies.esolv;
424 >                        energies.eimprop + energies.eimptors + energies.eopb + energies.eurey + energies.esolv + energies.egeom;
425        for (i=1; i <= natom; i++)
426        {
427            for (j=0; j < 3; j++)
# Line 448 | Line 429
429                deriv.d1[i][j] = deriv.deb[i][j] + deriv.dea[i][j] + deriv.deaa[i][j] +
430                                 deriv.destb[i][j] + deriv.detor[i][j] + deriv.deopb[i][j] + deriv.dehb[i][j] +
431                                 deriv.destor[i][j] + deriv.deqq[i][j] + deriv.devdw[i][j] + deriv.de14[i][j] +
432 <                               deriv.deimprop[i][j] + deriv.deub[i][j] + deriv.desolv[i][j];
432 >                               deriv.deimprop[i][j] + deriv.deub[i][j] + deriv.desolv[i][j] + deriv.degeom[i][j];
433  
434           }
435        }
# Line 476 | Line 457
457        energies.eopb = 0.0;
458        energies.eurey = 0.0;
459        energies.esolv = 0.0;
460 +      energies.egeom = 0.0;
461  
462        for (i=1; i <= natom; i++)
463             atom[i].energy = 0.0;
# Line 488 | Line 470
470        // mmff
471        if (pot.use_hal) ehal();
472        if (pot.use_bufcharge) ebufcharge();
473 +
474 +      if (pot.use_geom) egeom();
475                                
476        energies.total =  energies.estr + energies.ebend + energies.etor + energies.estrbnd
477               + energies.evdw + energies.e14 + energies.ehbond + energies.eu + energies.eangang +
478 <               energies.estrtor + energies.eimprop + energies.eimptors + energies.eopb + energies.eurey + energies.esolv;
478 >               energies.estrtor + energies.eimprop + energies.eimptors + energies.eopb + energies.eurey + energies.esolv + energies.egeom;
479        etot = energies.total;
480        return (etot);
481   }
# Line 517 | Line 501
501        energies.eopb = 0.0;
502        energies.eurey = 0.0;
503        energies.esolv = 0.0;
504 +      energies.egeom = 0.0;
505  
506        for (i=1; i <= natom; i++)
507             atom[i].energy = 0.0;
# Line 530 | Line 515
515        if (pot.use_hal) ehal();
516        if (pot.use_bufcharge) ebufcharge();
517        
518 +      if (pot.use_geom) egeom();
519 +
520        energies.total =  energies.estr + energies.ebend + energies.etor + energies.estrbnd
521               + energies.evdw + energies.e14 + energies.ehbond + energies.eu + energies.eangang +
522 <               energies.estrtor + energies.eimprop + energies.eimptors + energies.eopb + energies.eurey + energies.esolv;
522 >               energies.estrtor + energies.eimprop + energies.eimptors + energies.eopb + energies.eurey + energies.esolv + energies.egeom;
523        etot = energies.total;
524        
525        return (etot);
# Line 614 | Line 601
601                     }
602                     if (cbonds.nbnd > MAXCBND)
603                     {
604 <                      fprintf(pcmoutfile,"Error - Too many coordinated bonds!\nProgram will now quit.\n");
604 >                      fprintf(pcmlogfile,"Error - Too many coordinated bonds!\nProgram will now quit.\n");
605                         exit(0);
606                     }
607                 }
# Line 654 | Line 641
641                bonds_ff.nbnd++;
642                if (bonds_ff.nbnd > MAXBND)
643                {
644 <                 fprintf(pcmoutfile,"Error - Too many bonds!\nProgram will now quit.\n");
644 >                 fprintf(pcmlogfile,"Error - Too many bonds!\nProgram will now quit.\n");
645                   exit(0);
646                 }
647             }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines