# The energy of the whole system in a QMMM simulation

jts2t... at gmail.com jts2t... at gmail.com
Mon Sep 11 05:59:06 UTC 2017

```Hi Jadzia,

I don't major in physical or chemistry, so what you have suggested confused
me for a long time. My example comes from the following page:
https://www.cp2k.org/exercises:2017_ethz_mmm:qmmm
.

The simulation uses the same molecular model (as far as I know, it's true)
for the MM region (I use the same potential function through 1-layer
simulation and 2-layer simulation and more). Does it mean the model can
compare now ?

Besides, the energy of the 1-layer and 2-layer and even more-layer
simulation is nearly geometric series. If energy of 1-layer is 1, then the
energy of 2-layer is almost 2, and 3 of 3-layer. It makes me consider the
energy belongs to the QM region. Hence, I want to know how to calculate the
whole energy of the system.

Or the geometric series is just a coincidence ? There is some mistake in my
understanding ?

>
> Hello again,
>
> in the case that you mean that you are using a different number of QM
> atoms, a significant energy difference can be expected. The reason is that
> different molecular models assign different energies to the same
> atoms/molecules. In particular QM atoms/molecules often have a much lower
> energy than MM atoms. QM models for instance usually include the
> electron-nuclei interactions explicitly while MM models do not, therefore
> you usually cannot directly compare the total energy of different molecular
> models even if the system is the same. If you shift the scale properly
> between the different models, then a comparison should be possible in
> theory, but I have not experience with that.
>
> Best wishes,
>
>
>
> On Sunday, September 10, 2017 at 5:24:40 PM UTC+2, jts2... at gmail.com
> wrote:
>>
>> Hi, Matt, bother you again.
>>
>> The real problem I want to figure out is, when I set 1-layer QM atoms,
>> the energy is
>> Total FORCE_EVAL ( QMMM ) energy (a.u.):           -351.508815087281562
>>
>> While I set 2-layer QM-atoms, the energy is
>> Total FORCE_EVAL ( QMMM ) energy (a.u.):           -696.366434340290539
>>
>> What bother me is that the energy should be almost the same, but the fact
>> is that they differ nearly twice.
>> So I want to know if there is some mistake in my understanding, or is
>> there some mistake in my setting ?
>>
>> 在 2017年9月8日星期五 UTC+8下午5:14:30，Matt W写道：
>>>
>>> The line I suggested _is_ the total energy QM + MM + QM-MM
>>>
>>> If you set print level medium you should see something like
>>>
>>>  QMMM| Evaluating forces on MM atoms due to the:
>>>  QMMM| - QM/MM Coupling computed collocating the Gaussian Potential
>>> Functions.
>>>  QMMM| QM/MM Nuclear Electrostatic Potential :
>>>  -0.210189515
>>>  QMMM| QMMM Total Energy (QM + QMMM electronic + QMMM nuclear):
>>> -694.056114328
>>>  QMMM| MM energy NOT included in the above term! Check for:  FORCE_EVAL
>>> ( QMMM )
>>>  QMMM| that includes both QM, QMMM and MM energy terms!
>>>
>>>  ENERGY| Total FORCE_EVAL ( QMMM ) energy (a.u.):
>>> -696.223035107415399
>>>
>>> Which gives the energy with and without the MM energy - so you can
>>> figure out the MM energy.
>>>
>>>
>>> On Friday, September 8, 2017 at 6:45:52 AM UTC+1, jts2... at gmail.com
>>> wrote:
>>>>
>>>> Hi, Matt,
>>>>
>>>> I did as you suggest, then I typed in the command 'grep energy *.out'.
>>>> But the results said
>>>>
>>>> QMMM | MM energy NOT included in the above term! Check for:
>>>> FORCE_EVAL(QMMM) that includes both QM, QMMM and MM energy terms !
>>>>
>>>> So I still didn't get the MM energy message.
>>>>
>>>> As far as my understanding, I should add something else in the &MM
>>>> section, maybe an additional &FORCE_EVAL to output the information of MM
>>>> region ?
>>>> Or there is something important ignored ?
>>>>
>>>> 在 2017年9月8日星期五 UTC+8上午4:16:40，Matt W写道：
>>>>>
>>>>> At each step of a geo_opt run you should see something like
>>>>>
>>>>> ENERGY| Total FORCE_EVAL ( QMMM ) energy (a.u.):
>>>>> -696.237954025524573
>>>>>
>>>>> after all the QS output, that gives you the total energy of the system
>>>>> (at least if print_level is medium)
>>>>>
>>>>> On Thursday, September 7, 2017 at 6:33:03 PM UTC+1, Jadzia wrote:
>>>>>>
>>>>>> I am not sure if the question is really "where the file is" since it
>>>>>> will most likely be nowhere. And to be honest I don't know how to write a
>>>>>> similar file for the energies for geo_opt as for MD simulations since only
>>>>>> in the MD section there seems to be this print option, which might not be
>>>>>> used during geo_opt (not sure about it).
>>>>>>
>>>>>> But a workaround might be as follows: One can run cp2k with the -o
>>>>>> option to store the output of the geometry optimization in a file, and then
>>>>>> one could grep the energy out of that file.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thursday, September 7, 2017 at 5:05:04 PM UTC+2,
>>>>>> jts2... at gmail.com wrote:
>>>>>>>
>>>>>>> Thanks for your suggestion, which works well in a example in
>>>>>>> official website, but fails in another case.
>>>>>>>
>>>>>>> I run a GEO_OPT simulation using QMMM method,  the original
>>>>>>> motion.inc is as follows
>>>>>>> &MOTION
>>>>>>>   &GEO_OPT
>>>>>>>      OPTIMIZER LBFGS
>>>>>>>   &END
>>>>>>>   &CONSTRAINT
>>>>>>>      &FIXED_ATOMS
>>>>>>>      LIST 1..16
>>>>>>>      EXCLUDE_MM .TRUE.
>>>>>>>      EXCLUDE_QM .FALSE.
>>>>>>>      &END FIXED_ATOMS
>>>>>>>   &END CONSTRAINT
>>>>>>> &END MOTION
>>>>>>>
>>>>>>> Then I added the MD section, they became
>>>>>>> &MOTION
>>>>>>>   &GEO_OPT
>>>>>>>      OPTIMIZER LBFGS
>>>>>>>   &END
>>>>>>>   &CONSTRAINT
>>>>>>>      &FIXED_ATOMS
>>>>>>>      LIST 1..16
>>>>>>>      EXCLUDE_MM .TRUE.
>>>>>>>      EXCLUDE_QM .FALSE.
>>>>>>>      &END FIXED_ATOMS
>>>>>>>   &END CONSTRAINT
>>>>>>>   &MD
>>>>>>> &PRINT
>>>>>>> &ENERGY
>>>>>>> FILENAME=total.ener
>>>>>>>  &EACH
>>>>>>>    GEO_OPT 1
>>>>>>>  &END EACH
>>>>>>> &END ENERGY
>>>>>>> &END PRINT
>>>>>>>   &END MD
>>>>>>> &END MOTION
>>>>>>>
>>>>>>> The strange thing is that there wasn't any file named *total.ener*
>>>>>>> in the current directory. Where is the question ?
>>>>>>> The &EACH section is not correct ?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> To my understanding if you want to write the total energy to a file
>>>>>>>> for instance for an MD simulation you need to add a section similar to:
>>>>>>>>
>>>>>>>>  &MOTION
>>>>>>>>    &MD
>>>>>>>>     &PRINT
>>>>>>>>       &ENERGY
>>>>>>>>         FILENAME =cp2k.out.energy
>>>>>>>>           &EACH
>>>>>>>>             MD 10
>>>>>>>>           &END EACH
>>>>>>>>       &END ENERGY
>>>>>>>>     &END PRINT
>>>>>>>>   &END MD
>>>>>>>> &END MOTION
>>>>>>>>
>>>>>>>> In this example the energy of every tenth step is written to the
>>>>>>>> file, and is independent of the type of force evaluation (MM, QM, QM/MM,
>>>>>>>> ...).
>>>>>>>>
>>>>>>>> Here is the corresponding section in the manual:
>>>>>>>> https://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/MD/PRINT/ENERGY/EACH.html
>>>>>>>>
>>>>>>>> Hope this helps,
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wednesday, September 6, 2017 at 8:31:10 AM UTC+2,
>>>>>>>> jts2... at gmail.com wrote:
>>>>>>>>>
>>>>>>>>> Dear researchers and developers,
>>>>>>>>>
>>>>>>>>> I am not so familiar with CP2K. After I run a QMMM simulation of
>>>>>>>>> KCl just as here:
>>>>>>>>> https://www.cp2k.org/exercises:2017_ethz_mmm:qmmm, I want to know
>>>>>>>>> the energy of the whole system not just the energy of the QM region, how to
>>>>>>>>> achieve it in the input setting?
>>>>>>>>>
>>>>>>>>> I'll appreciate for your apply !
>>>>>>>>>
>>>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20170910/1decd614/attachment.htm>
```