3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * GROwing Monsters And Cloning Shrimps
65 #include "gmx_fatal.h"
70 /* mopac interface routines */
73 #define F77_FUNC(name,NAME) name ## _
78 F77_FUNC(domldt
,DOMLDT
)(int *nrqmat
, int labels
[], char keywords
[]);
81 F77_FUNC(domop
,DOMOP
)(int *nrqmat
,double qmcrd
[],int *nrmmat
,
82 double mmchrg
[],double mmcrd
[],double qmgrad
[],
83 double mmgrad
[], double *energy
,double qmcharges
[]);
87 void init_mopac(t_commrec
*cr
, t_QMrec
*qm
, t_MMrec
*mm
)
89 /* initializes the mopac routines ans sets up the semiempirical
90 * computation by calling moldat(). The inline mopac routines can
91 * only perform gradient operations. If one would like to optimize a
92 * structure or find a transition state at PM3 level, gaussian is
100 if(!qm
->bSH
){ /* if rerun then grad should not be done! */
101 sprintf(keywords
,"PRECISE GEO-OK CHARGE=%d GRAD MMOK ANALYT %s\n",
103 eQMmethod_names
[qm
->QMmethod
]);
106 sprintf(keywords
,"PRECISE GEO-OK CHARGE=%d SINGLET GRAD %s C.I.=(%d,%d) root=2 MECI \n",
108 eQMmethod_names
[qm
->QMmethod
],
109 qm
->CASorbitals
,qm
->CASelectrons
/2);
110 F77_FUNC(domldt
,DOMLDT
)(&qm
->nrQMatoms
,qm
->atomicnumberQM
,keywords
);
111 fprintf(stderr
,"keywords are: %s\n",keywords
);
116 real
call_mopac(t_commrec
*cr
, t_forcerec
*fr
, t_QMrec
*qm
, t_MMrec
*mm
,
117 rvec f
[], rvec fshift
[])
119 /* do the actual QMMM calculation using directly linked mopac subroutines
121 double /* always double as the MOPAC routines are always compiled in
122 double precission! */
123 *qmcrd
=NULL
,*qmchrg
=NULL
,*mmcrd
=NULL
,*mmchrg
=NULL
,
124 *qmgrad
,*mmgrad
=NULL
,energy
;
129 snew(qmcrd
, 3*(qm
->nrQMatoms
));
130 snew(qmgrad
,3*(qm
->nrQMatoms
));
131 /* copy the data from qr into the arrays that are going to be used
132 * in the fortran routines of MOPAC
134 for(i
=0;i
<qm
->nrQMatoms
;i
++){
136 qmcrd
[3*i
+j
] = (double)qm
->xQM
[i
][j
]*10;
140 /* later we will add the point charges here. There are some
141 * conceptual problems with semi-empirical QM in combination with
142 * point charges that we need to solve first....
144 gmx_fatal(FARGS
,"At present only ONIOM is allowed in combination"
145 " with MOPAC QM subroutines\n");
148 /* now compute the energy and the gradients.
151 snew(qmchrg
,qm
->nrQMatoms
);
152 F77_FUNC(domop
,DOMOP
)(&qm
->nrQMatoms
,qmcrd
,&mm
->nrMMatoms
,
153 mmchrg
,mmcrd
,qmgrad
,mmgrad
,&energy
,qmchrg
);
154 /* add the gradients to the f[] array, and also to the fshift[].
155 * the mopac gradients are in kCal/angstrom.
157 for(i
=0;i
<qm
->nrQMatoms
;i
++){
159 f
[i
][j
] = (real
)10*CAL2JOULE
*qmgrad
[3*i
+j
];
160 fshift
[i
][j
] = (real
)10*CAL2JOULE
*qmgrad
[3*i
+j
];
163 QMener
= (real
)CAL2JOULE
*energy
;
164 /* do we do something with the mulliken charges?? */
173 real
call_mopac_SH(t_commrec
*cr
, t_forcerec
*fr
, t_QMrec
*qm
, t_MMrec
*mm
,
174 rvec f
[], rvec fshift
[])
176 /* do the actual SH QMMM calculation using directly linked mopac
179 double /* always double as the MOPAC routines are always compiled in
180 double precission! */
181 *qmcrd
=NULL
,*qmchrg
=NULL
,*mmcrd
=NULL
,*mmchrg
=NULL
,
182 *qmgrad
,*mmgrad
=NULL
,energy
;
188 snew(qmcrd
, 3*(qm
->nrQMatoms
));
189 snew(qmgrad
,3*(qm
->nrQMatoms
));
190 /* copy the data from qr into the arrays that are going to be used
191 * in the fortran routines of MOPAC
193 for(i
=0;i
<qm
->nrQMatoms
;i
++){
195 qmcrd
[3*i
+j
] = (double)qm
->xQM
[i
][j
]*10;
199 /* later we will add the point charges here. There are some
200 * conceptual problems with semi-empirical QM in combination with
201 * point charges that we need to solve first....
203 gmx_fatal(FARGS
,"At present only ONIOM is allowed in combination with MOPAC\n");
206 /* now compute the energy and the gradients.
208 snew(qmchrg
,qm
->nrQMatoms
);
210 F77_FUNC(domop
,DOMOP
)(&qm
->nrQMatoms
,qmcrd
,&mm
->nrMMatoms
,
211 mmchrg
,mmcrd
,qmgrad
,mmgrad
,&energy
,qmchrg
);
212 /* add the gradients to the f[] array, and also to the fshift[].
213 * the mopac gradients are in kCal/angstrom.
215 for(i
=0;i
<qm
->nrQMatoms
;i
++){
217 f
[i
][j
] = (real
)10*CAL2JOULE
*qmgrad
[3*i
+j
];
218 fshift
[i
][j
] = (real
)10*CAL2JOULE
*qmgrad
[3*i
+j
];
221 QMener
= (real
)CAL2JOULE
*energy
;
226 } /* call_mopac_SH */
230 gmx_qmmm_mopac_empty
;