Skip to content

Implementation of the NVPT for APTs and AATs in velocity form#2568

Merged
fstein93 merged 13 commits intocp2k:masterfrom
edditler:vcd
Feb 10, 2023
Merged

Implementation of the NVPT for APTs and AATs in velocity form#2568
fstein93 merged 13 commits intocp2k:masterfrom
edditler:vcd

Conversation

@edditler
Copy link
Contributor

@edditler edditler commented Feb 9, 2023

Dear CP2K Developers,

This pull-request includes the implementation of the Nuclear Velocity Perturbation Theory (NVPT) as described in doi.org/10.1021/acs.jctc.2c00006. The perturbed MO coefficients (with respect to nuclear velocities) are used to calculate the Atomic Polar/Axial Tensors in the velocity representation. The resulting output can be used, together with a Hessian matrix, to calculate vibrational circular dichroism spectra.

The previous implementation of the nuclear displacement perturbation is contained in the new vcd_env as vcd_env%dcdr_env.

Copy link
Contributor

@fstein93 fstein93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some comments. I did not mark everything. I especially ask you to give parameters the PARAMETER attribute and check whether you can drop some POINTER attributes or replace them with ALLOCATABLE attributes.

@edditler
Copy link
Contributor Author

edditler commented Feb 9, 2023

Great, thanks a lot!

