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

Xianyuan Zhao sanrorc at gmail.com
Thu Dec 7 01:23:34 UTC 2023


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.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/f48baff0-c8f5-4596-9f29-de7c07158e6bn%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20231206/c2de66b1/attachment-0001.htm>


More information about the CP2K-user mailing list