1!
2! Copyright (C) 2001-2005 Quantum ESPRESSO group
3! This file is distributed under the terms of the
4! GNU General Public License. See the file `License'
5! in the root directory of the present distribution,
6! or http://www.gnu.org/copyleft/gpl.txt .
7!
8!
9!----------------------------------------------------------------------------
10SUBROUTINE stop_cp_run()
11  !----------------------------------------------------------------------------
12  !
13  ! ... Close all files and synchronize processes before stopping.
14  !
15  USE environment,        ONLY : environment_end
16  USE control_flags,      ONLY : lconstrain
17  USE constraints_module, ONLY : deallocate_constraint
18  USE mp_global,          ONLY : mp_global_end
19  !
20  IMPLICIT NONE
21  !
22  CALL environment_end( 'CP' )
23  !
24  CALL deallocate_modules_var()
25  !
26  IF ( lconstrain ) CALL deallocate_constraint()
27  !
28  CALL plugin_clean()
29  !
30  CALL mp_global_end()
31  !
32  STOP 0
33  !
34END SUBROUTINE stop_cp_run
35