Re: How to qm/mm calculations with NAMD-QChem

From: Marcelo C. R. Melo (
Date: Mon May 02 2022 - 18:51:55 CDT

Hi Ronit,

Point charge *positions* will always be updated at every step. The
stride and the explicit PC selection are mutually excludent. You either ask
NAMD to find the nearest point charges (every step or with a stride), or
you select PCs yourself and NAMD will never change the selection during the
Unfortunately, NAMD cannot check for all possible errors in all possible QM
packages, so you should check error messages from the QM package itself.

Equilibration/stability problems are by far the most common ones. Since
your output shows that QChem is being called and executed
successfully (with at least one converged SCF), and that the QM output of
at least one step is parsed and integrated into the MD, I still think
stability is the most likely cause of your problem.

That said, the segfault is strange and could point to a problem in the
interface between NADM and QChem. Maybe a new version of qchem is producing
an outputfile that changes in format during the simulations (this happened
with MOPAC a while back, where the number of digits in atom coordinates
could change). This may be incompatible with this python wrapper script,
and will require a modification in the python script. To test this case, I
would suggest getting the QM input/output created by and
check if you can run it independently (outside NAMD, directly in QChem).
Then check it through the python wrapper. You can compare it with the NAMD
QM/MM tutorial files. If there is a format change, the may
need to be updated.

Regarding the debug level, I am not sure about run-time options, but there
are compile-time options you could use to compile NAMD with extra
verbosity, exactly for debug purposes. You can use DEBUG to increase output
across all NAMD, or DEBUG_QM for extra verbosity in this section alone.
This will produce *a lot* of output. It may be a step too far, but I just
wanted to let you know the possibility exists, but does require
re-compiling the software.


On Mon, May 2, 2022 at 6:48 PM RonitS Chem <> wrote:

> Hello Marcelo,
> Thank you for the detailed explanation. I assumed my system was
> sufficiently equilibrated but I will do as you suggest. The issue is that
> the simulation crashes with a segfault at that exact step every single
> time, regardless of the starting configuration. The lack of error messages
> in either NAMD or QChem also made pinpointing the issue difficult. Since
> running the calculation with a semi-empirical method is not an option for
> my project, I will try the following things and let you know,
> 1. Modify PC selection with stride and explicit PC file - I assume the
> positions of the PC atoms will be updated and I don't have to provide a new
> file at every timestep.
> 2. Equilibrate my system for a longer time before starting the qmmm step.
> Related question, is there a debug or verbose option in NAMD, where I can
> get more information about what is going on? I looked around found the
> "++debug" option but that doesn't seem to print additional info. Please
> let me know.
> Best,
> Ronit
> On Mon, May 2, 2022 at 2:08 PM Marcelo C. R. Melo <>
> wrote:
>> Hi Ronit,
>> 1. The default behaviour is to constantly update the point charges so as
>> to give the QM calculation a precise picture of the environment of the QM
>> region during the MD simulation. You can control how often this point
>> charge update occurs, if you determine that the selection should not change
>> often. This can be done with the keyword "qmPCStride".
>> If you do not want any update at all, and instead want to define point
>> charges yourself using a separate PDB file, you can use the keyword
>> "qmCustomPCSelection". Please check the documentation for the keywords in
>> either case.
>> 2. I usually make the script executable (in linux, that would mean
>> "chmod +x"), so that it can be called and executed
>> directly, without the "python" call. But if you have it working like this
>> (as your output suggests) I would not change it.
>> From your first email, it seems that you have a QMMM simulation crashing
>> early and often. The most common source of this problem is an unstable
>> system. QM calculations are extremely fragile, so "unstable" here could
>> mean one or two atoms moving a little too fast, and preventing the QM
>> package from converging after only a few MD steps. The solution is usually
>> to further equilibrate the system with classical MD before switching QM/MM
>> on, or running a QMMM equilibration with a semi empirical (more forgiving)
>> method.
>> Let me know how that goes!
>> Best,
>> Marcelo
>> On Mon, May 2, 2022 at 12:24 AM RonitS Chem <>
>> wrote:
>>> Hello,
>>> I sincerely apologize since the previous email got cut off before I
>>> could explain the issue. I have attached the NAMD output file (test.out),
>>> the QChem output file ( and the qmmm_0.input.result file. There
>>> is no qmmm_0.input.TmpOut generated. As I was saying in my previous
>>> email, in the portion that got cut off, I have a few questions about the
>>> implementation,
>>> 1. In the NAMD output file I print the number of QM atoms (numQMatms)
>>> and the number of point charges (numPntChr) and the latter seems to
>>> vary in different QChem calls. How are the point charges selected?
>>> 2. In the qmExecPath keyword I have "python /path/to/", is
>>> that the correct way to set up this type of calculation since qmSoftware is
>>> custom?
>>> Please let me know if you require any further information. Thank you
>>> for your help.
>>> Best,
>>> Ronit
>>> On Sun, May 1, 2022 at 8:50 PM Marcelo C. R. Melo <>
>>> wrote:
>>>> Hi Ronit,
>>>> From your email it is hard to tell what could be going on.
>>>> Can you share the output files from NAMD and from QChem itself (
>>>> qmmm_0.input.TmpOut)?
>>>> Best,
>>>> Marcelo
>>>> On Sun, May 1, 2022 at 7:07 PM RonitS Chem <>
>>>> wrote:
>>>>> Hello all,
>>>>> I was trying to run qm/mm calculations using the NAMD-QChem with the
>>>>> python
>>>>> wrapper provided. However, NAMD crashes at the exact same step
>>>>> everytime I
>>>>> try to run any calculation. The step is as described below, taken
>>>>> directly
>>>>> from the output file but redacted for brevity,
>>>>> TCL: Running for 2000000 steps
>>>>> Info: List of ranks running QM simulations: 0.
>>>>> You are running Q-Chem version: 5.4.2
>>>>> #
>>>>> # job setting
>>>>> # .
>>>>> # .
>>>>> # qchem directory setting
>>>>> # .
>>>>> # .
>>>>> # parallel setting
>>>>> # .
>>>>> numQMatms: 7 ; numPntChr 1488
>>>>> Sum of the charges: -1.7763568394002505e-15
>>>>> command: cd

This archive was generated by hypermail 2.1.6 : Tue Dec 13 2022 - 14:32:44 CST