[CP2K-user] [CP2K:19639] questions about subtroutine qmmm_added_chrg_forces

Jürg Hutter hutter at chem.uzh.ch
Fri Dec 8 11:15:34 UTC 2023


Hi

yes, looks like a typo to me. The same in qmmm_added_chrg_coord.
If you can verify the obvious fix, we can update the code.

regards
JH

________________________________________
From: cp2k at googlegroups.com <cp2k at googlegroups.com> on behalf of Xianyuan Zhao <sanrorc at gmail.com>
Sent: Thursday, December 7, 2023 2:23 AM
To: cp2k
Subject: [CP2K:19638] questions about subtroutine qmmm_added_chrg_forces

Hi,

I was looking at the source code of the qmmm module of cp2k and trying to understand how IMOMM link scheme is implemented. But I was confused by this subroutine in qmmm_links_methods.F:

Why are Index1 and Index2 assigned to the same index in "added_charges%add_env(i)%Index1"? Would not the last statement wash what the statement above it put in "particles(Index2)%f"?

Thanks!

Regards,

Xianyuan


! **************************************************************************************************
!> \brief correct the forces due to the  added charges in qm/mm link scheme
!> \param qmmm_env ...
!> \param particles ...
!> \par History
!>      01.2005 created [tlaino]
!> \author Teodoro Laino
! **************************************************************************************************
   SUBROUTINE qmmm_added_chrg_forces(qmmm_env, particles)
      TYPE(qmmm_env_qm_type), POINTER                    :: qmmm_env
      TYPE(particle_type), DIMENSION(:), POINTER         :: particles

      INTEGER                                            :: I, Index1, Index2
      REAL(KIND=dp)                                      :: alpha
      TYPE(add_set_type), POINTER                        :: added_charges

      added_charges => qmmm_env%added_charges

      DO i = 1, added_charges%num_mm_atoms
         Index1 = added_charges%add_env(i)%Index1
         Index2 = added_charges%add_env(i)%Index1
         alpha = added_charges%add_env(i)%alpha
         particles(Index1)%f = particles(Index1)%f + alpha*added_charges%added_particles(i)%f
         particles(Index2)%f = particles(Index2)%f + (1.0_dp - alpha)*added_charges%added_particles(i)%f
      END DO

   END SUBROUTINE qmmm_added_chrg_forces



--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+unsubscribe at googlegroups.com<mailto:cp2k+unsubscribe at googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/f48baff0-c8f5-4596-9f29-de7c07158e6bn%40googlegroups.com<https://groups.google.com/d/msgid/cp2k/f48baff0-c8f5-4596-9f29-de7c07158e6bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/ZR0P278MB0759F45BAF69B024679FCC4E9F8AA%40ZR0P278MB0759.CHEP278.PROD.OUTLOOK.COM.


More information about the CP2K-user mailing list