sharc-md / sharc

The SHARC molecular dynamics (MD) program suite is an ab initio MD software package developed to study the excited-state dynamics of molecules.
https://www.sharc-md.org
GNU General Public License v3.0
70 stars 38 forks source link

Error in SHARC ORCA-Tinker QM/MM tests #66

Closed debarshibanerjee closed 1 year ago

debarshibanerjee commented 1 year ago

Dear SHARC developers,

I am new to using SHARC and after installing it I got some errors running the QM/MM tests with the ORCA-Tinker 6.3.3 interface. I compiled Tinker using the Molcas 'get_tinker' script and I have the 'tkr2qm_s' executable. My ORCA version is 5.0.4.

The error is in the QM part as seen in 'RUNNING_TESTS/ORCA_TINKER_qmmm/output.log':

=============================================================
 QM call was not successful, aborting the run.
 Error code:         3072
 =============================================================

Upon further inspection of the QM subdirectory in 'RUNNING_TESTS/ORCA_TINKER_qmmm/QM', I see the following in 'QM.log':

>>>>>>>>>>>>> Reading output files
Energy:   /leonardo_wo...rshi/scratch/WORK/master_1/ORCA.log
Dipoles:  /leonardo_wo...rshi/scratch/WORK/master_1/ORCA.log
Dipoles:  /leonardo_wo...rshi/scratch/WORK/master_1/ORCA.log
Dipoles:  /leonardo_wo...rshi/scratch/WORK/master_1/ORCA.log
Gradient: /leonardo_wo...aster_1/ORCA.engrad.ground.grad.tmp
File /leonardo_work/ICT23_CMSP_0/debarshi/scratch/WORK/master_1/ORCA.pcgrad.ground does not exist!

I think my $ORCA, $TINKER, $SHARC variables are set correctly, since some of the tests are 'successful' and some have 'different output lengths', but only give some numerical differences.

Please tell me if I am doing something wrong to cause this error. Thanks for your help!

maisebastian commented 1 year ago

Dear Debarshi Banerjee, I was able to reproduce this error. It seems that ORCA does not produce the file ORCA.pcgrad.ground anymore (at least in ORCA 5.0.4 and 5.0.1). You can fix the error by adding two lines of code in SHARC_ORCA.py after line 4533:

4533 if QMin['qmmm']: 4534 if 'ground' in fname: 4535 fname = '' 4536 logfile = os.path.join(QMin['scratchdir'], path, 'ORCA.pcgrad' + fname) 4537 gpc = getpcgrad(logfile, QMin)

This will read the gradient in ORCA.pcgrad as the ground state gradient. For the test calculation, this seems to be the correct choice. However, in general one would need to verify that this file always contains the ground state gradient (and not, e.g., the last computed gradient)! I recommend that you make a test trajectory in the ground state and check total energy conservation before proceeding.

Best regards, Sebastian

debarshibanerjee commented 1 year ago

Hi Sebastian,

Thanks a lot for your response. I made the suggested change and now I get the following error in QM.err and the test suite says that the job did not finish:

Traceback (most recent call last):
  File "/leonardo_work/ICT23_CMSP_0/debarshi/software/sharc-3.0.1/bin/SHARC_ORCA.py", line 5280, in <module>
    main()
  File "/leonardo_work/ICT23_CMSP_0/debarshi/software/sharc-3.0.1/bin/SHARC_ORCA.py", line 5244, in main
    errorcodes = runjobs(schedule, QMin)
  File "/leonardo_work/ICT23_CMSP_0/debarshi/software/sharc-3.0.1/bin/SHARC_ORCA.py", line 2888, in runjobs
    saveFiles(WORKDIR, jobset[job])
  File "/leonardo_work/ICT23_CMSP_0/debarshi/software/sharc-3.0.1/bin/SHARC_ORCA.py", line 3398, in saveFiles
    saveMolden(WORKDIR, QMin)
  File "/leonardo_work/ICT23_CMSP_0/debarshi/software/sharc-3.0.1/bin/SHARC_ORCA.py", line 3453, in saveMolden
    shutil.copy(fromfile, tofile)
  File "/leonardo_work/ICT23_CMSP_0/debarshi/software/mambaforge/lib/python3.10/shutil.py", line 417, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/leonardo_work/ICT23_CMSP_0/debarshi/software/mambaforge/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/leonardo_work/ICT23_CMSP_0/debarshi/scratch/WORK/master_1/ORCA.molden.input'

Any help will be greatly appreciated!

debarshibanerjee commented 1 year ago

In the WORK/master_1 directory, it says in 'orca_2mkl.err' that Reading the input file ORCA.gbw ... [file orca_2mkl/orca_2mkl.cpp, line 130]: No orbitals were found in the gbw file

I'm not sure if this is the problem, but thought of mentioning it.

maisebastian commented 1 year ago

Hi Debarshi, this seems to be an unrelated problem. It is a bit surprising, because after the change I told you, the test was running through for me (full 3 fs).

From your error messages, the problem seems to happen when the interface tries to make Molden files using orca_2mkl out of the gbw files. Apparently, something happened so that the gbw file does not contain orbitals. Maybe the SCF did not converge, although that would be strange. The error is especially strange since you previously had an error in the output file parsing, which comes later in the code than the saving of the Molden files.

Was the error occurring in the first calculation or in a later time step? Can you please check the orca.log in the scratch area to see whether the ORCA job was doing fine? Please also check SCF convergence. A second test would be to run the test again in a separate directory with separate scratch, to avoid any interactions with the previous run.

debarshibanerjee commented 1 year ago

A second test would be to run the test again in a separate directory with separate scratch, to avoid any interactions with the previous run.

This ultimately worked. There was some weird problem otherwise, I should have maybe tried the simplest solution first :)

Thanks a lot for your help, Sebastian! I am closing the issue.