mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 22:25:32 -04:00
Added a rescale_forces section for bad starting geometries.. new regtest..
changes NMR regtest -> too slow for NAG and memcheck svn-origin-rev: 6088
This commit is contained in:
parent
b8385349ba
commit
d5e2924891
7 changed files with 241 additions and 20 deletions
|
|
@ -310,6 +310,8 @@ CONTAINS
|
|||
CALL fix_atom_control(force_env, error=error)
|
||||
! All Restraints
|
||||
CALL restraint_control(force_env, error=error)
|
||||
! Rescale forces if requested
|
||||
CALL rescale_forces(force_env, error=error)
|
||||
END IF
|
||||
IF (ASSOCIATED(force_env%cpot_env)) THEN
|
||||
CALL force_env_get(force_env, potential_energy=e_pot, error=error)
|
||||
|
|
@ -1230,7 +1232,8 @@ SUBROUTINE mixed_energy_forces(force_env, need_f, error)
|
|||
force_env%sub_force_env(iforce_eval)%force_env%para_env%source) THEN
|
||||
! Forces
|
||||
DO iparticle = 1, glob_natoms(iforce_eval)
|
||||
global_forces(iforce_eval)%forces(:,iparticle) = particles(iforce_eval)%list%els(iparticle)%f
|
||||
global_forces(iforce_eval)%forces(:,iparticle) = &
|
||||
particles(iforce_eval)%list%els(iparticle)%f
|
||||
END DO
|
||||
END IF
|
||||
END IF
|
||||
|
|
@ -1937,4 +1940,66 @@ SUBROUTINE force_env_rattle(force_env,dt,shake_tol,log_unit,lagrange_mult,dump_l
|
|||
END SUBROUTINE force_env_rattle
|
||||
!***************************************************************************
|
||||
|
||||
!!****f* force_env_types/rescale_forces *
|
||||
!!
|
||||
!! NAME
|
||||
!! rescale_forces
|
||||
!!
|
||||
!! FUNCTION
|
||||
!! Rescale forces if requested
|
||||
!!
|
||||
!! NOTES
|
||||
!! -
|
||||
!!
|
||||
!! ARGUMENTS
|
||||
!! - force_env: the force env to shake
|
||||
!! - error: variable to control error logging, stopping,...
|
||||
!! see module cp_error_handling
|
||||
!!
|
||||
!! AUTHOR
|
||||
!! tlaino
|
||||
!!
|
||||
!!*** **********************************************************************
|
||||
SUBROUTINE rescale_forces (force_env, error)
|
||||
TYPE(force_env_type), POINTER :: force_env
|
||||
TYPE(cp_error_type), INTENT(inout) :: error
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'rescale_forces', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, iparticle, &
|
||||
isub
|
||||
LOGICAL :: explicit, failure
|
||||
REAL(KIND=dp) :: max_value, force(3), mod_force
|
||||
TYPE(cp_subsystem_p_type), &
|
||||
DIMENSION(:), POINTER :: subsys
|
||||
TYPE(particle_list_type), POINTER :: particles
|
||||
TYPE(section_vals_type), POINTER :: rescale_force_section
|
||||
|
||||
failure=.FALSE.
|
||||
CALL timeset(routineN,handle)
|
||||
CPPrecondition(ASSOCIATED(force_env),cp_failure_level,routineP,error,failure)
|
||||
CPPrecondition(force_env%ref_count>0,cp_failure_level,routineP,error,failure)
|
||||
rescale_force_section => section_vals_get_subs_vals(force_env%force_env_section,"RESCALE_FORCES",error=error)
|
||||
CALL section_vals_get(rescale_force_section, explicit=explicit, error=error)
|
||||
IF (.NOT.failure.AND.explicit) THEN
|
||||
CALL section_vals_val_get(rescale_force_section,"MAX_FORCE",r_val=max_value,error=error)
|
||||
CALL force_env_get(force_env,subsys=subsys,error=error)
|
||||
DO isub=1,SIZE(subsys)
|
||||
CALL cp_subsys_get(subsys(isub)%subsys, &
|
||||
particles=particles,&
|
||||
error=error)
|
||||
DO iparticle = 1, SIZE(particles%els)
|
||||
force = particles%els(iparticle)%f(:)
|
||||
mod_force = SQRT(DOT_PRODUCT(force,force))
|
||||
IF ((mod_force > max_value).AND.(mod_force /= 0.0_dp)) THEN
|
||||
force = force / mod_force * max_value
|
||||
particles%els(iparticle)%f(:) = force
|
||||
END IF
|
||||
END DO
|
||||
END DO
|
||||
END IF
|
||||
CALL timestop(handle)
|
||||
END SUBROUTINE rescale_forces
|
||||
|
||||
END MODULE force_env_methods
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ MODULE input_cp2k
|
|||
parser_release
|
||||
USE cp_units, ONLY: cp_unit_set_create,&
|
||||
cp_unit_set_release,&
|
||||
cp_unit_set_type
|
||||
cp_unit_set_type,&
|
||||
cp_unit_to_cp2k
|
||||
USE input_constants
|
||||
USE input_cp2k_dft, ONLY: create_bsse_section,&
|
||||
create_dft_section,&
|
||||
|
|
@ -842,6 +843,10 @@ FUNCTION create_cp2k_input_reading(file_path,para_env,error) RESULT(res)
|
|||
CALL section_add_keyword(section,keyword,error=error)
|
||||
CALL keyword_release(keyword,error=error)
|
||||
|
||||
CALL create_rescale_force_section(subsection,error)
|
||||
CALL section_add_subsection(section, subsection, error=error)
|
||||
CALL section_release(subsection,error=error)
|
||||
|
||||
CALL create_ep_section(subsection,error)
|
||||
CALL section_add_subsection(section, subsection, error=error)
|
||||
CALL section_release(subsection,error=error)
|
||||
|
|
@ -1114,6 +1119,63 @@ FUNCTION create_cp2k_input_reading(file_path,para_env,error) RESULT(res)
|
|||
END SUBROUTINE create_vib_section
|
||||
!***************************************************************************
|
||||
|
||||
!!****f* input_cp2k/create_rescale_force_section [1.0] *
|
||||
!!
|
||||
!! NAME
|
||||
!! create_rescale_force_section
|
||||
!!
|
||||
!! FUNCTION
|
||||
!! Creates the section controlling the rescaling of forces
|
||||
!!
|
||||
!! NOTES
|
||||
!! -
|
||||
!!
|
||||
!! ARGUMENTS
|
||||
!! - section: the section to create
|
||||
!! - error: variable to control error logging, stopping,...
|
||||
!! see module cp_error_handling
|
||||
!!
|
||||
!! AUTHOR
|
||||
!! teo
|
||||
!!
|
||||
!!*** **********************************************************************
|
||||
SUBROUTINE create_rescale_force_section(section,error)
|
||||
TYPE(section_type), POINTER :: section
|
||||
TYPE(cp_error_type), INTENT(inout) :: error
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'create_rescale_force_section', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
LOGICAL :: failure
|
||||
TYPE(keyword_type), POINTER :: keyword
|
||||
|
||||
failure=.FALSE.
|
||||
|
||||
CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
|
||||
IF (.NOT. failure) THEN
|
||||
CALL section_create(section,name="RESCALE_FORCES",&
|
||||
description="Section controlling the rescaling of forces. Useful when"//&
|
||||
" starting from quite bad geometries with unphysically large forces.",&
|
||||
n_keywords=1, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
|
||||
error=error)
|
||||
NULLIFY(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="MAX_FORCE",&
|
||||
description="Specify the Maximum Values of the force. If the force"//&
|
||||
" of one atom exceed this value it's rescaled to the MAX_FORCE"//&
|
||||
" value.",&
|
||||
default_r_val=cp_unit_to_cp2k(value=50.0_dp,&
|
||||
unit_str="kcalmol*angstrom^-1",&
|
||||
error=error),&
|
||||
unit_str="hartree*bohr^-1",&
|
||||
error=error)
|
||||
CALL section_add_keyword(section,keyword,error=error)
|
||||
CALL keyword_release(keyword,error=error)
|
||||
|
||||
END IF
|
||||
END SUBROUTINE create_rescale_force_section
|
||||
!***************************************************************************
|
||||
|
||||
!!****f* input_cp2k/create_farming_section *
|
||||
!!
|
||||
!! NAME
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ water_1_res_1.inp 2
|
|||
water_1_res_2.inp 2
|
||||
water_1_res_3.inp 2
|
||||
water_2.inp 2
|
||||
water_2_rescaleF.inp 2
|
||||
water_3_g3x3.inp 2
|
||||
water_3_dist.inp 2
|
||||
water32_hbonds_2.inp 2
|
||||
|
|
|
|||
70
tests/Fist/regtest/water_2_rescaleF.inp
Normal file
70
tests/Fist/regtest/water_2_rescaleF.inp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
|
||||
&FORCE_EVAL
|
||||
METHOD FIST
|
||||
&MM
|
||||
&FORCEFIELD
|
||||
parm_file_name ../sample_pot/water.pot
|
||||
parmtype CHM
|
||||
&spline
|
||||
emax_spline 10000.0
|
||||
&ENd
|
||||
&CHARGE
|
||||
ATOM OT
|
||||
CHARGE -0.8476
|
||||
&END CHARGE
|
||||
&CHARGE
|
||||
ATOM HT
|
||||
CHARGE 0.4238
|
||||
&END CHARGE
|
||||
&END FORCEFIELD
|
||||
&POISSON
|
||||
&EWALD
|
||||
EWALD_TYPE spme
|
||||
ALPHA .44
|
||||
GMAX 24
|
||||
O_SPLINE 6
|
||||
&END EWALD
|
||||
&END POISSON
|
||||
&END MM
|
||||
&SUBSYS
|
||||
&CELL
|
||||
ABC 24.955 24.955 24.955
|
||||
UNIT ANGSTROM
|
||||
&END CELL
|
||||
&TOPOLOGY
|
||||
COORD_FILE_NAME ../sample_pdb/water_2.pdb
|
||||
COORDINATE pdb
|
||||
CONN_FILE_NAME ../sample_psf/water_2.psf
|
||||
CONNECTIVITY PSF
|
||||
&END TOPOLOGY
|
||||
&COORD
|
||||
O 0.000 0.000 0.000 WAT
|
||||
H 1.000 0.000 0.000 WAT
|
||||
H 0.000 1.000 0.000 WAT
|
||||
O 0.000 0.000 1.000 WAT
|
||||
H 0.000 0.000 2.000 WAT
|
||||
H 1.000 1.000 1.000 WAT
|
||||
&END
|
||||
&END SUBSYS
|
||||
&RESCALE_FORCES
|
||||
MAX_FORCE 0.001
|
||||
&END
|
||||
&PRINT
|
||||
&FORCES
|
||||
&END
|
||||
&END
|
||||
&END FORCE_EVAL
|
||||
&GLOBAL
|
||||
FFTLIB FFTW
|
||||
|
||||
PROJECT water_2
|
||||
RUN_TYPE md
|
||||
&END GLOBAL
|
||||
&MOTION
|
||||
&MD
|
||||
ENSEMBLE NVE
|
||||
STEPS 100
|
||||
TIMESTEP 1.0
|
||||
TEMPERATURE 298
|
||||
&END MD
|
||||
&END MOTION
|
||||
37
tests/Fist/sample_psf/water_2.psf
Normal file
37
tests/Fist/sample_psf/water_2.psf
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
PSF EXT
|
||||
|
||||
1 !NTITLE
|
||||
CP2K generated DUMP of connectivity
|
||||
|
||||
6 !NATOM
|
||||
1 WAT 1 TIP OT OT -0.847600 15.999 0
|
||||
2 WAT 1 TIP HT HT 0.423800 1.008 0
|
||||
3 WAT 1 TIP HT HT 0.423800 1.008 0
|
||||
4 WAT 2 TIP OT OT -0.847600 15.999 0
|
||||
5 WAT 2 TIP HT HT 0.423800 1.008 0
|
||||
6 WAT 2 TIP HT HT 0.423800 1.008 0
|
||||
|
||||
|
||||
4 !NBOND
|
||||
1 2 1 3 4 5 4 6
|
||||
|
||||
|
||||
2 !NTHETA
|
||||
2 1 3 5 4 6
|
||||
|
||||
|
||||
0 !NPHI
|
||||
|
||||
|
||||
0 !NIMPHI
|
||||
|
||||
|
||||
0 !NDON
|
||||
|
||||
|
||||
0 !NACC
|
||||
|
||||
|
||||
0 !NNB
|
||||
|
||||
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
BASIS_SET_FILE_NAME ../GTH_BASIS_SETS
|
||||
POTENTIAL_FILE_NAME ../GTH_POTENTIALS
|
||||
&MGRID
|
||||
CUTOFF 150
|
||||
CUTOFF 50
|
||||
&END MGRID
|
||||
&QS
|
||||
&END QS
|
||||
|
|
@ -37,35 +37,19 @@
|
|||
&END
|
||||
&SUBSYS
|
||||
&CELL
|
||||
ABC 7.5 7.5 10.0
|
||||
ABC 4.5 4.5 10.0
|
||||
UNIT ANGSTROM
|
||||
&END CELL
|
||||
&COORD
|
||||
He 0.0 0.0 0.0
|
||||
He 1.5 0.0 0.0
|
||||
He 3.0 0.0 0.0
|
||||
He 4.5 0.0 0.0
|
||||
He 6.0 0.0 0.0
|
||||
He 0.0 1.5 0.0
|
||||
He 1.5 1.5 0.0
|
||||
He 3.0 1.5 0.0
|
||||
He 4.5 1.5 0.0
|
||||
He 6.0 1.5 0.0
|
||||
He 0.0 3.0 0.0
|
||||
He 1.5 3.0 0.0
|
||||
He 3.0 3.0 0.0
|
||||
He 4.5 3.0 0.0
|
||||
He 6.0 3.0 0.0
|
||||
He 0.0 4.5 0.0
|
||||
He 1.5 4.5 0.0
|
||||
He 3.0 4.5 0.0
|
||||
He 4.5 4.5 0.0
|
||||
He 6.0 4.5 0.0
|
||||
He 0.0 6.0 0.0
|
||||
He 1.5 6.0 0.0
|
||||
He 3.0 6.0 0.0
|
||||
He 4.5 6.0 0.0
|
||||
He 6.0 6.0 0.0
|
||||
&END COORD
|
||||
&KIND He
|
||||
BASIS_SET DZVP-GTH
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# Enter input files to reset
|
||||
# Making the test faster.. too slow for nag and memcheck regtests
|
||||
He_nmr_full.inp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue