@@ -950,8 +950,7 @@ RECURSIVE SUBROUTINE qmmm_energy_and_forces(force_env,calc_force,require_consist
950
950
error,failure)
951
951
ENDIF
952
952
953
- ! Possibly translate the system
954
-
953
+ ! Possibly translate the system
955
954
CALL apply_qmmm_translate(force_env, error)
956
955
957
956
DO isubf=1, SIZE(force_env%sub_force_env)
@@ -1095,11 +1094,11 @@ RECURSIVE SUBROUTINE qmmm_energy_and_forces_low(force_env,calc_force,error)
1095
1094
routineP = moduleN//' :' //routineN
1096
1095
1097
1096
CHARACTER(LEN=default_string_length) :: description, iter
1098
- INTEGER :: ip, nres, output_unit
1097
+ INTEGER :: ip, j, nres, output_unit
1099
1098
INTEGER, DIMENSION(:), POINTER :: qm_atom_index
1100
- LOGICAL :: calculate_forces, failure , &
1101
- qmmm_added_chrg, qmmm_link , &
1102
- qmmm_link_imomm
1099
+ LOGICAL :: calculate_forces, check , &
1100
+ failure, qmmm_added_chrg , &
1101
+ qmmm_link, qmmm_link_imomm
1103
1102
REAL(KIND=dp) :: energy_mm, energy_qm
1104
1103
REAL(KIND=dp), DIMENSION(3) :: dip_mm, dip_qm, dip_qmmm, &
1105
1104
max_coord, min_coord
@@ -1147,6 +1146,19 @@ RECURSIVE SUBROUTINE qmmm_energy_and_forces_low(force_env,calc_force,error)
1147
1146
1148
1147
particles_mm => subsys_mm%particles%els
1149
1148
particles_qm => subsys_qm%particles%els
1149
+
1150
+ DO j=1,3
1151
+ IF (qm_cell%perd(j)==1) CYCLE
1152
+ DO ip=1, SIZE(particles_qm)
1153
+ check = (DOT_PRODUCT(qm_cell%h_inv(j,:),particles_qm(ip)%r) >= 0.0) .AND. &
1154
+ (DOT_PRODUCT(qm_cell%h_inv(j,:),particles_qm(ip)%r) <= 1.0)
1155
+ CALL cp_assert(check, cp_failure_level, cp_assertion_failed, routinep,&
1156
+ "QM/MM QM atoms must be fully contained in the same image of the QM box "//&
1157
+ "- No wrapping of coordinates is allowed! "//&
1158
+ CPSourceFileRef,&
1159
+ error)
1160
+ END DO
1161
+ END DO
1150
1162
1151
1163
! If present QM/MM links (just IMOMM) correct the position of the qm-link atom
1152
1164
IF (qmmm_link_imomm) CALL qmmm_link_Imomm_coord(qmmm_links, particles_qm, qm_atom_index, error)
0 commit comments