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

request for variable numbers of atoms for QM calculations (in quick_api_module) #275

Open
akashpg1996 opened this issue Dec 11, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@akashpg1996
Copy link

akashpg1996 commented Dec 11, 2022

Hi QUICK,
I am using api module for getting energy and gradients to calculate frequencies of some species. My molecular specie is containing fragments A and B with different atom numbers. I am trying it by passing number of atoms for each fragments by reallowcating quick_api variables. I am getting following error,

quick_cusolver.c:165: cuda_diag_: Assertion `CUSOLVER_STATUS_SUCCESS == cusolver_status' failed.

API module have utility to handle variation in ptchg (external charges) but not in total number of atoms in the QM system. In some MD codes like NAMD there we can define QM region around the molecule in which, solvents can considered as QM atoms. in such regions number of QM atoms can change as simulations proceeds. is it possible that quick can handle the variation in QM atoms through api mode ?

please help.
Thank you
Akash

@Madu86
Copy link
Collaborator

Madu86 commented Dec 12, 2022

Hi @akashpg1996, This is currently not possible in QUICK but I think you can make it work with a moderate coding effort. What changes have you made so far?
Regarding your error, this is most likely due to the difference between number of basis functions you passed and actual Fock or density matrix size. I would first get it to work with serial CPU version rather than jumping into CUDA version.

@akashpg1996
Copy link
Author

akashpg1996 commented Dec 12, 2022

after this error I made some changes-- during first quick call, I am calling setQuickJob from api and before passing subsequent changed atom number, atomtypes and coordinates ,I am doing following things
1.deallocate quick_molspec of previous specie
2.reallocating gpu scratch,
3. read_job_and_Atom again
4. upload(quick_method, ierr)
5. allocate quick_molspec again for new natoms and atomtypes

in output for first fragment I am getting,

| 92  -7051.026382914  0.772204E-03       0.665    92        0.02      0.65      0.01    0.2669E+00  0.1299E-04  0.6731E-03
| 93  -7051.026300970  -.819444E-04       0.662    93        0.02      0.64      0.01    0.2669E+00  0.5797E-06  0.1928E-04
| ------------------------------------------------------------------------------------------------------------------------
| REACH CONVERGENCE AFTER  93 CYCLES
| MAX ERROR = 0.266875E+00   RMS CHANGE = 0.579737E-06   MAX CHANGE = 0.192848E-04
| -----------------------------------------------
 ALPHA ELECTRON DENSITY    =    38.0001300611
 BETA ELECTRON DENSITY     =    38.0001300611
 ELECTRONIC ENERGY    =  -7188.966748910
 CORE_CORE REPULSION  =    137.940447940
 TOTAL ENERGY         =  -7051.026300970

 @ End Energy calculation


 @ Begin Gradient Calculation

 ANALYTICAL GRADIENT:
----------------------------------------
 COORDINATE    XYZ            GRADIENT
----------------------------------------
    1X     0.0000000000    -0.0001592544
    1Y    -0.6317549076    -0.7092108140
    1Z     0.0000000000     0.0000651849
    2X     0.0000000000     0.0001592542
    2Y     0.5412451820     0.7092108135
    2Z     0.0000000000    -0.0000657449
    3X     1.9274829720     0.1850531800
    3Y     0.0000488175    -0.0003089489
    3Z   **************     0.0000160337
    4X     2.2639030831     0.0041880675
    4Y    -0.4096133136     0.0345297893
    4Z   **************    -0.0796993989
    5X     2.2621659149     0.0043606317
    5Y     1.0257599380    -0.0861986964
    5Z   999.8797831388     0.0101113866
    6X     2.2594799581     0.0048268831
    6Y    -0.6170285711     0.0520401439
    6Z   999.1713044029     0.0696727653
    7X    -0.2361496155    -0.1984287621
    7Y     0.0000023879    -0.0000622874
    7Z   **************    -0.0001002266
----------------------------------------

and when I am passing second specie info, getting

 DIIS FAILED !! PERFORM NORMAL SCF. (NOT FATAL.)
| 98 ****************  0.168477E+33       0.254    98        0.01      0.24      0.01    0.1094E+18  0.5691E+02  0.1785E+04
 DIIS FAILED !! PERFORM NORMAL SCF. (NOT FATAL.)
| 99 ****************  -.152963E+33       0.253    99        0.01      0.24      0.01    0.2703E+33  0.5705E+02  0.1766E+04
 DIIS FAILED !! PERFORM NORMAL SCF. (NOT FATAL.)
 RAN OUT OF CYCLES.  NO CONVERGENCE.
 PERFORM FINAL NO INTERPOLATION ITERATION
 ELECTRONIC ENERGY    = ****************
 CORE_CORE REPULSION  =      0.000000000
 TOTAL ENERGY         = ****************

 @ End Energy calculation


 @ Begin Gradient Calculation

 ANALYTICAL GRADIENT:
----------------------------------------
 COORDINATE    XYZ            GRADIENT
----------------------------------------
    1X     0.0010000001   **************
    1Y    -0.6317549076   **************
    1Z     0.0000000000   **************
    2X     0.0000000000   **************
    2Y     0.5412451820   **************
    2Z     0.0000000000   **************
----------------------------------------

 @ End Gradient Calculation

I am unable to figure out what I am missing.

@Madu86
Copy link
Collaborator

Madu86 commented Dec 12, 2022

Do you recompute the density matrix during second MD step?

@akashpg1996
Copy link
Author

No. I didn't. I mean not intentionally. I just directly called "getQuickEnergyGradients". If it is needed to calculate again what would be the procedure ?

@Madu86
Copy link
Collaborator

Madu86 commented Dec 12, 2022

It happens here: https://github.com/merzlab/QUICK/blob/master/src/modules/quick_api_module.f90#L523-L533. You can update the conditional statement to always run the stuff within the body if atom number of changed along the MD.

@akashpg1996
Copy link
Author

That worked ! .... We are saved. Thank you very much for your kind support. @Madu86

@Madu86
Copy link
Collaborator

Madu86 commented Dec 13, 2022

Awesome! You are welcome..

@agoetz
Copy link
Collaborator

agoetz commented Feb 17, 2023

Do we need to keep this open? It sounds like this feature request has been resolved. Should we change our release version source code accordingly?

@agoetz agoetz added the enhancement New feature or request label Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants