Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gaussian / xtb interface that provides Hessians #329

Open
clavigne opened this issue Aug 18, 2020 · 11 comments · May be fixed by #363
Open

Gaussian / xtb interface that provides Hessians #329

clavigne opened this issue Aug 18, 2020 · 11 comments · May be fixed by #363
Labels
external Issues related to external programs depending on this project

Comments

@clavigne
Copy link
Contributor

xtb currently ships with a preliminary interface to Gaussian. However, the basic interface doesn't include the ability to pass Hessian information, which is critical for some optimization problems (such as finding transition states), and can be used to improve the speed of Gaussian's own ab initio optimizations by reading xtb Hessians as initial Hessian guesses. In addition, the current xtb-gaussian interface is a bit fragile with respect to paths for input-output files.

For work we are currently engaged in, I coded a basic single-file Perl script that addresses these problems (based on an earlier Python version by @kjelljorner and @gabegomes ). It's located here, it's pretty robust and quite fast. It doesn't use any external perl packages so it should just work out of the box.

I currently have it licensed under MIT, meaning you can just integrate it directly in xtb if you want. I considered submitting it as a PR but I wasn't sure what your opinions are on introducing Perl code or on interop with Gaussian. If you are interested, I can probably write the necessary fortran code to move the feature into xtb proper, but I'm not sure when I will have time to do so.

Thanks for the great program!

@awvwgk
Copy link
Member

awvwgk commented Aug 18, 2020

I guess, I start with my usual Gaussian disclaimer. Since I don't have access to Gaussian, I can't test any compatibility features.™

Leaving that aside, thanks for writing this up. Not sure if I want to include something I can't officially support, but I think a link from the documentation, similar to the Orca interface is possible.

Also, I would prefer to fix issues in the xtb codebase first before working around them in a wrapper script, looks like you identified some. Most should be straight-forward to implement in xtb leaving the wrapper script with the job of reshuffling the commandline arguments.

The information used to infer whether Gaussian specific output should be written or not is currently stored in the input file type and accessible everywhere the molecular structure is available:

xtb/src/prog/main.F90

Lines 800 to 809 in 0a0ed2c

if (mol%ftype .eq. fileType%gaussian) then
if (allocated(basename)) then
cdum = basename // '.EOu'
else
cdum = 'xtb-gaussian.EOu'
end if
call open_file(ich, cdum, 'w')
call writeResultsGaussianExternal(ich, etot, res%dipole, g)
call close_file(ich)
end if

@clavigne
Copy link
Contributor Author

Oh that actually looks way easier than I thought, thanks for the pointer. I guess I can just match the turbomole code by adding fres to writeResultsGaussianExternal?

That's probably what I should have done from the get go :D I'll PR it when it's ready and tested.

@awvwgk
Copy link
Member

awvwgk commented Aug 18, 2020

For the hessian it dependents on what Gaussian is expecting, a non-massweighted unprojected hessian is written here:

xtb/src/hessian.F90

Lines 475 to 478 in 0a0ed2c

if (pr_dftbp_hessian_out) then
call writeHessianOut('hessian.out', res%hess)
write(env%unit, '(A)') "DFTB+ style hessian.out written"
end if

The projected variant is written a few lines later:

xtb/src/hessian.F90

Lines 493 to 497 in 0a0ed2c

! non mass weigthed Hessian in hss
hname = 'hessian'
write(env%unit,'(a)')
write(env%unit,'("writing file <",a,">.")') hname
call wrhess(n3,hss,hname)

The frequency results object contains only the normal modes and frequencies, it might be necessary to cache the unmodified second deriviatives as well for this purpose.

@TinacciL
Copy link

TinacciL commented Nov 3, 2020

I'm try to test the xtb (6.3.2) interface with gaussian.
The input *.EIn from external guassian it is read well from xtb but the *.EOu external gaussian output (as it present in writeResultsGaussianExternal) it is not created in the working directory.
I'm testing only with the --grad command at the moment, above the line I used in the shell:
**xtb *.EIn --grad **

Sorry for the dummy question, I tried many way to solve this issue without success.

Really thanks for the great program and methods!

@gabegomes

This comment has been minimized.

@clavigne
Copy link
Contributor Author

clavigne commented Nov 3, 2020

Hey so I believe this is the issue fixed by #362 which is not yet in a released version. If that's the case, your folder should contain a file with name .EOu that will be revealed by ls -a

If that is the case, putting a / in the path ( running xtb ./file.Ein) should work.

@TinacciL
Copy link

TinacciL commented Nov 3, 2020

It was hidden in the directory! Everything works now.

Thansk for the hint and the great job you did on interfacing the hessian in the guassian external format!

@awvwgk awvwgk added the external Issues related to external programs depending on this project label Nov 18, 2020
@MiloCheng17
Copy link

I saw this post and just want to ask is there a way I can run transition structure optimization in xtb? Or is there a way I can calculate hessian using xtb and feed to gaussian to do the transition structure optimization (as in Gaussian there is keyword TS for opt)?

@awvwgk
Copy link
Member

awvwgk commented Mar 5, 2021

xtb does not provide a TS optimizer yet, the closest feature we support is an interface to the growing string method (see https://xtb-docs.readthedocs.io/en/latest/gsm.html). Also the QC package Orca does have an interface to xtb which allows TS optimization and IRC methods.

For Gaussian I can't offer any support here.

@gabegomes
Copy link

I can attest that it does indeed work with Gaussian and all of its TS tools. In fact, that’s one of the applications that we envisioned from the start and I have been using it for that for a while now. Good luck with your tests!

@MiloCheng17
Copy link

Thank you for your comments. I have tried the gsm with the example, but I got Segmentation fault, don't really know what is the problem. @gabegomes Can you share with more details, an example how to run your calculations for TS optimization will be really helpful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Issues related to external programs depending on this project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants