59#include "../../base/base_uses.f90"
65 PRIVATE :: change_bond_angle, change_bond_length, depth_first_search, &
70 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mc_moves'
92 RECURSIVE SUBROUTINE depth_first_search(current_atom, avoid_atom, &
95 INTEGER,
INTENT(IN) :: current_atom, avoid_atom
96 INTEGER,
DIMENSION(:, :),
INTENT(IN) :: connectivity
97 INTEGER,
DIMENSION(:),
INTENT(INOUT) :: atom
102 IF (connectivity(iatom, current_atom) .NE. 0)
THEN
103 IF (connectivity(iatom, current_atom) .NE. avoid_atom)
THEN
104 atom(connectivity(iatom, current_atom)) = 1
105 CALL depth_first_search(connectivity(iatom, current_atom), &
106 current_atom, connectivity,
atom)
113 END SUBROUTINE depth_first_search
137 move_updates, start_atom, molecule_type, box_number, &
138 bias_energy, move_type, lreject, &
144 INTEGER,
INTENT(IN) :: start_atom, molecule_type, box_number
145 REAL(kind=
dp),
INTENT(INOUT) :: bias_energy
146 CHARACTER(LEN=*),
INTENT(IN) :: move_type
147 LOGICAL,
INTENT(OUT) :: lreject
150 CHARACTER(len=*),
PARAMETER :: routinen =
'mc_conformation_change'
152 CHARACTER(default_string_length) :: name
153 CHARACTER(default_string_length),
DIMENSION(:), &
155 INTEGER :: atom_number, end_atom, end_mol, handle, imol_type, imolecule, ipart, jbox, &
156 molecule_number, nunits_mol, source, start_mol
157 INTEGER,
DIMENSION(:),
POINTER :: mol_type, nunits
158 INTEGER,
DIMENSION(:, :),
POINTER :: nchains
159 LOGICAL :: ionode, lbias, loverlap
160 REAL(kind=
dp) :: beta, bias_energy_new, bias_energy_old, &
161 dis_length, exp_max_val, exp_min_val, &
163 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r_new, r_old
173 CALL timeset(routinen, handle)
176 NULLIFY (particles, subsys, molecule_kinds, molecule_kind, &
180 CALL get_mc_par(mc_par, lbias=lbias, mc_molecule_info=mc_molecule_info, &
181 beta=beta, exp_max_val=exp_max_val, &
182 exp_min_val=exp_min_val, group=group, source=source, ionode=ionode)
184 mol_type=mol_type, names=names)
187 nunits_mol = nunits(molecule_type)
188 ALLOCATE (r_old(1:3, 1:nunits_mol))
189 ALLOCATE (r_new(1:3, 1:nunits_mol))
193 DO jbox = 1, box_number - 1
194 start_mol = start_mol + sum(nchains(:, jbox))
196 end_mol = start_mol + sum(nchains(:, box_number)) - 1
199 end_atom = start_atom + nunits_mol - 1
202 DO imolecule = 1, sum(nchains(:, box_number))
203 IF (atom_number == start_atom)
THEN
204 molecule_number = imolecule
207 atom_number = atom_number + nunits(mol_type(imolecule + start_mol - 1))
209 IF (molecule_number == 0) cpabort(
'Cannot find the molecule number')
217 bias_energy_old = bias_energy
227 particles=particles, molecule_kinds=molecule_kinds)
228 DO imol_type = 1,
SIZE(molecule_kinds%els(:))
229 molecule_kind_test => molecule_kinds%els(imol_type)
231 IF (trim(adjustl(name)) == trim(adjustl(names(molecule_type))))
THEN
232 molecule_kind => molecule_kinds%els(imol_type)
238 DO ipart = start_atom, end_atom
239 r_old(1:3, ipart - start_atom + 1) = particles%els(ipart)%r(1:3)
242 IF (.NOT.
ASSOCIATED(molecule_kind)) cpabort(
'Cannot find the molecule type')
244 IF (move_type ==
'bond')
THEN
247 moves%bond%attempts = moves%bond%attempts + 1
248 move_updates%bond%attempts = move_updates%bond%attempts + 1
249 moves%bias_bond%attempts = moves%bias_bond%attempts + 1
250 move_updates%bias_bond%attempts = move_updates%bias_bond%attempts + 1
251 IF (.NOT. lbias)
THEN
252 moves%bond%qsuccesses = moves%bond%qsuccesses + 1
253 move_updates%bond%qsuccesses = &
254 move_updates%bond%qsuccesses + 1
255 moves%bias_bond%qsuccesses = moves%bias_bond%qsuccesses + 1
256 move_updates%bias_bond%qsuccesses = &
257 move_updates%bias_bond%qsuccesses + 1
261 CALL change_bond_length(r_old, r_new, mc_par, molecule_type, &
262 molecule_kind, dis_length, particles, rng_stream)
264 ELSEIF (move_type ==
'angle')
THEN
267 moves%angle%attempts = moves%angle%attempts + 1
268 move_updates%angle%attempts = move_updates%angle%attempts + 1
269 moves%bias_angle%attempts = moves%bias_angle%attempts + 1
270 move_updates%bias_angle%attempts = move_updates%bias_angle%attempts + 1
271 IF (.NOT. lbias)
THEN
272 moves%angle%qsuccesses = moves%angle%qsuccesses + 1
273 move_updates%angle%qsuccesses = &
274 move_updates%angle%qsuccesses + 1
275 moves%bias_angle%qsuccesses = moves%bias_angle%qsuccesses + 1
276 move_updates%bias_angle%qsuccesses = &
277 move_updates%bias_angle%qsuccesses + 1
281 CALL change_bond_angle(r_old, r_new, mc_par, molecule_type, &
282 molecule_kind, particles, rng_stream)
283 dis_length = 1.0e0_dp
286 moves%dihedral%attempts = moves%dihedral%attempts + 1
287 move_updates%dihedral%attempts = move_updates%dihedral%attempts + 1
288 moves%bias_dihedral%attempts = moves%bias_dihedral%attempts + 1
289 move_updates%bias_dihedral%attempts = move_updates%bias_dihedral%attempts + 1
290 IF (.NOT. lbias)
THEN
291 moves%dihedral%qsuccesses = moves%dihedral%qsuccesses + 1
292 move_updates%dihedral%qsuccesses = &
293 move_updates%dihedral%qsuccesses + 1
294 moves%bias_dihedral%qsuccesses = moves%bias_dihedral%qsuccesses + 1
295 move_updates%bias_dihedral%qsuccesses = &
296 move_updates%bias_dihedral%qsuccesses + 1
300 CALL change_dihedral(r_old, r_new, mc_par, molecule_type, &
301 molecule_kind, particles, rng_stream)
302 dis_length = 1.0e0_dp
307 DO ipart = start_atom, end_atom
308 particles%els(ipart)%r(1:3) = r_new(1:3, ipart - start_atom + 1)
315 nunits(:), loverlap, mol_type(start_mol:end_mol), &
316 molecule_number=molecule_number)
319 nunits(:), loverlap, mol_type(start_mol:end_mol), &
320 molecule_number=molecule_number)
321 IF (loverlap) lreject = .true.
334 potential_energy=bias_energy_new)
338 value = -beta*(bias_energy_new - bias_energy_old)
339 IF (
value .GT. exp_max_val)
THEN
341 ELSEIF (
value .LT. exp_min_val)
THEN
344 w = exp(
value)*dis_length**2
349 IF (w .GE. 1.0e0_dp)
THEN
354 rand = rng_stream%next()
356 CALL group%bcast(rand, source)
359 IF (rand .LT. w)
THEN
362 IF (move_type ==
'bond')
THEN
363 moves%bond%qsuccesses = moves%bond%qsuccesses + 1
364 move_updates%bond%successes = &
365 move_updates%bond%successes + 1
366 moves%bias_bond%successes = moves%bias_bond%successes + 1
367 move_updates%bias_bond%successes = &
368 move_updates%bias_bond%successes + 1
369 ELSEIF (move_type ==
'angle')
THEN
370 moves%angle%qsuccesses = moves%angle%qsuccesses + 1
371 move_updates%angle%successes = &
372 move_updates%angle%successes + 1
373 moves%bias_angle%successes = moves%bias_angle%successes + 1
374 move_updates%bias_angle%successes = &
375 move_updates%bias_angle%successes + 1
377 moves%dihedral%qsuccesses = moves%dihedral%qsuccesses + 1
378 move_updates%dihedral%successes = &
379 move_updates%dihedral%successes + 1
380 moves%bias_dihedral%successes = moves%bias_dihedral%successes + 1
381 move_updates%bias_dihedral%successes = &
382 move_updates%bias_dihedral%successes + 1
385 bias_energy = bias_energy + bias_energy_new - &
394 DO ipart = start_atom, end_atom
395 particles%els(ipart)%r(1:3) = r_old(1:3, ipart - start_atom + 1)
408 CALL timestop(handle)
433 move_updates, start_atom, box_number, &
434 bias_energy, molecule_type, &
440 INTEGER,
INTENT(IN) :: start_atom, box_number
441 REAL(kind=
dp),
INTENT(INOUT) :: bias_energy
442 INTEGER,
INTENT(IN) :: molecule_type
443 LOGICAL,
INTENT(OUT) :: lreject
446 CHARACTER(len=*),
PARAMETER :: routinen =
'mc_molecule_translation'
448 INTEGER :: atom_number, end_atom, end_mol, handle, imolecule, ipart, iparticle, jbox, &
449 molecule_number, move_direction, nunits_mol, source, start_mol
450 INTEGER,
DIMENSION(:),
POINTER :: mol_type, nunits, nunits_tot
451 INTEGER,
DIMENSION(:, :),
POINTER :: nchains
452 LOGICAL :: ionode, lbias, loverlap
453 REAL(
dp),
DIMENSION(:),
POINTER :: rmtrans
454 REAL(kind=
dp) :: beta, bias_energy_new, bias_energy_old, &
455 dis_mol, exp_max_val, exp_min_val, &
457 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r_old
466 CALL timeset(routinen, handle)
469 NULLIFY (particles, subsys)
473 beta=beta, exp_max_val=exp_max_val, &
474 exp_min_val=exp_min_val, rmtrans=rmtrans, ionode=ionode, source=source, &
475 group=group, mc_molecule_info=mc_molecule_info)
477 nchains=nchains, nunits=nunits, mol_type=mol_type)
481 DO jbox = 1, box_number - 1
482 start_mol = start_mol + sum(nchains(:, jbox))
484 end_mol = start_mol + sum(nchains(:, box_number)) - 1
487 ALLOCATE (r_old(1:3, 1:nunits_tot(box_number)))
490 nunits_mol = nunits(molecule_type)
491 end_atom = start_atom + nunits_mol - 1
494 DO imolecule = 1, sum(nchains(:, box_number))
495 IF (atom_number == start_atom)
THEN
496 molecule_number = imolecule
499 atom_number = atom_number + nunits(mol_type(imolecule + start_mol - 1))
501 IF (molecule_number == 0) cpabort(
'Cannot find the molecule number')
511 DO ipart = 1, nunits_tot(box_number)
512 r_old(1:3, ipart) = particles%els(ipart)%r(1:3)
516 bias_energy_old = bias_energy
526 moves%trans%attempts = moves%trans%attempts + 1
527 move_updates%trans%attempts = move_updates%trans%attempts + 1
528 moves%bias_trans%attempts = moves%bias_trans%attempts + 1
529 move_updates%bias_trans%attempts = move_updates%bias_trans%attempts + 1
530 IF (.NOT. lbias)
THEN
531 moves%trans%qsuccesses = moves%trans%qsuccesses + 1
532 move_updates%trans%qsuccesses = move_updates%trans%qsuccesses + 1
533 moves%bias_trans%qsuccesses = moves%bias_trans%qsuccesses + 1
534 move_updates%bias_trans%qsuccesses = move_updates%bias_trans%qsuccesses + 1
540 IF (ionode) rand = rng_stream%next()
541 CALL group%bcast(rand, source)
543 move_direction = int(3*rand) + 1
546 IF (ionode) rand = rng_stream%next()
547 CALL group%bcast(rand, source)
548 dis_mol = rmtrans(molecule_type)*(rand - 0.5e0_dp)*2.0e0_dp
551 DO iparticle = start_atom, end_atom
552 particles%els(iparticle)%r(move_direction) = &
553 particles%els(iparticle)%r(move_direction) + dis_mol
561 nunits(:), loverlap, mol_type(start_mol:end_mol), &
562 molecule_number=molecule_number)
565 nunits(:), loverlap, mol_type(start_mol:end_mol), &
566 molecule_number=molecule_number)
567 IF (loverlap) lreject = .true.
579 potential_energy=bias_energy_new)
581 value = -beta*(bias_energy_new - bias_energy_old)
582 IF (
value .GT. exp_max_val)
THEN
584 ELSEIF (
value .LT. exp_min_val)
THEN
592 IF (w .GE. 1.0e0_dp)
THEN
596 IF (ionode) rand = rng_stream%next()
597 CALL group%bcast(rand, source)
600 IF (rand .LT. w)
THEN
603 moves%bias_trans%successes = moves%bias_trans%successes + 1
604 move_updates%bias_trans%successes = move_updates%bias_trans%successes + 1
605 moves%trans%qsuccesses = moves%trans%qsuccesses + 1
606 move_updates%trans%successes = &
607 move_updates%trans%successes + 1
608 moves%qtrans_dis = moves%qtrans_dis + abs(dis_mol)
609 bias_energy = bias_energy + bias_energy_new - &
618 DO ipart = 1, nunits_tot(box_number)
619 particles%els(ipart)%r(1:3) = r_old(1:3, ipart)
631 CALL timestop(handle)
657 move_updates, box_number, &
658 start_atom, molecule_type, bias_energy, lreject, &
664 INTEGER,
INTENT(IN) :: box_number, start_atom, molecule_type
665 REAL(kind=
dp),
INTENT(INOUT) :: bias_energy
666 LOGICAL,
INTENT(OUT) :: lreject
669 CHARACTER(len=*),
PARAMETER :: routinen =
'mc_molecule_rotation'
671 INTEGER :: atom_number, dir, end_atom, end_mol, handle, ii, imolecule, ipart, iunit, jbox, &
672 molecule_number, nunits_mol, source, start_mol
673 INTEGER,
DIMENSION(:),
POINTER :: mol_type, nunits, nunits_tot
674 INTEGER,
DIMENSION(:, :),
POINTER :: nchains
675 LOGICAL :: ionode, lbias, loverlap, lx, ly
676 REAL(
dp),
DIMENSION(:),
POINTER :: rmrot
677 REAL(
dp),
DIMENSION(:, :),
POINTER :: mass
678 REAL(kind=
dp) :: beta, bias_energy_new, bias_energy_old, cosdg, dgamma, exp_max_val, &
679 exp_min_val, masstot, nxcm, nycm, nzcm, rand, rx, rxnew, ry, rynew, rz, rznew, sindg, &
681 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r_old
689 CALL timeset(routinen, handle)
691 NULLIFY (rmrot, subsys, particles)
695 beta=beta, exp_max_val=exp_max_val, &
696 exp_min_val=exp_min_val, rmrot=rmrot, mc_molecule_info=mc_molecule_info, &
697 ionode=ionode, group=group, source=source)
699 nunits_tot=nunits_tot, nchains=nchains, mass=mass, &
704 DO jbox = 1, box_number - 1
705 start_mol = start_mol + sum(nchains(:, jbox))
707 end_mol = start_mol + sum(nchains(:, box_number)) - 1
709 nunits_mol = nunits(molecule_type)
712 NULLIFY (particles, subsys)
715 ALLOCATE (r_old(1:3, 1:nunits_tot(box_number)))
723 end_atom = start_atom + nunits_mol - 1
726 DO imolecule = 1, sum(nchains(:, box_number))
727 IF (atom_number == start_atom)
THEN
728 molecule_number = imolecule
731 atom_number = atom_number + nunits(mol_type(imolecule + start_mol - 1))
733 IF (molecule_number == 0) cpabort(
'Cannot find the molecule number')
743 DO ipart = 1, nunits_tot(box_number)
744 r_old(1:3, ipart) = particles%els(ipart)%r(1:3)
748 bias_energy_old = bias_energy
758 masstot = sum(mass(1:nunits(molecule_type), molecule_type))
761 moves%bias_rot%attempts = moves%bias_rot%attempts + 1
762 move_updates%bias_rot%attempts = move_updates%bias_rot%attempts + 1
763 moves%rot%attempts = moves%rot%attempts + 1
764 move_updates%rot%attempts = move_updates%rot%attempts + 1
765 IF (.NOT. lbias)
THEN
766 moves%rot%qsuccesses = moves%rot%qsuccesses + 1
767 move_updates%rot%qsuccesses = move_updates%rot%qsuccesses + 1
768 moves%bias_rot%qsuccesses = moves%bias_rot%qsuccesses + 1
769 move_updates%bias_rot%qsuccesses = move_updates%bias_rot%qsuccesses + 1
775 IF (ionode) rand = rng_stream%next()
777 CALL group%bcast(rand, source)
779 dir = int(3*rand) + 1
783 ELSEIF (dir .EQ. 2)
THEN
792 DO ii = 1, nunits_mol
793 nxcm = nxcm + particles%els(start_atom - 1 + ii)%r(1)*mass(ii, molecule_type)
794 nycm = nycm + particles%els(start_atom - 1 + ii)%r(2)*mass(ii, molecule_type)
795 nzcm = nzcm + particles%els(start_atom - 1 + ii)%r(3)*mass(ii, molecule_type)
802 IF (ionode) rand = rng_stream%next()
803 CALL group%bcast(rand, source)
804 dgamma = rmrot(molecule_type)*(rand - 0.5e0_dp)*2.0e0_dp
815 DO iunit = start_atom, end_atom
816 ry = particles%els(iunit)%r(2) - nycm
817 rz = particles%els(iunit)%r(3) - nzcm
818 rynew = cosdg*ry - sindg*rz
819 rznew = cosdg*rz + sindg*ry
821 particles%els(iunit)%r(2) = rynew + nycm
822 particles%els(iunit)%r(3) = rznew + nzcm
829 DO iunit = start_atom, end_atom
830 rx = particles%els(iunit)%r(1) - nxcm
831 rz = particles%els(iunit)%r(3) - nzcm
832 rxnew = cosdg*rx + sindg*rz
833 rznew = cosdg*rz - sindg*rx
835 particles%els(iunit)%r(1) = rxnew + nxcm
836 particles%els(iunit)%r(3) = rznew + nzcm
844 DO iunit = start_atom, end_atom
845 rx = particles%els(iunit)%r(1) - nxcm
846 ry = particles%els(iunit)%r(2) - nycm
848 rxnew = cosdg*rx - sindg*ry
849 rynew = cosdg*ry + sindg*rx
851 particles%els(iunit)%r(1) = rxnew + nxcm
852 particles%els(iunit)%r(2) = rynew + nycm
863 nunits(:), loverlap, mol_type(start_mol:end_mol), &
864 molecule_number=molecule_number)
867 nunits(:), loverlap, mol_type(start_mol:end_mol), &
868 molecule_number=molecule_number)
869 IF (loverlap) lreject = .true.
882 potential_energy=bias_energy_new)
884 value = -beta*(bias_energy_new - bias_energy_old)
885 IF (
value .GT. exp_max_val)
THEN
887 ELSEIF (
value .LT. exp_min_val)
THEN
895 IF (w .GE. 1.0e0_dp)
THEN
899 IF (ionode) rand = rng_stream%next()
900 CALL group%bcast(rand, source)
903 IF (rand .LT. w)
THEN
906 moves%bias_rot%successes = moves%bias_rot%successes + 1
907 move_updates%bias_rot%successes = move_updates%bias_rot%successes + 1
908 moves%rot%qsuccesses = moves%rot%qsuccesses + 1
909 move_updates%rot%successes = move_updates%rot%successes + 1
910 bias_energy = bias_energy + bias_energy_new - &
919 DO ipart = 1, nunits_tot(box_number)
920 particles%els(ipart)%r(1:3) = r_old(1:3, ipart)
932 CALL timestop(handle)
960 old_energy, box_number, &
961 energy_check, r_old, iw, discrete_array, rng_stream)
966 REAL(kind=
dp),
INTENT(INOUT) :: old_energy
967 INTEGER,
INTENT(IN) :: box_number
968 REAL(kind=
dp),
INTENT(INOUT) :: energy_check
969 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: r_old
970 INTEGER,
INTENT(IN) :: iw
971 INTEGER,
DIMENSION(1:3, 1:2),
INTENT(INOUT) :: discrete_array
974 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mc_volume_move'
977 CHARACTER(LEN=40) :: dat_file
978 INTEGER :: cl, end_atom, end_mol, handle, iatom, idim, imolecule, iside, iside_change, &
979 iunit, jbox, nunits_mol, output_unit, print_level, source, start_atom, start_mol
980 INTEGER,
DIMENSION(:),
POINTER :: mol_type, nunits, nunits_tot
981 INTEGER,
DIMENSION(:, :),
POINTER :: nchains
982 LOGICAL :: ionode, ldiscrete, lincrease, loverlap, &
984 REAL(
dp),
DIMENSION(:, :),
POINTER :: mass
985 REAL(kind=
dp) :: beta, discrete_step, energy_term, exp_max_val, exp_min_val, new_energy, &
986 pressure, pressure_term, rand, rcut, rmvolume, temp_var,
value, vol_dis, volume_term, w
987 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r
988 REAL(kind=
dp),
DIMENSION(1:3) :: abc, center_of_mass, center_of_mass_new, &
989 diff, new_cell_length, old_cell_length
990 REAL(kind=
dp),
DIMENSION(1:3, 1:3) :: hmat_test
991 TYPE(
cell_type),
POINTER :: cell, cell_old, cell_test
1000 CALL timeset(routinen, handle)
1004 beta=beta, exp_max_val=exp_max_val, &
1005 exp_min_val=exp_min_val, source=source, group=group, &
1006 dat_file=dat_file, rmvolume=rmvolume, pressure=pressure, cl=cl, &
1008 ldiscrete=ldiscrete, mc_molecule_info=mc_molecule_info)
1010 nunits=nunits, nunits_tot=nunits_tot, mol_type=mol_type, &
1014 DO jbox = 1, box_number - 1
1015 start_mol = start_mol + sum(nchains(:, jbox))
1017 end_mol = start_mol + sum(nchains(:, box_number)) - 1
1022 NULLIFY (particles_old, cell_old, oldsys, cell_test, cell)
1025 ALLOCATE (r(1:3, 1:nunits_tot(box_number)))
1028 moves%volume%attempts = moves%volume%attempts + 1
1029 move_updates%volume%attempts = move_updates%volume%attempts + 1
1035 CALL cell_clone(cell, cell_old, tag=
"CELL_OLD")
1039 old_cell_length(1) = abc(1)
1040 old_cell_length(2) = abc(2)
1041 old_cell_length(3) = abc(3)
1044 DO iatom = 1, nunits_tot(box_number)
1045 r(1:3, iatom) = particles_old%els(iatom)%r(1:3)
1051 IF (ionode) rand = rng_stream%next()
1052 CALL group%bcast(rand, source)
1056 IF (rand .LT. 0.5_dp)
THEN
1062 new_cell_length(1:3) = old_cell_length(1:3)
1067 IF (ionode) rand = rng_stream%next()
1068 CALL group%bcast(rand, source)
1069 iside_change = ceiling(3.0_dp*rand)
1070 IF (discrete_array(iside_change, 1) .EQ. 1)
THEN
1071 new_cell_length(iside_change) = &
1072 new_cell_length(iside_change) + discrete_step
1078 IF (ionode) rand = rng_stream%next()
1079 CALL group%bcast(rand, source)
1080 iside_change = ceiling(3.0_dp*rand)
1081 IF (discrete_array(iside_change, 2) .EQ. 1)
THEN
1082 new_cell_length(iside_change) = &
1083 new_cell_length(iside_change) - discrete_step
1088 vol_dis = (new_cell_length(1)*new_cell_length(2)*new_cell_length(3)) &
1089 - old_cell_length(1)*old_cell_length(2)*old_cell_length(3)
1093 vol_dis = rmvolume*(rand - 0.5e0_dp)*2.0e0_dp
1102 temp_var = vol_dis + &
1103 old_cell_length(1)*old_cell_length(2)* &
1106 IF (temp_var .LE. 0.0e0_dp)
THEN
1109 new_cell_length(1) = (temp_var)**(1.0e0_dp/3.0e0_dp)
1110 new_cell_length(2) = new_cell_length(1)
1111 new_cell_length(3) = new_cell_length(1)
1115 CALL group%bcast(loverlap, source)
1122 IF (output_unit > 0)
WRITE (output_unit, *) &
1123 "Volume move rejected because we tried to make too small of box.", vol_dis
1125 CALL timestop(handle)
1130 hmat_test(:, :) = 0.0e0_dp
1131 hmat_test(1, 1) = new_cell_length(1)
1132 hmat_test(2, 2) = new_cell_length(2)
1133 hmat_test(3, 3) = new_cell_length(3)
1134 CALL cell_create(cell_test, hmat=hmat_test(:, :), periodic=cell%perd)
1144 DO imolecule = 1, sum(nchains(:, box_number))
1145 nunits_mol = nunits(mol_type(imolecule + start_mol - 1))
1146 start_atom = end_atom + 1
1147 end_atom = start_atom + nunits_mol - 1
1150 center_of_mass(:), mass(:, mol_type(imolecule + start_mol - 1)))
1155 center_of_mass_new(iside) = center_of_mass(iside)* &
1156 new_cell_length(iside)/old_cell_length(iside)
1160 diff(idim) = center_of_mass_new(idim) - center_of_mass(idim)
1162 DO iunit = start_atom, end_atom
1163 particles_old%els(iunit)%r(idim) = &
1164 particles_old%els(iunit)%r(idim) + diff(idim)
1171 nunits(:), loverlap, mol_type(start_mol:end_mol), &
1172 cell_length=new_cell_length)
1175 CALL group%bcast(loverlap, source)
1182 IF (output_unit > 0)
WRITE (output_unit, *) &
1183 "Volume move rejected due to overlap.", vol_dis
1185 CALL timestop(handle)
1188 DO iatom = 1, nunits_tot(box_number)
1189 particles_old%els(iatom)%r(1:3) = r_old(1:3, iatom)
1196 ltoo_small = .false.
1199 IF (new_cell_length(1) .LT. 2.0_dp*rcut) ltoo_small = .true.
1200 IF (new_cell_length(2) .LT. 2.0_dp*rcut) ltoo_small = .true.
1201 IF (new_cell_length(3) .LT. 2.0_dp*rcut) ltoo_small = .true.
1203 IF (ltoo_small)
THEN
1204 WRITE (iw, *)
'new_cell_lengths ', &
1206 WRITE (iw, *)
'rcut ', rcut/
angstrom
1210 CALL group%bcast(ltoo_small, source)
1212 cpabort(
"Attempted a volume move where box size got too small.")
1217 potential_energy=new_energy)
1221 energy_term = new_energy - old_energy
1222 volume_term = -real(sum(nchains(:, box_number)),
dp)/beta* &
1223 log(new_cell_length(1)*new_cell_length(2)*new_cell_length(3)/ &
1224 (old_cell_length(1)*old_cell_length(2)*old_cell_length(3)))
1225 pressure_term = pressure*vol_dis
1227 value = -beta*(energy_term + volume_term + pressure_term)
1228 IF (
value .GT. exp_max_val)
THEN
1230 ELSEIF (
value .LT. exp_min_val)
THEN
1240 IF (w .GE. 1.0e0_dp)
THEN
1244 IF (ionode) rand = rng_stream%next()
1245 CALL group%bcast(rand, source)
1248 IF (rand .LT. w)
THEN
1251 moves%volume%successes = moves%volume%successes + 1
1252 move_updates%volume%successes = move_updates%volume%successes + 1
1255 energy_check = energy_check + (new_energy - old_energy)
1256 old_energy = new_energy
1258 DO iatom = 1, nunits_tot(box_number)
1259 r_old(1:3, iatom) = particles_old%els(iatom)%r(1:3)
1265 discrete_array(:, :), discrete_step)
1272 DO iatom = 1, nunits_tot(box_number)
1273 particles_old%els(iatom)%r(1:3) = r_old(1:3, iatom)
1284 CALL timestop(handle)
1305 SUBROUTINE change_bond_length(r_old, r_new, mc_par, molecule_type, molecule_kind, &
1306 dis_length, particles, rng_stream)
1308 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: r_old
1309 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: r_new
1311 INTEGER,
INTENT(IN) :: molecule_type
1313 REAL(kind=
dp),
INTENT(OUT) :: dis_length
1317 CHARACTER(len=*),
PARAMETER :: routinen =
'change_bond_length'
1319 INTEGER :: bond_number, handle, i, iatom, ibond, &
1320 ipart, natom, nbond, source
1321 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_a, atom_b, counter
1322 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: connection, connectivity
1323 INTEGER,
DIMENSION(:),
POINTER :: nunits
1325 REAL(
dp),
DIMENSION(:),
POINTER :: rmbond
1326 REAL(kind=
dp) :: atom_mass, mass_a, mass_b, new_length_a, &
1327 new_length_b, old_length, rand
1328 REAL(kind=
dp),
DIMENSION(1:3) :: bond_a, bond_b
1329 TYPE(
bond_type),
DIMENSION(:),
POINTER :: bond_list
1335 CALL timeset(routinen, handle)
1337 NULLIFY (rmbond, mc_molecule_info)
1340 CALL get_mc_par(mc_par, mc_molecule_info=mc_molecule_info, source=source, &
1341 group=group, rmbond=rmbond, ionode=ionode)
1345 DO ipart = 1, nunits(molecule_type)
1346 r_new(1:3, ipart) = r_old(1:3, ipart)
1351 rand = rng_stream%next()
1353 CALL group%bcast(rand, source)
1355 bond_list=bond_list)
1356 bond_number = ceiling(rand*real(nbond,
dp))
1358 ALLOCATE (connection(1:natom, 1:2))
1360 ALLOCATE (connectivity(1:6, 1:natom))
1361 ALLOCATE (counter(1:natom))
1362 ALLOCATE (atom_a(1:natom))
1363 ALLOCATE (atom_b(1:natom))
1364 connection(:, :) = 0
1365 connectivity(:, :) = 0
1374 IF (bond_list(ibond)%a == iatom)
THEN
1375 counter(iatom) = counter(iatom) + 1
1376 connectivity(counter(iatom), iatom) = bond_list(ibond)%b
1377 ELSEIF (bond_list(ibond)%b == iatom)
THEN
1378 counter(iatom) = counter(iatom) + 1
1379 connectivity(counter(iatom), iatom) = bond_list(ibond)%a
1387 atom_a(bond_list(bond_number)%a) = 1
1388 CALL depth_first_search(bond_list(bond_number)%a, bond_list(bond_number)%b, &
1389 connectivity(:, :), atom_a(:))
1391 atom_b(bond_list(bond_number)%b) = 1
1392 CALL depth_first_search(bond_list(bond_number)%b, bond_list(bond_number)%a, &
1393 connectivity(:, :), atom_b(:))
1402 IF (atom_a(iatom) == 1)
THEN
1403 mass_a = mass_a + atom_mass
1405 mass_b = mass_b + atom_mass
1410 IF (ionode) rand = rng_stream%next()
1411 CALL group%bcast(rand, source)
1413 dis_length = rmbond(molecule_type)*2.0e0_dp*(rand - 0.5e0_dp)
1417 bond_a(i) = r_new(i, bond_list(bond_number)%a) - &
1418 r_new(i, bond_list(bond_number)%b)
1419 bond_b(i) = -bond_a(i)
1424 old_length = sqrt(dot_product(bond_a, bond_a))
1425 new_length_a = dis_length*mass_b/(mass_a + mass_b)
1426 new_length_b = dis_length*mass_a/(mass_a + mass_b)
1429 bond_a(i) = bond_a(i)/old_length*new_length_a
1430 bond_b(i) = bond_b(i)/old_length*new_length_b
1434 IF (atom_a(iatom) == 1)
THEN
1435 r_new(1, iatom) = r_new(1, iatom) + bond_a(1)
1436 r_new(2, iatom) = r_new(2, iatom) + bond_a(2)
1437 r_new(3, iatom) = r_new(3, iatom) + bond_a(3)
1439 r_new(1, iatom) = r_new(1, iatom) + bond_b(1)
1440 r_new(2, iatom) = r_new(2, iatom) + bond_b(2)
1441 r_new(3, iatom) = r_new(3, iatom) + bond_b(3)
1446 dis_length = (old_length + dis_length)/old_length
1448 DEALLOCATE (connection)
1449 DEALLOCATE (connectivity)
1450 DEALLOCATE (counter)
1454 CALL timestop(handle)
1456 END SUBROUTINE change_bond_length
1473 SUBROUTINE change_bond_angle(r_old, r_new, mc_par, molecule_type, molecule_kind, &
1474 particles, rng_stream)
1476 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: r_old
1477 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: r_new
1479 INTEGER,
INTENT(IN) :: molecule_type
1484 CHARACTER(len=*),
PARAMETER :: routinen =
'change_bond_angle'
1486 INTEGER :: bend_number, handle, i, iatom, ibond, &
1487 ipart, natom, nbend, nbond, source
1488 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_a, atom_c, counter
1489 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: connection, connectivity
1490 INTEGER,
DIMENSION(:),
POINTER :: nunits
1492 REAL(
dp),
DIMENSION(:),
POINTER :: rmangle
1493 REAL(kind=
dp) :: atom_mass, bis_length, dis_angle, dis_angle_a, dis_angle_c, mass_a, mass_c, &
1494 new_angle_a, new_angle_c, old_angle, old_length_a, old_length_c, rand, temp_length
1495 REAL(kind=
dp),
DIMENSION(1:3) :: bisector, bond_a, bond_c, cross_prod, &
1496 cross_prod_plane, temp
1497 TYPE(
bend_type),
DIMENSION(:),
POINTER :: bend_list
1498 TYPE(
bond_type),
DIMENSION(:),
POINTER :: bond_list
1504 CALL timeset(routinen, handle)
1506 NULLIFY (bend_list, bond_list, rmangle, mc_molecule_info)
1509 CALL get_mc_par(mc_par, rmangle=rmangle, source=source, &
1510 group=group, ionode=ionode, mc_molecule_info=mc_molecule_info)
1514 DO ipart = 1, nunits(molecule_type)
1515 r_new(1:3, ipart) = r_old(1:3, ipart)
1520 rand = rng_stream%next()
1522 CALL group%bcast(rand, source)
1524 bend_list=bend_list, bond_list=bond_list, nbond=nbond)
1525 bend_number = ceiling(rand*real(nbend,
dp))
1527 ALLOCATE (connection(1:natom, 1:2))
1529 ALLOCATE (connectivity(1:6, 1:natom))
1530 ALLOCATE (counter(1:natom))
1531 ALLOCATE (atom_a(1:natom))
1532 ALLOCATE (atom_c(1:natom))
1533 connection(:, :) = 0
1534 connectivity(:, :) = 0
1543 IF (bond_list(ibond)%a == iatom)
THEN
1544 counter(iatom) = counter(iatom) + 1
1545 connectivity(counter(iatom), iatom) = bond_list(ibond)%b
1546 ELSEIF (bond_list(ibond)%b == iatom)
THEN
1547 counter(iatom) = counter(iatom) + 1
1548 connectivity(counter(iatom), iatom) = bond_list(ibond)%a
1556 atom_a(bend_list(bend_number)%a) = 1
1557 CALL depth_first_search(bend_list(bend_number)%a, bend_list(bend_number)%b, &
1558 connectivity(:, :), atom_a(:))
1560 atom_c(bend_list(bend_number)%c) = 1
1561 CALL depth_first_search(bend_list(bend_number)%c, bend_list(bend_number)%b, &
1562 connectivity(:, :), atom_c(:))
1571 IF (atom_a(iatom) == 1) mass_a = mass_a + atom_mass
1572 IF (atom_c(iatom) == 1) mass_c = mass_c + atom_mass
1576 IF (ionode) rand = rng_stream%next()
1577 CALL group%bcast(rand, source)
1579 dis_angle = rmangle(molecule_type)*2.0e0_dp*(rand - 0.5e0_dp)
1589 bond_a(i) = r_new(i, bend_list(bend_number)%a) - &
1590 r_new(i, bend_list(bend_number)%b)
1591 bond_c(i) = r_new(i, bend_list(bend_number)%c) - &
1592 r_new(i, bend_list(bend_number)%b)
1594 old_length_a = sqrt(dot_product(bond_a, bond_a))
1595 old_length_c = sqrt(dot_product(bond_c, bond_c))
1596 old_angle = acos(dot_product(bond_a, bond_c)/(old_length_a*old_length_c))
1599 bisector(i) = bond_a(i)/old_length_a + &
1600 bond_c(i)/old_length_c
1602 bis_length = sqrt(dot_product(bisector, bisector))
1603 bisector(1:3) = bisector(1:3)/bis_length
1607 cross_prod(1) = bond_a(2)*bond_c(3) - bond_a(3)*bond_c(2)
1608 cross_prod(2) = bond_a(3)*bond_c(1) - bond_a(1)*bond_c(3)
1609 cross_prod(3) = bond_a(1)*bond_c(2) - bond_a(2)*bond_c(1)
1610 cross_prod(1:3) = cross_prod(1:3)/sqrt(dot_product(cross_prod, cross_prod))
1613 cross_prod_plane(1) = cross_prod(2)*bisector(3) - cross_prod(3)*bisector(2)
1614 cross_prod_plane(2) = cross_prod(3)*bisector(1) - cross_prod(1)*bisector(3)
1615 cross_prod_plane(3) = cross_prod(1)*bisector(2) - cross_prod(2)*bisector(1)
1616 cross_prod_plane(1:3) = cross_prod_plane(1:3)/ &
1617 sqrt(dot_product(cross_prod_plane, cross_prod_plane))
1623 r_new(1:3, iatom) = r_new(1:3, iatom) - &
1624 r_old(1:3, bend_list(bend_number)%b)
1630 dis_angle_a = dis_angle*mass_c/(mass_a + mass_c)
1631 dis_angle_c = dis_angle*mass_a/(mass_a + mass_c)
1636 temp(1:3) = r_new(1:3, iatom) - &
1637 dot_product(cross_prod(1:3), r_new(1:3, iatom))* &
1639 temp_length = sqrt(dot_product(temp, temp))
1643 IF (atom_a(iatom) == 1)
THEN
1647 IF (dot_product(cross_prod_plane(1:3), r_new(1:3, iatom)) &
1651 new_angle_a = acos(dot_product(bisector, temp(1:3))/ &
1652 (temp_length)) + dis_angle_a
1654 r_new(1:3, iatom) = cos(new_angle_a)*temp_length*bisector(1:3) - &
1655 sin(new_angle_a)*temp_length*cross_prod_plane(1:3) + &
1656 dot_product(cross_prod(1:3), r_new(1:3, iatom))* &
1661 new_angle_a = acos(dot_product(bisector, temp(1:3))/ &
1662 (temp_length)) - dis_angle_a
1664 r_new(1:3, iatom) = cos(new_angle_a)*temp_length*bisector(1:3) + &
1665 sin(new_angle_a)*temp_length*cross_prod_plane(1:3) + &
1666 dot_product(cross_prod(1:3), r_new(1:3, iatom))* &
1670 ELSEIF (atom_c(iatom) == 1)
THEN
1674 IF (dot_product(cross_prod_plane(1:3), r_new(1:3, iatom)) &
1677 new_angle_c = acos(dot_product(bisector(1:3), temp(1:3))/ &
1678 (temp_length)) - dis_angle_c
1680 r_new(1:3, iatom) = cos(new_angle_c)*temp_length*bisector(1:3) - &
1681 sin(new_angle_c)*temp_length*cross_prod_plane(1:3) + &
1682 dot_product(cross_prod(1:3), r_new(1:3, iatom))* &
1685 new_angle_c = acos(dot_product(bisector(1:3), temp(1:3))/ &
1686 (temp_length)) + dis_angle_c
1688 r_new(1:3, iatom) = cos(new_angle_c)*temp_length*bisector(1:3) + &
1689 sin(new_angle_c)*temp_length*cross_prod_plane(1:3) + &
1690 dot_product(cross_prod(1:3), r_new(1:3, iatom))* &
1698 r_new(1:3, iatom) = r_new(1:3, iatom) + &
1699 r_old(1:3, bend_list(bend_number)%b)
1703 DEALLOCATE (connection)
1704 DEALLOCATE (connectivity)
1705 DEALLOCATE (counter)
1710 CALL timestop(handle)
1712 END SUBROUTINE change_bond_angle
1732 SUBROUTINE change_dihedral(r_old, r_new, mc_par, molecule_type, molecule_kind, &
1733 particles, rng_stream)
1735 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: r_old
1736 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: r_new
1738 INTEGER,
INTENT(IN) :: molecule_type
1743 CHARACTER(len=*),
PARAMETER :: routinen =
'change_dihedral'
1745 INTEGER :: handle, i, iatom, ibond, ipart, natom, &
1746 nbond, ntorsion, source, torsion_number
1747 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_a, atom_d, counter
1748 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: connection, connectivity
1749 INTEGER,
DIMENSION(:),
POINTER :: nunits
1751 REAL(
dp),
DIMENSION(:),
POINTER :: rmdihedral
1752 REAL(kind=
dp) :: atom_mass, dis_angle, dis_angle_a, &
1753 dis_angle_d, mass_a, mass_d, &
1754 old_length_a, rand, u, v, w, x, y, z
1755 REAL(kind=
dp),
DIMENSION(1:3) :: bond_a, temp
1756 TYPE(
bond_type),
DIMENSION(:),
POINTER :: bond_list
1759 TYPE(
torsion_type),
DIMENSION(:),
POINTER :: torsion_list
1763 CALL timeset(routinen, handle)
1765 NULLIFY (rmdihedral, torsion_list, bond_list, mc_molecule_info)
1768 CALL get_mc_par(mc_par, rmdihedral=rmdihedral, &
1769 source=source, group=group, ionode=ionode, &
1770 mc_molecule_info=mc_molecule_info)
1774 DO ipart = 1, nunits(molecule_type)
1775 r_new(1:3, ipart) = r_old(1:3, ipart)
1780 rand = rng_stream%next()
1783 CALL group%bcast(rand, source)
1785 bond_list=bond_list, nbond=nbond, &
1786 ntorsion=ntorsion, torsion_list=torsion_list)
1787 torsion_number = ceiling(rand*real(ntorsion,
dp))
1789 ALLOCATE (connection(1:natom, 1:2))
1791 ALLOCATE (connectivity(1:6, 1:natom))
1792 ALLOCATE (counter(1:natom))
1793 ALLOCATE (atom_a(1:natom))
1794 ALLOCATE (atom_d(1:natom))
1795 connection(:, :) = 0
1796 connectivity(:, :) = 0
1805 IF (bond_list(ibond)%a == iatom)
THEN
1806 counter(iatom) = counter(iatom) + 1
1807 connectivity(counter(iatom), iatom) = bond_list(ibond)%b
1808 ELSEIF (bond_list(ibond)%b == iatom)
THEN
1809 counter(iatom) = counter(iatom) + 1
1810 connectivity(counter(iatom), iatom) = bond_list(ibond)%a
1819 atom_a(torsion_list(torsion_number)%a) = 1
1820 CALL depth_first_search(torsion_list(torsion_number)%b, &
1821 torsion_list(torsion_number)%c, connectivity(:, :), atom_a(:))
1823 atom_d(torsion_list(torsion_number)%d) = 1
1824 CALL depth_first_search(torsion_list(torsion_number)%c, &
1825 torsion_list(torsion_number)%b, connectivity(:, :), atom_d(:))
1834 IF (atom_a(iatom) == 1) mass_a = mass_a + atom_mass
1835 IF (atom_d(iatom) == 1) mass_d = mass_d + atom_mass
1839 IF (ionode) rand = rng_stream%next()
1840 CALL group%bcast(rand, source)
1842 dis_angle = rmdihedral(molecule_type)*2.0e0_dp*(rand - 0.5e0_dp)
1846 bond_a(i) = r_new(i, torsion_list(torsion_number)%c) - &
1847 r_new(i, torsion_list(torsion_number)%b)
1849 old_length_a = sqrt(dot_product(bond_a, bond_a))
1850 bond_a(1:3) = bond_a(1:3)/old_length_a
1855 dis_angle_a = dis_angle*mass_d/(mass_a + mass_d)
1856 dis_angle_d = -dis_angle*mass_a/(mass_a + mass_d)
1860 IF (atom_a(iatom) == 1)
THEN
1862 r_new(1:3, iatom) = r_new(1:3, iatom) - &
1863 r_new(1:3, torsion_list(torsion_number)%b)
1872 temp(1) = (u*(u*x + v*y + w*z) + (x*(v**2 + w**2) - u*(v*y + w*z))*cos(dis_angle_a) + &
1873 sqrt(u**2 + v**2 + w**2)*(v*z - w*y)*sin(dis_angle_a))/(u**2 + v**2 + w**2)
1874 temp(2) = (v*(u*x + v*y + w*z) + (y*(u**2 + w**2) - v*(u*x + w*z))*cos(dis_angle_a) + &
1875 sqrt(u**2 + v**2 + w**2)*(w*x - u*z)*sin(dis_angle_a))/(u**2 + v**2 + w**2)
1876 temp(3) = (w*(u*x + v*y + w*z) + (z*(v**2 + u**2) - w*(u*x + v*y))*cos(dis_angle_a) + &
1877 sqrt(u**2 + v**2 + w**2)*(u*y - v*x)*sin(dis_angle_a))/(u**2 + v**2 + w**2)
1880 temp(1:3) = temp(1:3) + r_new(1:3, torsion_list(torsion_number)%b)
1881 r_new(1:3, iatom) = temp(1:3)
1883 ELSEIF (atom_d(iatom) == 1)
THEN
1886 r_new(1:3, iatom) = r_new(1:3, iatom) - &
1887 r_new(1:3, torsion_list(torsion_number)%c)
1896 temp(1) = (u*(u*x + v*y + w*z) + (x*(v**2 + w**2) - u*(v*y + w*z))*cos(dis_angle_d) + &
1897 sqrt(u**2 + v**2 + w**2)*(v*z - w*y)*sin(dis_angle_d))/(u**2 + v**2 + w**2)
1898 temp(2) = (v*(u*x + v*y + w*z) + (y*(u**2 + w**2) - v*(u*x + w*z))*cos(dis_angle_d) + &
1899 sqrt(u**2 + v**2 + w**2)*(w*x - u*z)*sin(dis_angle_d))/(u**2 + v**2 + w**2)
1900 temp(3) = (w*(u*x + v*y + w*z) + (z*(v**2 + u**2) - w*(u*x + v*y))*cos(dis_angle_d) + &
1901 sqrt(u**2 + v**2 + w**2)*(u*y - v*x)*sin(dis_angle_d))/(u**2 + v**2 + w**2)
1904 temp(1:3) = temp(1:3) + r_new(1:3, torsion_list(torsion_number)%c)
1905 r_new(1:3, iatom) = temp(1:3)
1910 DEALLOCATE (connection)
1911 DEALLOCATE (connectivity)
1912 DEALLOCATE (counter)
1917 CALL timestop(handle)
1919 END SUBROUTINE change_dihedral
1946 energy_check, r_old, old_energy, start_atom_swap, &
1948 molecule_type, box_number, bias_energy_old, last_bias_energy, &
1949 move_type, rng_stream)
1954 REAL(kind=
dp),
INTENT(INOUT) :: energy_check
1955 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: r_old
1956 REAL(kind=
dp),
INTENT(INOUT) :: old_energy
1957 INTEGER,
INTENT(IN) :: start_atom_swap, target_atom, &
1958 molecule_type, box_number
1959 REAL(kind=
dp),
INTENT(INOUT) :: bias_energy_old, last_bias_energy
1960 CHARACTER(LEN=*),
INTENT(IN) :: move_type
1963 CHARACTER(len=*),
PARAMETER :: routinen =
'mc_avbmc_move'
1965 INTEGER :: end_mol, handle, ipart, jbox, natom, &
1966 nswapmoves, source, start_mol
1967 INTEGER,
DIMENSION(:),
POINTER :: avbmc_atom, mol_type, nunits, nunits_tot
1968 INTEGER,
DIMENSION(:, :),
POINTER :: nchains
1969 LOGICAL :: ionode, lbias, ldum, lin, loverlap
1970 REAL(
dp),
DIMENSION(:),
POINTER :: avbmc_rmax, avbmc_rmin, pbias
1971 REAL(
dp),
DIMENSION(:, :),
POINTER :: mass
1972 REAL(kind=
dp) :: beta, bias_energy_new, del_quickstep_energy, distance, exp_max_val, &
1973 exp_min_val, max_val, min_val, new_energy, prefactor, rand, rdum, volume_in, volume_out, &
1974 w, weight_new, weight_old
1975 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r_new
1976 REAL(kind=
dp),
DIMENSION(1:3) :: abc, rij
1988 CALL timeset(routinen, handle)
1992 beta=beta, max_val=max_val, min_val=min_val, exp_max_val=exp_max_val, &
1993 exp_min_val=exp_min_val, avbmc_atom=avbmc_atom, &
1994 avbmc_rmin=avbmc_rmin, avbmc_rmax=avbmc_rmax, &
1995 nswapmoves=nswapmoves, ionode=ionode, source=source, &
1996 group=group, pbias=pbias, mc_molecule_info=mc_molecule_info)
1998 mass=mass, nunits=nunits, nunits_tot=nunits_tot, mol_type=mol_type)
2001 DO jbox = 1, box_number - 1
2002 start_mol = start_mol + sum(nchains(:, jbox))
2004 end_mol = start_mol + sum(nchains(:, box_number)) - 1
2007 NULLIFY (particles, subsys, molecule_kinds, molecule_kind, &
2008 particles_force, subsys_force)
2011 ALLOCATE (r_new(1:3, 1:nunits_tot(box_number)))
2020 particles=particles, molecule_kinds=molecule_kinds)
2021 molecule_kind => molecule_kinds%els(1)
2033 particles=particles, molecule_kinds=molecule_kinds)
2034 molecule_kind => molecule_kinds%els(1)
2042 rij(1) = particles%els(start_atom_swap + avbmc_atom(molecule_type) - 1)%r(1) - &
2043 particles%els(target_atom)%r(1) - abc(1)*anint( &
2044 (particles%els(start_atom_swap + avbmc_atom(molecule_type) - 1)%r(1) - &
2045 particles%els(target_atom)%r(1))/abc(1))
2046 rij(2) = particles%els(start_atom_swap + avbmc_atom(molecule_type) - 1)%r(2) - &
2047 particles%els(target_atom)%r(2) - abc(2)*anint( &
2048 (particles%els(start_atom_swap + avbmc_atom(molecule_type) - 1)%r(2) - &
2049 particles%els(target_atom)%r(2))/abc(2))
2050 rij(3) = particles%els(start_atom_swap + avbmc_atom(molecule_type) - 1)%r(3) - &
2051 particles%els(target_atom)%r(3) - abc(3)*anint( &
2052 (particles%els(start_atom_swap + avbmc_atom(molecule_type) - 1)%r(3) - &
2053 particles%els(target_atom)%r(3))/abc(3))
2054 distance = sqrt(rij(1)**2 + rij(2)**2 + rij(3)**2)
2055 IF (distance .LE. avbmc_rmax(molecule_type) .AND. distance .GE. avbmc_rmin(molecule_type))
THEN
2064 IF (move_type ==
'in')
THEN
2065 moves%avbmc_inin%attempts = &
2066 moves%avbmc_inin%attempts + 1
2068 moves%avbmc_inout%attempts = &
2069 moves%avbmc_inout%attempts + 1
2072 IF (move_type ==
'in')
THEN
2073 moves%avbmc_outin%attempts = &
2074 moves%avbmc_outin%attempts + 1
2076 moves%avbmc_outout%attempts = &
2077 moves%avbmc_outout%attempts + 1
2083 IF (move_type ==
'in')
THEN
2087 exp_min_val, nswapmoves, &
2088 weight_old, start_atom_swap, nunits_tot(box_number), nunits, nunits(molecule_type), &
2089 mass(:, molecule_type), ldum, rdum, &
2090 bias_energy_old, ionode, .true., mol_type(start_mol:end_mol), nchains(:, box_number), &
2091 source, group, rng_stream, &
2092 avbmc_atom=avbmc_atom(molecule_type), &
2093 rmin=avbmc_rmin(molecule_type), rmax=avbmc_rmax(molecule_type), move_type=
'out', &
2094 target_atom=target_atom)
2100 exp_min_val, nswapmoves, &
2101 weight_old, start_atom_swap, nunits_tot(box_number), nunits, nunits(molecule_type), &
2102 mass(:, molecule_type), ldum, rdum, &
2103 bias_energy_old, ionode, .true., mol_type(start_mol:end_mol), nchains(:, box_number), &
2104 source, group, rng_stream, &
2105 avbmc_atom=avbmc_atom(molecule_type), &
2106 rmin=avbmc_rmin(molecule_type), rmax=avbmc_rmax(molecule_type), move_type=
'in', &
2107 target_atom=target_atom)
2113 exp_min_val, nswapmoves, &
2114 weight_new, start_atom_swap, nunits_tot(box_number), nunits, nunits(molecule_type), &
2115 mass(:, molecule_type), loverlap, bias_energy_new, &
2116 bias_energy_old, ionode, .false., mol_type(start_mol:end_mol), nchains(:, box_number), &
2117 source, group, rng_stream, &
2118 avbmc_atom=avbmc_atom(molecule_type), &
2119 rmin=avbmc_rmin(molecule_type), rmax=avbmc_rmax(molecule_type), move_type=move_type, &
2120 target_atom=target_atom)
2126 bias_energy_new = bias_energy_new + bias_energy_old
2130 IF (move_type ==
'in')
THEN
2134 exp_min_val, nswapmoves, &
2135 weight_old, start_atom_swap, nunits_tot(box_number), nunits, nunits(molecule_type), &
2136 mass(:, molecule_type), ldum, rdum, old_energy, &
2137 ionode, .true., mol_type(start_mol:end_mol), nchains(:, box_number), &
2138 source, group, rng_stream, &
2139 avbmc_atom=avbmc_atom(molecule_type), &
2140 rmin=avbmc_rmin(molecule_type), rmax=avbmc_rmax(molecule_type), move_type=
'out', &
2141 target_atom=target_atom)
2147 exp_min_val, nswapmoves, &
2148 weight_old, start_atom_swap, nunits_tot(box_number), nunits, nunits(molecule_type), &
2149 mass(:, molecule_type), ldum, rdum, old_energy, &
2150 ionode, .true., mol_type(start_mol:end_mol), nchains(:, box_number), &
2151 source, group, rng_stream, &
2152 avbmc_atom=avbmc_atom(molecule_type), &
2153 rmin=avbmc_rmin(molecule_type), rmax=avbmc_rmax(molecule_type), move_type=
'in', &
2154 target_atom=target_atom)
2160 exp_min_val, nswapmoves, &
2161 weight_new, start_atom_swap, nunits_tot(box_number), nunits, nunits(molecule_type), &
2162 mass(:, molecule_type), loverlap, new_energy, old_energy, &
2163 ionode, .false., mol_type(start_mol:end_mol), nchains(:, box_number), &
2164 source, group, rng_stream, &
2165 avbmc_atom=avbmc_atom(molecule_type), &
2166 rmin=avbmc_rmin(molecule_type), rmax=avbmc_rmax(molecule_type), move_type=move_type, &
2167 target_atom=target_atom)
2182 DO ipart = 1, nunits_tot(box_number)
2183 particles%els(ipart)%r(1:3) = r_old(1:3, ipart)
2186 CALL timestop(handle)
2199 DO ipart = 1, nunits_tot(box_number)
2200 particles_force%els(ipart)%r(1:3) = particles%els(ipart)%r(1:3)
2206 potential_energy=new_energy)
2210 volume_in = 4.0_dp/3.0_dp*
pi*(avbmc_rmax(molecule_type)**3 - avbmc_rmin(molecule_type)**3)
2211 volume_out = abc(1)*abc(2)*abc(3) - volume_in
2213 IF (lin .AND. move_type ==
'in' .OR. &
2214 .NOT. lin .AND. move_type ==
'out')
THEN
2217 ELSEIF (.NOT. lin .AND. move_type ==
'in')
THEN
2218 prefactor = (1.0_dp - pbias(molecule_type))*volume_in/(pbias(molecule_type)*volume_out)
2220 prefactor = pbias(molecule_type)*volume_out/((1.0_dp - pbias(molecule_type))*volume_in)
2227 del_quickstep_energy = (-beta)*(new_energy - old_energy - &
2228 (bias_energy_new - bias_energy_old))
2230 IF (del_quickstep_energy .GT. exp_max_val)
THEN
2231 del_quickstep_energy = max_val
2232 ELSEIF (del_quickstep_energy .LT. exp_min_val)
THEN
2233 del_quickstep_energy = 0.0_dp
2235 del_quickstep_energy = exp(del_quickstep_energy)
2238 w = prefactor*del_quickstep_energy*weight_new/weight_old
2243 w = prefactor*weight_new/weight_old
2247 IF (w .GE. 1.0e0_dp)
THEN
2250 IF (ionode) rand = rng_stream%next()
2251 CALL group%bcast(rand, source)
2254 IF (rand .LT. w)
THEN
2259 IF (move_type ==
'in')
THEN
2260 moves%avbmc_inin%successes = &
2261 moves%avbmc_inin%successes + 1
2263 moves%avbmc_inout%successes = &
2264 moves%avbmc_inout%successes + 1
2267 IF (move_type ==
'in')
THEN
2268 moves%avbmc_outin%successes = &
2269 moves%avbmc_outin%successes + 1
2271 moves%avbmc_outout%successes = &
2272 moves%avbmc_outout%successes + 1
2278 IF (.NOT. lbias)
THEN
2279 new_energy = new_energy + old_energy
2283 energy_check = energy_check + (new_energy - old_energy)
2284 old_energy = new_energy
2289 last_bias_energy = bias_energy_new
2290 bias_energy_old = bias_energy_new
2296 DO ipart = 1, nunits_tot(box_number)
2297 r_old(1:3, ipart) = particles%els(ipart)%r(1:3)
2304 DO ipart = 1, nunits_tot(box_number)
2305 particles%els(ipart)%r(1:3) = r_old(1:3, ipart)
2311 DO ipart = 1, nunits_tot(box_number)
2312 particles%els(ipart)%r(1:3) = r_old(1:3, ipart)
2321 CALL timestop(handle)
2346 SUBROUTINE mc_hmc_move(mc_par, force_env, globenv, moves, move_updates, &
2347 old_energy, box_number, &
2348 energy_check, r_old, rng_stream)
2354 REAL(kind=
dp),
INTENT(INOUT) :: old_energy
2355 INTEGER,
INTENT(IN) :: box_number
2356 REAL(kind=
dp),
INTENT(INOUT) :: energy_check
2357 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: r_old
2360 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mc_hmc_move'
2362 INTEGER :: handle, iatom, source
2363 INTEGER,
DIMENSION(:),
POINTER :: nunits_tot
2365 REAL(kind=
dp) :: beta, energy_term, exp_max_val, &
2366 exp_min_val, new_energy, rand,
value, w
2367 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r
2376 CALL timeset(routinen, handle)
2380 beta=beta, exp_max_val=exp_max_val, &
2381 exp_min_val=exp_min_val, source=source, group=group, &
2382 mc_molecule_info=mc_molecule_info)
2386 NULLIFY (particles_old, oldsys, hmc_ekin)
2389 ALLOCATE (r(1:3, 1:nunits_tot(box_number)))
2393 moves%hmc%attempts = moves%hmc%attempts + 1
2394 move_updates%hmc%attempts = move_updates%hmc%attempts + 1
2401 DO iatom = 1, nunits_tot(box_number)
2402 r(1:3, iatom) = particles_old%els(iatom)%r(1:3)
2406 CALL qs_mol_dyn(force_env, globenv, hmc_e_initial=hmc_ekin%initial_ekin, hmc_e_final=hmc_ekin%final_ekin)
2410 potential_energy=new_energy)
2414 energy_term = new_energy + hmc_ekin%final_ekin - old_energy - hmc_ekin%initial_ekin
2416 value = -beta*(energy_term)
2417 IF (
value .GT. exp_max_val)
THEN
2419 ELSEIF (
value .LT. exp_min_val)
THEN
2425 IF (w .GE. 1.0e0_dp)
THEN
2429 IF (ionode) rand = rng_stream%next()
2430 CALL group%bcast(rand, source)
2433 IF (rand .LT. w)
THEN
2436 moves%hmc%successes = moves%hmc%successes + 1
2437 move_updates%hmc%successes = move_updates%hmc%successes + 1
2440 energy_check = energy_check + (new_energy - old_energy)
2441 old_energy = new_energy
2443 DO iatom = 1, nunits_tot(box_number)
2444 r_old(1:3, iatom) = particles_old%els(iatom)%r(1:3)
2450 DO iatom = 1, nunits_tot(box_number)
2451 particles_old%els(iatom)%r(1:3) = r_old(1:3, iatom)
2458 DEALLOCATE (hmc_ekin)
2461 CALL timestop(handle)
2486 move_updates, box_number, bias_energy, lreject, rng_stream)
2491 INTEGER,
INTENT(IN) :: box_number
2492 REAL(kind=
dp),
INTENT(INOUT) :: bias_energy
2493 LOGICAL,
INTENT(OUT) :: lreject
2496 CHARACTER(len=*),
PARAMETER :: routinen =
'mc_cluster_translation'
2498 INTEGER :: cstart, end_mol, handle, imol, ipart, iparticle, iunit, jbox, jpart, junit, &
2499 move_direction, nend, nunit, source, start_mol, total_clus, total_clusafmo
2500 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: cluster
2501 INTEGER,
DIMENSION(:),
POINTER :: mol_type, nunits, nunits_tot
2502 INTEGER,
DIMENSION(:, :),
POINTER :: nchains
2503 LOGICAL :: ionode, lbias, loverlap
2504 REAL(kind=
dp) :: beta, bias_energy_new, bias_energy_old, &
2505 dis_mol, exp_max_val, exp_min_val, &
2506 rand, rmcltrans,
value, w
2507 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r_old
2516 CALL timeset(routinen, handle)
2519 NULLIFY (particles, subsys)
2523 beta=beta, exp_max_val=exp_max_val, &
2524 exp_min_val=exp_min_val, rmcltrans=rmcltrans, ionode=ionode, source=source, &
2525 group=group, mc_molecule_info=mc_molecule_info)
2527 nchains=nchains, nunits=nunits, mol_type=mol_type)
2531 DO jbox = 1, box_number - 1
2532 start_mol = start_mol + sum(nchains(:, jbox))
2534 end_mol = start_mol + sum(nchains(:, box_number)) - 1
2537 ALLOCATE (r_old(1:3, 1:nunits_tot(box_number)))
2540 nend = sum(nchains(:, box_number))
2541 ALLOCATE (cluster(nend, nend))
2544 cluster(ipart, jpart) = 0
2550 CALL cluster_search(mc_par, bias_env, cluster, nchains(:, box_number), &
2551 nunits, mol_type(start_mol:end_mol), total_clus)
2553 CALL cluster_search(mc_par, force_env, cluster, nchains(:, box_number), &
2554 nunits, mol_type(start_mol:end_mol), total_clus)
2564 DO ipart = 1, nunits_tot(box_number)
2565 r_old(1:3, ipart) = particles%els(ipart)%r(1:3)
2569 bias_energy_old = bias_energy
2578 moves%cltrans%attempts = moves%cltrans%attempts + 1
2579 move_updates%cltrans%attempts = move_updates%cltrans%attempts + 1
2580 moves%bias_cltrans%attempts = moves%bias_cltrans%attempts + 1
2581 move_updates%bias_cltrans%attempts = move_updates%bias_cltrans%attempts + 1
2582 IF (.NOT. lbias)
THEN
2583 moves%cltrans%qsuccesses = moves%cltrans%qsuccesses + 1
2584 move_updates%cltrans%qsuccesses = move_updates%cltrans%qsuccesses + 1
2585 moves%bias_cltrans%qsuccesses = moves%bias_cltrans%qsuccesses + 1
2586 move_updates%bias_cltrans%qsuccesses = move_updates%bias_cltrans%qsuccesses + 1
2590 IF (ionode) rand = rng_stream%next()
2591 CALL group%bcast(rand, source)
2592 move_direction = int(3*rand) + 1
2595 IF (ionode) rand = rng_stream%next()
2596 CALL group%bcast(rand, source)
2597 dis_mol = rmcltrans*(rand - 0.5e0_dp)*2.0e0_dp
2600 IF (ionode) rand = rng_stream%next()
2601 CALL group%bcast(rand, source)
2602 jpart = int(1 + rand*total_clus)
2607 IF (cluster(jpart, cstart) .NE. 0)
THEN
2608 imol = cluster(jpart, cstart)
2610 DO ipart = 1, imol - 1
2611 nunit = nunits(mol_type(ipart + start_mol - 1))
2612 iunit = iunit + nunit
2614 nunit = nunits(mol_type(imol + start_mol - 1))
2615 junit = iunit + nunit - 1
2616 DO iparticle = iunit, junit
2617 particles%els(iparticle)%r(move_direction) = &
2618 particles%els(iparticle)%r(move_direction) + dis_mol
2627 cluster(ipart, jpart) = 0
2633 CALL cluster_search(mc_par, bias_env, cluster, nchains(:, box_number), &
2634 nunits, mol_type(start_mol:end_mol), total_clusafmo)
2636 CALL cluster_search(mc_par, force_env, cluster, nchains(:, box_number), &
2637 nunits, mol_type(start_mol:end_mol), total_clusafmo)
2644 nunits(:), loverlap, mol_type(start_mol:end_mol))
2647 nunits(:), loverlap, mol_type(start_mol:end_mol))
2648 IF (loverlap) lreject = .true.
2653 IF (total_clusafmo .NE. total_clus)
THEN
2657 IF (total_clusafmo .NE. total_clus)
THEN
2672 potential_energy=bias_energy_new)
2674 value = -beta*(bias_energy_new - bias_energy_old)
2675 IF (
value .GT. exp_max_val)
THEN
2677 ELSEIF (
value .LT. exp_min_val)
THEN
2685 IF (w .GE. 1.0e0_dp)
THEN
2689 IF (ionode) rand = rng_stream%next()
2690 CALL group%bcast(rand, source)
2692 IF (rand .LT. w)
THEN
2695 moves%bias_cltrans%successes = moves%bias_cltrans%successes + 1
2696 move_updates%bias_cltrans%successes = move_updates%bias_cltrans%successes + 1
2697 moves%cltrans%qsuccesses = moves%cltrans%qsuccesses + 1
2698 move_updates%cltrans%successes = &
2699 move_updates%cltrans%successes + 1
2700 moves%qcltrans_dis = moves%qcltrans_dis + abs(dis_mol)
2701 bias_energy = bias_energy + bias_energy_new - &
2710 DO ipart = 1, nunits_tot(box_number)
2711 particles%els(ipart)%r(1:3) = r_old(1:3, ipart)
2720 DEALLOCATE (cluster)
2724 CALL timestop(handle)
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
subroutine, public cell_create(cell, hmat, periodic, tag)
allocates and initializes a cell
Handles all functions related to the CELL.
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
subroutine, public cell_clone(cell_in, cell_out, tag)
Clone cell variable.
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell)
sets various propreties of the subsys
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell)
returns information about various attributes of the given subsys
Interface for the force calculations.
recursive subroutine, public force_env_calc_energy_force(force_env, calc_force, consistent_energies, skip_external_control, eval_energy_forces, require_consistent_energy_force, linres, calc_stress_tensor)
Interface routine for force and energy calculations.
Interface for the force calculations.
recursive subroutine, public force_env_get(force_env, in_use, fist_env, qs_env, meta_env, fp_env, subsys, para_env, potential_energy, additional_potential, kinetic_energy, harmonic_shell, kinetic_shell, cell, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, globenv, input, force_env_section, method_name_id, root_section, mixed_env, nnp_env, embed_env, ipi_env)
returns various attributes about the force environment
integer, parameter, public use_fist_force
Define type storing the global information of a run. Keep the amount of stored data small....
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
contains miscellaneous subroutines used in the Monte Carlo runs,mostly geared towards changes in coor...
subroutine, public generate_cbmc_swap_config(force_env, beta, max_val, min_val, exp_max_val, exp_min_val, nswapmoves, rosenbluth_weight, start_atom, natoms_tot, nunits, nunits_mol, mass, loverlap, choosen_energy, old_energy, ionode, lremove, mol_type, nchains, source, group, rng_stream, avbmc_atom, rmin, rmax, move_type, target_atom)
takes the last molecule in a force environment and moves it around to different center of mass positi...
subroutine, public get_center_of_mass(coordinates, natom, center_of_mass, mass)
calculates the center of mass of a given molecule
subroutine, public check_for_overlap(force_env, nchains, nunits, loverlap, mol_type, cell_length, molecule_number)
looks for overlaps (intermolecular distances less than rmin)
subroutine, public create_discrete_array(cell, discrete_array, step_size)
generates an array that tells us which sides of the simulation cell we can increase or decrease using...
subroutine, public cluster_search(mc_par, force_env, cluster, nchains, nunits, mol_type, total_clus)
determine the number of cluster present in the given configuration based on the rclus value
the various moves in Monte Carlo (MC) simulations, including change of internal conformation,...
subroutine, public mc_molecule_rotation(mc_par, force_env, bias_env, moves, move_updates, box_number, start_atom, molecule_type, bias_energy, lreject, rng_stream)
rotates the given molecule randomly around the x,y, or z axis... only works for water at the moment
subroutine, public mc_avbmc_move(mc_par, force_env, bias_env, moves, energy_check, r_old, old_energy, start_atom_swap, target_atom, molecule_type, box_number, bias_energy_old, last_bias_energy, move_type, rng_stream)
performs either a bond or angle change move for a given molecule
subroutine, public mc_volume_move(mc_par, force_env, moves, move_updates, old_energy, box_number, energy_check, r_old, iw, discrete_array, rng_stream)
performs a Monte Carlo move that alters the volume of the simulation box
subroutine, public mc_molecule_translation(mc_par, force_env, bias_env, moves, move_updates, start_atom, box_number, bias_energy, molecule_type, lreject, rng_stream)
translates the given molecule randomly in either the x,y, or z direction
subroutine, public mc_cluster_translation(mc_par, force_env, bias_env, moves, move_updates, box_number, bias_energy, lreject, rng_stream)
translates the cluster randomly in either the x,y, or z direction
subroutine, public mc_hmc_move(mc_par, force_env, globenv, moves, move_updates, old_energy, box_number, energy_check, r_old, rng_stream)
performs a hybrid Monte Carlo move that runs a short MD sequence
subroutine, public mc_conformation_change(mc_par, force_env, bias_env, moves, move_updates, start_atom, molecule_type, box_number, bias_energy, move_type, lreject, rng_stream)
performs either a bond or angle change move for a given molecule
holds all the structure types needed for Monte Carlo, except the mc_environment_type
subroutine, public get_mc_par(mc_par, nstep, nvirial, iuptrans, iupcltrans, iupvolume, nmoves, nswapmoves, rm, cl, diff, nstart, source, group, lbias, ionode, lrestart, lstop, rmvolume, rmcltrans, rmbond, rmangle, rmrot, rmtrans, temperature, pressure, rclus, beta, pmswap, pmvolume, pmtraion, pmtrans, pmcltrans, ensemble, program, restart_file_name, molecules_file, moves_file, coords_file, energy_file, displacement_file, cell_file, dat_file, data_file, box2_file, fft_lib, iprint, rcut, ldiscrete, discrete_step, pmavbmc, pbias, avbmc_atom, avbmc_rmin, avbmc_rmax, rmdihedral, input_file, mc_molecule_info, pmswap_mol, pmavbmc_mol, pmtrans_mol, pmrot_mol, pmtraion_mol, mc_input_file, mc_bias_file, pmvol_box, pmclus_box, virial_temps, exp_min_val, exp_max_val, min_val, max_val, eta, pmhmc, pmhmc_box, lhmc, rand2skip)
...
subroutine, public get_mc_molecule_info(mc_molecule_info, nmol_types, nchain_total, nboxes, names, conf_prob, nchains, nunits, mol_type, nunits_tot, in_box, atom_names, mass)
...
Perform a molecular dynamics (MD) run using QUICKSTEP.
subroutine, public qs_mol_dyn(force_env, globenv, averages, rm_restart_info, hmc_e_initial, hmc_e_final, mdctrl)
Main driver module for Molecular Dynamics.
Interface to the message passing library MPI.
represent a simple array based list of the given type
Define the molecule kind structure types and the corresponding functionality.
subroutine, public get_molecule_kind(molecule_kind, atom_list, bond_list, bend_list, ub_list, impr_list, opbend_list, colv_list, fixd_list, g3x3_list, g4x6_list, vsite_list, torsion_list, shell_list, name, mass, charge, kind_number, natom, nbend, nbond, nub, nimpr, nopbend, nconstraint, nconstraint_fixd, nfixd, ncolv, ng3x3, ng4x6, nvsite, nfixd_restraint, ng3x3_restraint, ng4x6_restraint, nvsite_restraint, nrestraints, nmolecule, nsgf, nshell, ntorsion, molecule_list, nelectron, nelectron_alpha, nelectron_beta, bond_kind_set, bend_kind_set, ub_kind_set, impr_kind_set, opbend_kind_set, torsion_kind_set, molname_generated)
Get informations about a molecule kind.
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
represent a simple array based list of the given type
Definition of physical constants:
real(kind=dp), parameter, public angstrom
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
represents a system: atoms, molecules, their pos,vel,...
wrapper to abstract the force evaluation of the various methods
contains the initially parsed file and the initial parallel environment
represent a list of objects
represent a list of objects