QUICK icon indicating copy to clipboard operation
QUICK copied to clipboard

DL-FIND constrained geometry optimization

Open akhilshajan opened this issue 1 year ago • 6 comments

I have added DL-Find feature for constrained geometry optimization.

# Example input for DL-FIND constraint integration in QUICK
HF BASIS=3-21G CONSTRAIN OPTIMIZE

C         -4.13498124  0.70342204  0.00000000
H         -3.53650966  -0.16516720  -0.17967886
H         -4.07172084  1.36057017  -0.84205371
H         -5.15338585  0.41046458  0.14808100
C         -3.62163902  1.42937832  1.25740497
H         -3.68306794  2.48719615  1.10858318
H         -4.22133413  1.15219316  2.09909028
H         -2.60384227  1.15314360  1.43819258

DIHEDRAL 2 1 5 6

The syntax for implementing constraints within QUICK closely mirrors established conventions in other QM packages:

FREEZEXY atom_no_1 DISTANCE atom_no_1 atom_no_2 ANGLE atom_no_1 atom_no_2 atom_no_3 DIHEDRAL atom_no_1 atom_no_2 atom_no_3 atom_no_4

Commands such as DISTANCE, ANGLE, and DIHEDRAL enable straightforward specification of constraints, streamlining the optimization process. These constraints operate within the default internal coordinate system (ICOORD=3) of QUICK, simplifying the setup process for users familiar with similar packages.

The freeze atom commands (FREEZE, FREEZEX, FREEZEY, FREEZEZ, FREEZEXY, FREEZEXZ, FREEZEYZ) provide fine-grained control over molecular configurations, enhancing the precision and accuracy of simulations. The freeze atom functionality is compatible with Cartesian coordinate systems (ICOORD=0)of QUICK.

akhilshajan avatar May 02 '24 18:05 akhilshajan

@akhilshajan , I just tested this branch. Serial CPU and CUDA versions work fine; but not the MPI versions. Please check the attached zip file below. ethane.zip

Madu86 avatar May 02 '24 21:05 Madu86

Can you also add a test case to the test suite?

Madu86 avatar May 02 '24 21:05 Madu86

Thank you Madu. I will check the error with MPI and add the test case with the test you tried out for constrained geometry optimization.

akhilshajan avatar May 03 '24 01:05 akhilshajan

Hi @akhilshajan, were you able to find this issue in the MPI version? Let me know if you need help.

Madu86 avatar May 22 '24 15:05 Madu86

Hi @Madu86, thanks with the help for MPI. I have tested with CUDA and CUDA-MPI. It is working perfectly now. I believe we can merge this branch.

ethane.zip

akhilshajan avatar Jul 09 '24 21:07 akhilshajan

Thanks @akhilshajan. We will test this soon.

Madu86 avatar Jul 10 '24 13:07 Madu86

I've had less success here. I grabbed the code from [akhilshajan:QUICK_Constrained_Optimization], built and tested it with the sample input above (and other sample inputs). It never seems to recognize the CONSTRAIN keyword, just doing an unconstrained optimization.

I can be patient. Perhaps I'll wait until this PR is merged in, then try again. But just seeing if this rings any bells. (I don't have time or expertise to dig into the code at this point.)

...thanks...dac

dacase avatar Nov 15 '24 20:11 dacase

Hi Dave,

It looks like the quick executable is using a shared object file from another installation. Can you please run ldd on quick executable and check if this is the case?

Madu

On Nov 15, 2024, at 3:01 PM, David A Case @.***> wrote:

I've had less success here. I grabbed the code from [akhilshajan:QUICK_Constrained_Optimization], built and tested it with the sample input above (and other sample inputs). It never seems to recognize the CONSTRAIN keyword, just doing an unconstrained optimization.

I can be patient. Perhaps I'll wait until this PR is merged in, then try again. But just seeing if this rings any bells. (I don't have time or expertise to dig into the code at this point.)

...thanks...dac

— Reply to this email directly, view it on GitHub https://github.com/merzlab/QUICK/pull/366#issuecomment-2479827677, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALEIXIKQIEOJMYZM3UJ4BFD2AZHJNAVCNFSM6AAAAABHEGFSVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZZHAZDONRXG4. You are receiving this because you were mentioned.

Madu86 avatar Nov 15 '24 20:11 Madu86

You are right to some extent. I had to update my LD_LIBRARY_PATH (doesn't seem to be done via quick.rc(?) Now, ldd shows I am using /usr/local/lib/libquick_cuda.so instead of the one from Amber24. But the results are the same: the CONSTRAIN keyword is apparently not recognized. Probably I am still doing something wrong, but I don't see it.

dacase avatar Nov 15 '24 20:11 dacase

I still think this is a path issue. I have separate Amber24 and quick development (quick-const-opt) installations on my system. This is what I compiled:

[madu@osprey quick-const-opt]$ git branch
* QUICK_Constrained_Optimization
[madu@osprey quick-const-opt]$ git log
commit 99797037c6309377b6f474bcc6bebbba78609cbf (HEAD -> QUICK_Constrained_Optimization, origin/QUICK_Constrained_Optimization)
Merge: 46ee0c15 1d6cf2d4
Author: Akhil Shajan <[email protected]>
Date:   Thu May 2 13:52:55 2024 -0400

    Merge branch 'merzlab:master' into QUICK_Constrained_Optimization

Running ldd on quick.cuda from Amber24 installation gives me this:

[madu@osprey bin]$ ldd /home/madu/Apps/amber24/install/bin/quick.cuda
	linux-vdso.so.1 (0x00007ffd9afb4000)
	libquick_cuda.so => /home/madu/Apps/amber24/install//lib/libquick_cuda.so (0x00007fe27e400000)

And this is from QUICK development installation:

[madu@osprey bin]$ ldd /home/madu/Apps/quick-const-opt/install/bin/quick.cuda 
	linux-vdso.so.1 (0x00007ffce49ce000)
	libquick_cuda.so => /home/madu/Apps/quick-const-opt/install//lib/libquick_cuda.so (0x00007f37c6c00000)

Ethane test:

. /home/madu/Apps/quick-const-opt/install/quick.rc 
quick.cuda ethane.in

I have attached my input and output below. ethane-rtx3080ti.tar.gz

Madu86 avatar Nov 15 '24 21:11 Madu86

Ah...my fault. I had built from the master branch, and not from Quick_Constrained_Optimization. Thanks for your help; apologies for the noise. Everything now seems to work as I expected.

dacase avatar Nov 15 '24 23:11 dacase

No worries at all! Glad you figured it out and got everything working as expected. On Nov 15, 2024, at 6:56 PM, David A Case @.***> wrote: Ah...my fault. I had built from the master branch, and not from Quick_Constrained_Optimization. Thanks for your help; apologies for the noise. Everything now seems to work as I expected.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Madu86 avatar Nov 16 '24 00:11 Madu86

A quick question - if this becomes a feature, would you please update the docs file too to reflect supported keywords etc?

crtag avatar Jan 12 '25 21:01 crtag

@akhilshajan: If you could add new tests for each of the new the DL-FIND optimization constraints, we would appreciate that.

ohearnk avatar Mar 19 '25 19:03 ohearnk

@ohearnk A quick question - the only thing preventing the merge is missing tests, is that so? Logs from the last checks have already expired, so I'd like to know if there's anything else.

crtag avatar Jul 14 '25 23:07 crtag

@crtag: There are still some MPI-related issues (with Intel oneAPI CCL) which need to be diagosed and corrected (see updated test artifacts with multiple test failures and a crash for different oneAPI versions). There are also some MacOS build failures, though these are new and require OpenMPI re-compilation with newer GCC gfortran in Homebrew to resolve (i.e., it'll be fixed upstream eventually and are not really of concern right now).

Back to the oneAPI CCL issues -- there is likely an issue with the Fortran interface for DL-FIND (which I'm guessing hasn't been properly tested with MPI yet alone oneAPI CCL). I've patched multiple compilation warnings / errors in the copy of DL-FIND included in QUICK with this MR already. Ideally, @akhilshajan would debug this as he mainly worked on this feature. Beyond these failures, @akhilshajan and/or @agoetz also need to add new tests to cover the new unconstrained optimization feature.

TL;DR -- this still needs work to fix localized MPI issues and needs more tests for the new features. If this can be done before the QUICK-25.08 release later this year, then it'll be merged.

ohearnk avatar Jul 16 '25 16:07 ohearnk

@ohearnk Thank you for the explanation! I will make a bold assumption that it can be tried in the current Ubuntu build, as the two failed checks may relate to missing tests, and I can benchmark it against the previous build with 24.x for sanity

crtag avatar Jul 17 '25 00:07 crtag

@agoetz @ohearnk I fixed a bug and added a couple of dihedral constrained optimization tests.

Madu86 avatar Jul 18 '25 22:07 Madu86

@agoetz: This should be good to merge now once the additional constrained optimization tests are added.

ohearnk avatar Sep 05 '25 02:09 ohearnk

Tests have been added for

  • distance, angle, and dihedral constraints.
  • freeze atoms.

agoetz avatar Oct 31 '25 06:10 agoetz

Tests look good to me. Merging.

ohearnk avatar Oct 31 '25 15:10 ohearnk