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

From: RonitS Chem (ronits.chem95_at_gmail.com)
Date: Tue May 03 2022 - 16:39:56 CDT

Hello Marcelo,

I have tried it both ways, one by increasing the stride and also by
providing a separate point charge file but the same problem persists. QChem
is called twice and runs both times successfully, which is confirmed by
looking at the QChem output files (run both manually and through
run_qchem.py). I also double checked the python script and the QChem output
is consistent with how the script reads it, no format changes. On a bit
more prodding, the following error message was printed,

[e09-18:12328:0:12328] Caught signal 11 (Segmentation fault: address not
mapped to object at address 0xc0)

==== backtrace (tid: 12328) ====

 0 0x00000000000532a3 ucs_debug_print_backtrace()
/build/csul/spack-stage-ucx-1.8.0-o6fhjkqszinevp3soi5szm76tkw3tjl2/spack-src/src/ucs/debug/debug.c:625

 1 0x0000000000036400 killpg() ???:0

 2 0x00000000007437c9 ComputeNonbondedUtil::calc_pair() ???:0

 3 0x000000000073dcf3 ComputeNonbondedPair::doForce() ???:0

 4 0x00000000009c4df4 ComputePatchPair::doWork() ???:0

 5 0x0000000000bcbb0d WorkDistrib::enqueueWork() WorkDistrib.C:0

 6 0x0000000000dce02f CkDeliverMessageFree() ???:0

 7 0x0000000000dce8a3 _invokeEntry() ck.C:0

 8 0x0000000000dd2d7e _processHandler() ???:0

 9 0x0000000000eb1fbe CsdScheduleForever() ???:0

10 0x0000000000eb2275 CsdScheduler() ???:0

11 0x0000000000b8f733 ScriptTcl::Tcl_run() ???:0

12 0x000000000003c88b TclInvokeStringCommand() ???:0

13 0x0000000000041427 TclNRRunCallbacks() ???:0

14 0x0000000000043289 TclEvalEx() :0

15 0x00000000000f8af8 Tcl_FSEvalFileEx() ???:0

16 0x00000000000f8c77 Tcl_EvalFile() ???:0

17 0x0000000000b92582 ScriptTcl::load() ???:0

18 0x0000000000699082 after_backend_init() mainfunc.C:0

19 0x000000000061ee77 main() ???:0

20 0x0000000000022555 __libc_start_main() ???:0

21 0x0000000000621b4f _start() ???:0

=================================

--------------------------------------------------------------------------

Primary job terminated normally, but 1 process returned

a non-zero exit code. Per user-direction, the job has been aborted.

--------------------------------------------------------------------------

--------------------------------------------------------------------------

mpirun noticed that process rank 0 with PID 12328 on node e09-18 exited on
signal 11 (Segmentation fault).

--------------------------------------------------------------------------

Sadly, I'm not at all familiar with what might be causing this issue and I
have tried running it with - charmrun namd2 +p1 <input>.conf > test.out command
but the error persists (I assumed it to be some type of parallelization
issue). Please let me know what could be causing this. Thank you.

Best,

Ronit

On Mon, May 2, 2022 at 4:52 PM Marcelo C. R. Melo <melomcr_at_gmail.com> wrote:

> 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
> simulations.
> 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 NAMD+run_qchem.py 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 run_qchem.py 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.
>
> Best,
> Marcelo
>
> On Mon, May 2, 2022 at 6:48 PM RonitS Chem <ronits.chem95_at_gmail.com>
> 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 <melomcr_at_gmail.com>
>> 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 script.py"), 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 <ronits.chem95_at_gmail.com>
>>> 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 (qmmm.in.out) 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/run_qchem.py", 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 <melomcr_at_gmail.com>
>>>> 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 <ronits.chem95_at_gmail.com>
>>>>> 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