Skip to content

Commit 82b8204

Browse files
committed
fixed version of check
svn-origin-rev: 13196
1 parent c03aeb4 commit 82b8204

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

src/force_env_methods.F

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,7 @@ RECURSIVE SUBROUTINE qmmm_energy_and_forces(force_env,calc_force,require_consist
950950
error,failure)
951951
ENDIF
952952
953-
! Possibly translate the system
954-
953+
! Possibly translate the system
955954
CALL apply_qmmm_translate(force_env, error)
956955
957956
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)
10951094
routineP = moduleN//':'//routineN
10961095
10971096
CHARACTER(LEN=default_string_length) :: description, iter
1098-
INTEGER :: ip, nres, output_unit
1097+
INTEGER :: ip, j, nres, output_unit
10991098
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
11031102
REAL(KIND=dp) :: energy_mm, energy_qm
11041103
REAL(KIND=dp), DIMENSION(3) :: dip_mm, dip_qm, dip_qmmm, &
11051104
max_coord, min_coord
@@ -1147,6 +1146,19 @@ RECURSIVE SUBROUTINE qmmm_energy_and_forces_low(force_env,calc_force,error)
11471146
11481147
particles_mm => subsys_mm%particles%els
11491148
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
11501162
11511163
! If present QM/MM links (just IMOMM) correct the position of the qm-link atom
11521164
IF (qmmm_link_imomm) CALL qmmm_link_Imomm_coord(qmmm_links, particles_qm, qm_atom_index, error)

src/qs_scf.F

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ SUBROUTINE scf_env_do_scf(scf_env,qs_env,converged,should_stop,error)
242242
INTEGER :: ext_master_id, external_comm, handle, handle2, ispin, &
243243
iter_count, output_unit, scf_energy_message_tag, total_steps
244244
LOGICAL :: diis_step, energy_only, exit_inner_loop, exit_outer_loop, &
245-
failure, gapw, gapw_xc, harris_flag, has_unit_metric, just_energy, &
246-
inner_loop_converged, outer_loop_converged, scp_nddo, use_jacobi
245+
failure, gapw, gapw_xc, harris_flag, has_unit_metric, &
246+
inner_loop_converged, just_energy, outer_loop_converged, scp_nddo, &
247+
use_jacobi
247248
REAL(KIND=dp) :: t1, t2
248249
TYPE(atomic_kind_type), DIMENSION(:), &
249250
POINTER :: atomic_kind_set

0 commit comments

Comments
 (0)