mint(i, j)%block = 0._dp
END DO
END DO
ASSOCIATE ( &
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the ASSOCIATE construct also be used here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it does make sense here. I am aware that your former suggestion corresponds to the legacy coding style in CP2K. But with the ASSOCIATE construct it is clear that the variables are runtime constants.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I replaced the pointer assignments in all files that are touched by this PR.

@edditler
Copy link
Contributor Author

It appears that either fpretty has an issue with aligning ASSOCIATED constructs in some cases, or I made a mistake.

Is there anything else left to do?

@fstein93
Copy link
Contributor

Usually, it works quite well because ASSOCIATE should in that respect behave like SUBROUTINE, FOR or IF.

If the tests run smoothly, I will merge your PR.

@fstein93 fstein93 merged commit d463602 into cp2k:master Feb 10, 2023
@glb96
Copy link
Contributor

glb96 commented Feb 13, 2023

Hi!
Since this last PR, I have had some trouble printing moments. Please see the input file and the error below.

Maybe the input parameters shall be changed after your update?

Best,
Guillaume

#################
Input file:
&FORCE_EVAL
METHOD QUICKSTEP
&DFT
&REAL_TIME_PROPAGATION
MAX_ITER 10
MAT_EXP TAYLOR
EPS_ITER 1.0E-9
INITIAL_WFN SCF_WFN
&END
&EFIELD
INTENSITY 1.0E+10
PHASE 0.0
POLARISATION 0 1 0
!520ev = 2.38 in nm
WAVELENGTH [nm] 2.3752
ENVELOP GAUSSIAN
&GAUSSIAN_ENV
SIGMA [fs] 0.1
T0 [fs] 0.5
&END
&END
BASIS_SET_FILE_NAME BASIS_MOLOPT
BASIS_SET_FILE_NAME BASIS_SET
POTENTIAL_FILE_NAME POTENTIAL
&MGRID
CUTOFF 100
&END MGRID
&QS
EPS_DEFAULT 1.0E-10
&END QS
&SCF
MAX_SCF 250
EPS_SCF 1.0E-8
SCF_GUESS ATOMIC
&OUTER_SCF
EPS_SCF 1.0E-3
&END
&OT ON
ROTATION
&END OT
&END SCF
&POISSON
PERIODIC NONE
POISSON_SOLVER MT
&END POISSON
&XC
&XC_FUNCTIONAL PADE
&END XC_FUNCTIONAL
&END XC
&PRINT
&MOMENTS
PERIODIC .FALSE.
COMMON_ITERATION_LEVELS 100000
MAX_MOMENT 2
COM_NL .TRUE.
VEL_REPRS .TRUE.
&EACH
MD 1
&END EACH
&END MOMENTS
&END PRINT
&END DFT
&SUBSYS
&CELL
ABC 7 7 7
PERIODIC NONE
&END CELL
&TOPOLOGY
&CENTER_COORDINATES
&END CENTER_COORDINATES
&END TOPOLOGY
&COORD
O 0.000000 0.000000 -0.065587 H2O
H 0.000000 -0.757136 0.520545 H2O
H 0.000000 0.757136 0.520545 H2O
&END COORD
&KIND H
BASIS_SET DZVP-MOLOPT-GTH
POTENTIAL GTH-PADE-q1
&END KIND
&KIND O
BASIS_SET DZVP-MOLOPT-GTH
POTENTIAL GTH-PADE-q6
&END KIND
&END SUBSYS
&END FORCE_EVAL
&GLOBAL
PROJECT H2O-rtp-efield
RUN_TYPE RT_PROPAGATION
PRINT_LEVEL LOW
&END GLOBAL
&MOTION
&MD
ENSEMBLE NVE
STEPS 10
TIMESTEP [fs] 0.0005
TEMPERATURE 300.0
&END MD
&PRINT
&TRAJECTORY
&EACH
MD 1
&END
&END
&END
&END MOTION
###########################################
Error:
At line 946 of file /users/glebreton/Software/real_cp2k/src/qs_moments.F
Fortran runtime error: Index '4' of dimension 1 of array 'moments_der' above upper bound of 3

Error termination. Backtrace:
#0 0x7fb8fc0e5640 in ???
#1 0x7fb8fc0e6185 in ???
#2 0x7fb8fc0e652a in ???
#3 0xe6e520 in __qs_moments_MOD_build_local_moments_der_matrix
at /users/glebreton/Software/real_cp2k/src/qs_moments.F:946
#4 0xe77cfa in __qs_moments_MOD_qs_moment_locop
at /users/glebreton/Software/real_cp2k/src/qs_moments.F:2290
#5 0xf67d49 in __qs_scf_post_gpw_MOD_qs_scf_post_moments
at /users/glebreton/Software/real_cp2k/src/qs_scf_post_gpw.F:1257
#6 0xf6a595 in __qs_scf_post_gpw_MOD_scf_post_calculation_gpw
at /users/glebreton/Software/real_cp2k/src/qs_scf_post_gpw.F:377
#7 0xf7477d in __qs_scf_post_scf_MOD_qs_scf_compute_properties
at /users/glebreton/Software/real_cp2k/src/qs_scf_post_scf.F:78
#8 0xf32951 in __qs_scf_MOD_scf
at /users/glebreton/Software/real_cp2k/src/qs_scf.F:300
#9 0xce0d43 in __qs_energy_MOD_qs_energies
at /users/glebreton/Software/real_cp2k/src/qs_energy.F:111
#10 0xd11ae6 in __qs_force_MOD_qs_calc_energy_force
at /users/glebreton/Software/real_cp2k/src/qs_force.F:112
#11 0x9b5e83 in __force_env_methods_MOD_force_env_calc_energy_force
at /users/glebreton/Software/real_cp2k/src/force_env_methods.F:257
#12 0x5d34d2 in rt_initial_guess
at /users/glebreton/Software/real_cp2k/src/motion/rt_propagation.F:457
#13 0x5d45d9 in __rt_propagation_MOD_rt_prop_setup
at /users/glebreton/Software/real_cp2k/src/motion/rt_propagation.F:134
#14 0x45620f in cp2k_run
at /users/glebreton/Software/real_cp2k/src/start/cp2k_runs.F:382
#15 0x4578cf in __cp2k_runs_MOD_run_input
at /users/glebreton/Software/real_cp2k/src/start/cp2k_runs.F:996
#16 0x4523c3 in cp2k
at /users/glebreton/Software/real_cp2k/src/start/cp2k.F:379
#17 0x45252f in main
at /users/glebreton/Software/real_cp2k/src/start/cp2k.F:44

Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.


mpirun detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:

Process name: [[59889,1],0]
Exit code: 2

@edditler
Copy link
Contributor Author

edditler commented Feb 13, 2023

The error is probably due to this change: https://github.com/cp2k/cp2k/pull/2568/files#diff-878e9543a198580fa55ff8b5adf912a7685b7c588d6fccbfeb396e0c8378391aL408 (in master

M_dim = ncoset(nmoments) - 1
)

My understanding is, that nmoments and nderivatives were switched up previously (logically; the code was obviously working).

In https://github.com/cp2k/cp2k/blob/master/src/qs_moments.F#L2280-L2290 it looks like the dipole moments and their first derivatives are allocated, but the quadrupoles and their first derivatives are requested from build_local_moments_der_matrix.

@oschuett
Copy link
Member

This PR has also introduced a number of coding convention problems.

For example, nspin is not initialized in qs_mfp.F and there is a rough PRINT statement in

PRINT *, 'nspins_tmp, nspins', nspins_tmp, nspins

@edditler
Copy link
Contributor Author

I will have a look at those. Sorry about that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants