32#include "../../base/base_uses.f90"
38 PRIVATE :: generate_avbmc_insertion
48 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mc_coordinates'
68 cell_length, molecule_number)
71 INTEGER,
DIMENSION(:),
INTENT(IN) :: nchains, nunits
72 LOGICAL,
INTENT(OUT) :: loverlap
73 INTEGER,
DIMENSION(:),
INTENT(IN) :: mol_type
74 REAL(kind=
dp),
DIMENSION(1:3),
INTENT(IN), &
75 OPTIONAL :: cell_length
76 INTEGER,
INTENT(IN),
OPTIONAL :: molecule_number
78 CHARACTER(len=*),
PARAMETER :: routinen =
'check_for_overlap'
80 INTEGER :: handle, imol, iunit, jmol, jstart, &
81 junit, nend, nstart, nunit, nunits_i, &
84 REAL(kind=
dp) :: dist, rmin
85 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: r
86 REAL(kind=
dp),
DIMENSION(1:3) :: abc, box_length, rij
93 CALL timeset(routinen, handle)
95 NULLIFY (oldsys, particles)
106 ALLOCATE (r(1:3, 1:maxval(nunits), 1:sum(nchains)))
108 IF (
PRESENT(cell_length))
THEN
109 box_length(1:3) = cell_length(1:3)
111 box_length(1:3) = abc(1:3)
116 DO imol = 1, sum(nchains)
117 nunit = nunits(mol_type(imol))
120 r(1:3, iunit, imol) = particles%els(junit)%r(1:3)
128 IF (
PRESENT(molecule_number))
THEN
130 nstart = molecule_number
131 nend = molecule_number
134 nend = sum(nchains(:))
136 DO imol = nstart, nend
137 IF (lall) jstart = imol + 1
138 nunits_i = nunits(mol_type(imol))
139 DO jmol = jstart, sum(nchains(:))
140 IF (imol == jmol) cycle
141 nunits_j = nunits(mol_type(jmol))
143 DO iunit = 1, nunits_i
144 DO junit = 1, nunits_j
146 rij(1) = r(1, iunit, imol) - r(1, junit, jmol) - &
147 box_length(1)*anint( &
148 (r(1, iunit, imol) - r(1, junit, jmol))/box_length(1))
149 rij(2) = r(2, iunit, imol) - r(2, junit, jmol) - &
150 box_length(2)*anint( &
151 (r(2, iunit, imol) - r(2, junit, jmol))/box_length(2))
152 rij(3) = r(3, iunit, imol) - r(3, junit, jmol) - &
153 box_length(3)*anint( &
154 (r(3, iunit, imol) - r(3, junit, jmol))/box_length(3))
156 dist = rij(1)**2 + rij(2)**2 + rij(3)**2
158 IF (dist < rmin)
THEN
162 CALL timestop(handle)
174 CALL timestop(handle)
191 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: coordinates
192 INTEGER,
INTENT(IN) :: natom
193 REAL(kind=
dp),
DIMENSION(1:3),
INTENT(OUT) :: center_of_mass
194 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: mass
196 CHARACTER(len=*),
PARAMETER :: routinen =
'get_center_of_mass'
198 INTEGER :: handle, i, iatom
199 REAL(kind=
dp) :: total_mass
203 CALL timeset(routinen, handle)
205 total_mass = sum(mass(1:natom))
206 center_of_mass(:) = 0.0e0_dp
210 center_of_mass(i) = center_of_mass(i) + &
211 mass(iatom)*coordinates(i, iatom)
215 center_of_mass(1:3) = center_of_mass(1:3)/total_mass
218 CALL timestop(handle)
237 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: coordinates
238 INTEGER,
INTENT(IN) :: nchains_tot
239 INTEGER,
DIMENSION(:),
INTENT(IN) :: mol_type
240 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: mass
241 INTEGER,
DIMENSION(:),
INTENT(IN) :: nunits
242 REAL(kind=
dp),
DIMENSION(1:3),
INTENT(IN) :: box_length
244 CHARACTER(len=*),
PARAMETER :: routinen =
'mc_coordinate_fold'
246 INTEGER :: end_atom, handle, iatom, imolecule, &
249 REAL(kind=
dp),
DIMENSION(1:3) :: center_of_mass
253 CALL timeset(routinen, handle)
257 DO imolecule = 1, nchains_tot
260 start_atom = end_atom + 1
261 end_atom = start_atom + natoms - 1
265 jatom = iatom + start_atom - 1
266 coordinates(1, jatom) = coordinates(1, jatom) - &
267 box_length(1)*floor(center_of_mass(1)/box_length(1))
268 coordinates(2, jatom) = coordinates(2, jatom) - &
269 box_length(2)*floor(center_of_mass(2)/box_length(2))
270 coordinates(3, jatom) = coordinates(3, jatom) - &
271 box_length(3)*floor(center_of_mass(3)/box_length(2))
277 CALL timestop(handle)
327 exp_min_val, nswapmoves, rosenbluth_weight, start_atom, natoms_tot, nunits, nunits_mol, &
328 mass, loverlap, choosen_energy, old_energy, ionode, lremove, mol_type, nchains, source, &
329 group, rng_stream, avbmc_atom, rmin, rmax, move_type, target_atom)
332 REAL(kind=
dp),
INTENT(IN) :: beta, max_val, min_val, exp_max_val, &
334 INTEGER,
INTENT(IN) :: nswapmoves
335 REAL(kind=
dp),
INTENT(OUT) :: rosenbluth_weight
336 INTEGER,
INTENT(IN) :: start_atom, natoms_tot
337 INTEGER,
DIMENSION(:),
INTENT(IN) :: nunits
338 INTEGER,
INTENT(IN) :: nunits_mol
339 REAL(
dp),
DIMENSION(1:nunits_mol),
INTENT(IN) :: mass
340 LOGICAL,
INTENT(OUT) :: loverlap
341 REAL(kind=
dp),
INTENT(OUT) :: choosen_energy
342 REAL(kind=
dp),
INTENT(IN) :: old_energy
343 LOGICAL,
INTENT(IN) :: ionode, lremove
344 INTEGER,
DIMENSION(:),
INTENT(IN) :: mol_type, nchains
345 INTEGER,
INTENT(IN) :: source
348 INTEGER,
INTENT(IN),
OPTIONAL :: avbmc_atom
349 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: rmin, rmax
350 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: move_type
351 INTEGER,
INTENT(IN),
OPTIONAL :: target_atom
353 CHARACTER(len=*),
PARAMETER :: routinen =
'generate_cbmc_swap_config'
355 INTEGER :: atom_number, choosen, end_atom, handle, &
356 i, iatom, imolecule, imove, &
358 LOGICAL :: all_overlaps
359 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: loverlap_array
360 REAL(kind=
dp) :: bias_energy, exponent, rand, &
362 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: boltz_weights, trial_energy
363 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: r_old
364 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: r
365 REAL(kind=
dp),
DIMENSION(1:3) :: abc, center_of_mass, diff, r_insert
372 CALL timeset(routinen, handle)
381 IF (
PRESENT(avbmc_atom))
THEN
382 IF (.NOT.
PRESENT(rmin) .OR. .NOT.
PRESENT(rmax) .OR. &
383 .NOT.
PRESENT(move_type) .OR. .NOT.
PRESENT(target_atom))
THEN
384 cpabort(
'AVBMC swap move is missing information!')
388 ALLOCATE (r_old(1:3, 1:natoms_tot))
389 ALLOCATE (r(1:3, 1:natoms_tot, 1:nswapmoves))
390 ALLOCATE (trial_energy(1:nswapmoves))
391 ALLOCATE (boltz_weights(1:nswapmoves))
392 ALLOCATE (loverlap_array(1:nswapmoves))
395 loverlap_array(:) = .false.
397 boltz_weights(:) = 0.0_dp
398 trial_energy(:) = 0.0_dp
400 choosen_energy = 0.0_dp
401 rosenbluth_weight = 0.0_dp
404 DO imove = 1, nswapmoves
405 DO iatom = 1, natoms_tot
406 r(1:3, iatom, imove) = particles%els(iatom)%r(1:3)
411 DO iatom = 1, natoms_tot
412 r_old(1:3, iatom) = r(1:3, iatom, 1)
416 end_atom = start_atom + nunits_mol - 1
420 DO imolecule = 1, sum(nchains(:))
421 IF (atom_number == start_atom)
THEN
422 molecule_number = imolecule
425 atom_number = atom_number + nunits(mol_type(imolecule))
427 IF (molecule_number == 0)
CALL cp_abort(__location__, &
428 'CBMC swap move cannot find which molecule number it needs')
433 CALL group%bcast(loverlap_array(1), source)
435 IF (loverlap_array(1))
THEN
437 WRITE (*, *) start_atom, end_atom, natoms_tot
438 DO iatom = 1, natoms_tot
439 WRITE (*, *) r(1:3, iatom, 1)
442 cpabort(
'CBMC swap move found an overlap in the old config')
446 DO imove = 1, nswapmoves
451 IF (
PRESENT(avbmc_atom))
THEN
453 CALL generate_avbmc_insertion(rmin, rmax, &
454 r_old(1:3, target_atom), &
455 move_type, r_insert(:), abc(:), rng_stream)
458 diff(i) = r_insert(i) - r_old(i, start_atom + avbmc_atom - 1)
464 rand = rng_stream%next()
465 r_insert(i) = rand*abc(i)
470 center_of_mass(:), mass(:))
475 diff(i) = r_insert(i) - center_of_mass(i)
480 DO iatom = start_atom, end_atom
481 r(1:3, iatom, imove) = r(1:3, iatom, imove) + diff(1:3)
486 nunits_mol, rng_stream)
488 IF (imove == 1 .AND. lremove)
THEN
489 DO iatom = 1, natoms_tot
490 r(1:3, iatom, 1) = r_old(1:3, iatom)
496 CALL group%bcast(r(:, :, imove), source)
499 DO iatom = start_atom, end_atom
500 particles%els(iatom)%r(1:3) = r(1:3, iatom, imove)
504 mol_type, molecule_number=molecule_number)
505 IF (loverlap_array(imove))
THEN
506 boltz_weights(imove) = 0.0_dp
512 potential_energy=bias_energy)
514 trial_energy(imove) = (bias_energy - old_energy)
515 exponent = -beta*trial_energy(imove)
517 IF (exponent .GT. exp_max_val)
THEN
518 boltz_weights(imove) = max_val
519 ELSEIF (exponent .LT. exp_min_val)
THEN
520 boltz_weights(imove) = min_val
522 boltz_weights(imove) = exp(exponent)
529 rosenbluth_weight = sum(boltz_weights(:))
530 IF (rosenbluth_weight .EQ. 0.0_dp .AND. lremove)
THEN
534 WRITE (*, *) boltz_weights(1:nswapmoves)
535 WRITE (*, *) start_atom, end_atom, lremove
536 WRITE (*, *) loverlap_array(1:nswapmoves)
537 WRITE (*, *) natoms_tot
539 DO iatom = 1, natoms_tot
540 WRITE (*, *) r(1:3, iatom, 1)*
angstrom
543 cpabort(
'CBMC swap move found a bad old weight')
545 all_overlaps = .true.
546 total_running_weight = 0.0e0_dp
549 rand = rng_stream%next()
552 CALL group%bcast(rand, source)
553 DO imove = 1, nswapmoves
554 IF (loverlap_array(imove)) cycle
555 all_overlaps = .false.
556 total_running_weight = total_running_weight + boltz_weights(imove)
557 IF (total_running_weight .GE. rand*rosenbluth_weight)
THEN
563 IF (all_overlaps)
THEN
570 WRITE (*, *) boltz_weights(1:nswapmoves)
571 WRITE (*, *) start_atom, end_atom, lremove
572 WRITE (*, *) loverlap_array(1:nswapmoves)
573 DO iatom = 1, natoms_tot
574 WRITE (*, *) r(1:3, iatom, 1)
577 cpabort(
'CBMC swap move found all overlaps for the remove config')
582 DEALLOCATE (trial_energy)
583 DEALLOCATE (boltz_weights)
584 DEALLOCATE (loverlap_array)
585 CALL timestop(handle)
591 cpabort(
'CBMC swap move failed to select config')
594 IF (lremove) choosen = 1
597 choosen_energy = trial_energy(choosen)
600 DO iatom = 1, natoms_tot
601 particles%els(iatom)%r(1:3) = r(1:3, iatom, choosen)
606 DEALLOCATE (trial_energy)
607 DEALLOCATE (boltz_weights)
608 DEALLOCATE (loverlap_array)
611 CALL timestop(handle)
628 INTEGER,
INTENT(IN) :: natoms
629 REAL(kind=
dp),
DIMENSION(1:natoms),
INTENT(IN) :: mass
630 REAL(kind=
dp),
DIMENSION(1:3, 1:natoms), &
634 CHARACTER(len=*),
PARAMETER :: routinen =
'rotate_molecule'
636 INTEGER :: handle, iunit
637 REAL(kind=
dp) :: cosdg, dgamma, rand, rx, rxnew, ry, &
638 rynew, rz, rznew, sindg
639 REAL(kind=
dp),
DIMENSION(1:3) :: center_of_mass
643 CALL timeset(routinen, handle)
649 rand = rng_stream%next()
650 dgamma =
pi*(rand - 0.5e0_dp)*2.0e0_dp
660 ry = r(2, iunit) - center_of_mass(2)
661 rz = r(3, iunit) - center_of_mass(3)
662 rynew = cosdg*ry + sindg*rz
663 rznew = cosdg*rz - sindg*ry
665 r(2, iunit) = rynew + center_of_mass(2)
666 r(3, iunit) = rznew + center_of_mass(3)
673 rx = r(1, iunit) - center_of_mass(1)
674 rz = r(3, iunit) - center_of_mass(3)
675 rxnew = cosdg*rx + sindg*rz
676 rznew = cosdg*rz - sindg*rx
678 r(1, iunit) = rxnew + center_of_mass(1)
679 r(3, iunit) = rznew + center_of_mass(3)
686 rx = r(1, iunit) - center_of_mass(1)
687 ry = r(2, iunit) - center_of_mass(2)
688 rxnew = cosdg*rx + sindg*ry
689 rynew = cosdg*ry - sindg*rx
691 r(1, iunit) = rxnew + center_of_mass(1)
692 r(2, iunit) = rynew + center_of_mass(2)
697 CALL timestop(handle)
715 box_number, molecule_type, rng_stream, box, molecule_type_old)
718 INTEGER,
INTENT(OUT) :: start_atom, box_number,
molecule_type
720 INTEGER,
INTENT(IN),
OPTIONAL :: box, molecule_type_old
722 CHARACTER(LEN=*),
PARAMETER :: routinen =
'find_mc_test_molecule'
724 INTEGER :: handle, ibox, imol_type, imolecule, &
725 jbox, molecule_number, nchains_tot, &
727 INTEGER,
DIMENSION(:),
POINTER :: mol_type, nunits
728 INTEGER,
DIMENSION(:, :),
POINTER :: nchains
729 REAL(kind=
dp) :: rand
733 CALL timeset(routinen, handle)
735 NULLIFY (nunits, mol_type, nchains)
744 IF (
PRESENT(box) .AND.
PRESENT(molecule_type_old))
THEN
746 rand = rng_stream%next()
747 molecule_number = ceiling(rand*real(nchains(molecule_type_old, box), kind=
dp))
751 start_mol = start_mol + sum(nchains(:, jbox))
755 DO imol_type = 1, molecule_type_old - 1
756 molecule_number = molecule_number + nchains(imol_type, box)
760 DO imolecule = 1, molecule_number - 1
761 start_atom = start_atom + nunits(mol_type(start_mol + imolecule - 1))
764 ELSEIF (
PRESENT(box))
THEN
766 rand = rng_stream%next()
767 molecule_number = ceiling(rand*real(sum(nchains(:, box)), kind=
dp))
771 start_mol = start_mol + sum(nchains(:, jbox))
778 DO imolecule = 1, molecule_number - 1
779 start_atom = start_atom + nunits(mol_type(start_mol + imolecule - 1))
782 ELSEIF (
PRESENT(molecule_type_old))
THEN
784 rand = rng_stream%next()
785 molecule_number = ceiling(rand*real(sum(nchains(molecule_type_old, :)), kind=
dp))
789 DO ibox = 1,
SIZE(nchains(molecule_type_old, :))
790 IF (molecule_number .LE. nchains(molecule_type_old, ibox))
THEN
794 molecule_number = molecule_number - nchains(molecule_type_old, ibox)
798 DO jbox = 1, box_number - 1
799 start_mol = start_mol + sum(nchains(:, jbox))
803 DO imol_type = 1, molecule_type_old - 1
804 molecule_number = molecule_number + nchains(imol_type, box_number)
807 DO imolecule = 1, molecule_number - 1
808 start_atom = start_atom + nunits(mol_type(start_mol + imolecule - 1))
814 DO ibox = 1,
SIZE(nchains(1, :))
815 nchains_tot = nchains_tot + sum(nchains(:, ibox))
817 rand = rng_stream%next()
818 molecule_number = ceiling(rand*real(nchains_tot, kind=
dp))
823 DO ibox = 1, sum(nchains(1, :))
824 IF (molecule_number .LE. sum(nchains(:, ibox)))
THEN
828 molecule_number = molecule_number - sum(nchains(:, ibox))
833 DO jbox = 1, box_number - 1
834 start_mol = start_mol + sum(nchains(:, jbox))
837 DO imolecule = 1, molecule_number - 1
838 start_atom = start_atom + nunits(mol_type(start_mol + imolecule - 1))
844 IF (
PRESENT(box)) box_number = box
845 IF (
PRESENT(molecule_type_old))
molecule_type = molecule_type_old
847 cpassert(start_atom /= 0)
848 cpassert(box_number /= 0)
852 CALL timestop(handle)
871 REAL(
dp),
DIMENSION(1:3),
INTENT(IN) :: cell
872 INTEGER,
DIMENSION(1:3, 1:2),
INTENT(OUT) :: discrete_array
873 REAL(
dp),
INTENT(IN) :: step_size
876 REAL(
dp) :: high_value, length1, length2, low_value
878 discrete_array(:, :) = 0
880 length1 = abs(cell(1) - cell(2))
881 length2 = abs(cell(2) - cell(3))
884 IF (length1 .LT. 0.01_dp*step_size .AND. &
885 length2 .LT. 0.01_dp*step_size)
THEN
887 discrete_array(1:3, 1) = 1
888 discrete_array(1:3, 2) = 1
893 low_value = cell(1)*cell(2)*cell(3)
895 IF (cell(iside) .LT. low_value) low_value = cell(iside)
896 IF (cell(iside) .GT. high_value) high_value = cell(iside)
901 IF (abs(cell(iside) - low_value) .LT. 0.01_dp*step_size)
THEN
903 discrete_array(iside, 1) = 1
904 discrete_array(iside, 2) = 0
907 discrete_array(iside, 1) = 0
908 discrete_array(iside, 2) = 1
930 SUBROUTINE generate_avbmc_insertion(rmin, rmax, r_target, &
931 move_type, r_insert, abc, rng_stream)
933 REAL(kind=
dp),
INTENT(IN) :: rmin, rmax
934 REAL(kind=
dp),
DIMENSION(1:3),
INTENT(IN) :: r_target
935 CHARACTER(LEN=*),
INTENT(IN) :: move_type
936 REAL(kind=
dp),
DIMENSION(1:3),
INTENT(OUT) :: r_insert
937 REAL(kind=
dp),
DIMENSION(1:3),
INTENT(IN) :: abc
941 REAL(
dp) :: dist, eta_1, eta_2, eta_sq, rand
942 REAL(
dp),
DIMENSION(1:3) :: rij
944 r_insert(1:3) = 0.0_dp
946 IF (move_type ==
'in')
THEN
949 eta_1 = rng_stream%next()
950 eta_2 = rng_stream%next()
951 eta_sq = eta_1**2 + eta_2**2
952 IF (eta_sq .LT. 1.0_dp)
THEN
953 r_insert(1) = 2.0_dp*eta_1*sqrt(1.0_dp - eta_sq)
954 r_insert(2) = 2.0_dp*eta_2*sqrt(1.0_dp - eta_sq)
955 r_insert(3) = 1.0_dp - 2.0_dp*eta_sq
961 rand = rng_stream%next()
962 r_insert(1:3) = r_insert(1:3)*(rand*(rmax**3 - rmin**3) + rmin**3)** &
965 r_insert(1:3) = r_target(1:3) + r_insert(1:3)
971 rand = rng_stream%next()
972 r_insert(i) = rand*abc(i)
976 rij(1) = r_insert(1) - r_target(1) - abc(1)* &
977 anint((r_insert(1) - r_target(1))/abc(1))
978 rij(2) = r_insert(2) - r_target(2) - abc(2)* &
979 anint((r_insert(2) - r_target(2))/abc(2))
980 rij(3) = r_insert(3) - r_target(3) - abc(3)* &
981 anint((r_insert(3) - r_target(3))/abc(3))
983 dist = rij(1)**2 + rij(2)**2 + rij(3)**2
985 IF (dist .LT. rmin**2 .OR. dist .GT. rmax**2)
THEN
992 END SUBROUTINE generate_avbmc_insertion
1013 SUBROUTINE cluster_search(mc_par, force_env, cluster, nchains, nunits, mol_type, total_clus)
1017 INTEGER,
DIMENSION(:, :),
INTENT(INOUT) :: cluster
1018 INTEGER,
DIMENSION(:),
INTENT(IN) :: nchains, nunits, mol_type
1019 INTEGER,
INTENT(INOUT) :: total_clus
1021 CHARACTER(len=*),
PARAMETER :: routinen =
'cluster_search'
1023 INTEGER :: counter, handle, imol, iunit, jmol, &
1024 junit, nend, nstart, nunit, nunits_i, &
1026 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: clusmat, decision
1028 REAL(kind=
dp) :: dx, dy, dz, rclus, rclussquare, rsquare
1029 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: xcoord, ycoord, zcoord
1030 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: r
1031 REAL(kind=
dp),
DIMENSION(1:3) :: abc
1038 CALL timeset(routinen, handle)
1040 NULLIFY (oldsys, particles)
1049 ALLOCATE (r(1:3, 1:maxval(nunits), 1:sum(nchains)))
1052 nend = sum(nchains(:))
1055 nunit = nunits(mol_type(imol))
1058 r(1:3, iunit, imol) = particles%els(junit)%r(1:3)
1065 ALLOCATE (clusmat(nend), decision(nend))
1073 rclussquare = rclus*rclus
1075 DO WHILE (sum(decision) .LT. nend)
1077 IF (clusmat(nstart) .EQ. 0)
THEN
1078 counter = counter + 1
1079 clusmat(nstart) = counter
1085 DO WHILE (lclus .EQV. .true.)
1087 nunits_i = nunits(mol_type(imol))
1090 IF (clusmat(imol) .EQ. counter .AND. decision(imol) .EQ. 0)
THEN
1091 ALLOCATE (xcoord(nunits_i), ycoord(nunits_i), zcoord(nunits_i))
1094 DO iunit = 1, nunits_i
1095 xcoord(iunit) = r(1, iunit, imol)
1096 ycoord(iunit) = r(2, iunit, imol)
1097 zcoord(iunit) = r(3, iunit, imol)
1102 IF (lclus .EQV. .true.)
THEN
1104 nunits_j = nunits(mol_type(jmol))
1105 IF (clusmat(jmol) .EQ. 0 .AND. decision(jmol) .EQ. 0)
THEN
1107 DO iunit = 1, nunits_i
1108 DO junit = 1, nunits_j
1109 dx = xcoord(iunit) - r(1, junit, jmol)
1110 dy = ycoord(iunit) - r(2, junit, jmol)
1111 dz = zcoord(iunit) - r(3, junit, jmol)
1112 dx = dx - abc(1)*anint(dx/abc(1))
1113 dy = dy - abc(2)*anint(dy/abc(2))
1114 dz = dz - abc(3)*anint(dz/abc(3))
1115 rsquare = (dx*dx) + (dy*dy) + (dz*dz)
1117 IF (rsquare .LT. rclussquare)
THEN
1118 clusmat(jmol) = counter
1124 DEALLOCATE (xcoord, ycoord, zcoord)
1130 total_clus = counter
1132 DO imol = 1, counter
1134 IF (imol .EQ. clusmat(jmol))
THEN
1135 cluster(imol, jmol) = jmol
1140 DEALLOCATE (decision)
1141 DEALLOCATE (clusmat)
1144 CALL timestop(handle)
Handles all functions related to the CELL.
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
types that represent a subsys, i.e. a part of the system
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
Defines the basic variable types.
integer, parameter, public dp
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 mc_coordinate_fold(coordinates, nchains_tot, mol_type, mass, nunits, box_length)
folds all the coordinates into the center simulation box using a center of mass cutoff
subroutine, public find_mc_test_molecule(mc_molecule_info, start_atom, box_number, molecule_type, rng_stream, box, molecule_type_old)
selects a molecule at random to perform a MC move on...you can specify the box the molecule should be...
subroutine, public rotate_molecule(r, mass, natoms, rng_stream)
rotates a molecule randomly around the center of mass, sequentially in x, y, and z directions
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
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)
...
Interface to the message passing library MPI.
Define the data structure for the molecule information.
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.
represents a system: atoms, molecules, their pos,vel,...
wrapper to abstract the force evaluation of the various methods
represent a list of objects