61 mc_environment_p_type,&
73 #include "../../base/base_uses.f90"
80 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mc_run'
102 SUBROUTINE do_mon_car(force_env_1, globenv, input_declaration, input_file_name)
104 TYPE(force_env_type),
POINTER :: force_env_1
105 TYPE(global_environment_type),
POINTER :: globenv
106 TYPE(section_type),
POINTER :: input_declaration
107 CHARACTER(LEN=*) :: input_file_name
109 CHARACTER(LEN=20) :: ensemble
110 CHARACTER(LEN=40) :: box2_file, dat_file
111 INTEGER :: box_number, ibox, isos, iw, nboxes, &
113 INTEGER,
DIMENSION(:),
POINTER :: nunits_tot
114 LOGICAL :: lbias, lhmc, lrestart, lskip_box, &
117 REAL(
dp),
DIMENSION(:, :),
POINTER :: empty_coordinates
118 TYPE(force_env_p_type),
DIMENSION(:),
POINTER :: force_env
119 TYPE(force_env_type),
POINTER :: force_env_2
120 TYPE(global_environment_type),
POINTER :: globenv_2
121 TYPE(mc_environment_p_type),
DIMENSION(:),
POINTER :: mc_env
122 TYPE(mc_input_file_type),
POINTER :: mc_bias_file, mc_input_file
123 TYPE(mc_molecule_info_type),
POINTER :: mc_molecule_info
124 TYPE(mc_simulation_parameters_p_type), &
125 DIMENSION(:),
POINTER :: mc_par
126 TYPE(mp_para_env_type),
POINTER :: para_env
127 TYPE(rng_stream_type) :: rng_stream
128 TYPE(section_vals_type),
POINTER :: force_env_section, mc_section, &
131 NULLIFY (mc_env, mc_par, force_env_2, force_env_section, &
132 root_section, mc_molecule_info)
136 para_env => force_env_1%para_env
138 force_env_section => force_env_1%force_env_section
139 root_section => force_env_1%root_section
145 rng_stream = rng_stream_type( &
146 last_rng_stream=force_env_1%globenv%gaussian_rng_stream, &
159 SELECT CASE (ensemble)
160 CASE (
"TRADITIONAL",
"VIRIAL")
162 CASE (
"GEMC_NVT",
"GEMC_NPT")
167 box2_file, globenv_new=globenv_2)
171 ALLOCATE (force_env(1:nboxes))
172 SELECT CASE (ensemble)
173 CASE (
"TRADITIONAL",
"VIRIAL")
174 force_env(1)%force_env => force_env_1
175 CASE (
"GEMC_NVT",
"GEMC_NPT")
176 force_env(1)%force_env => force_env_1
177 force_env(2)%force_env => force_env_2
179 ALLOCATE (mc_par(1:nboxes))
180 ALLOCATE (mc_env(1:nboxes))
185 coordinates_empty=empty_coordinates)
187 nunits_tot=nunits_tot)
194 WRITE (iw,
'(A,I2,A)')
'******************************** Begin BOX ', ibox, &
195 ' *******************************'
199 ALLOCATE (mc_env(ibox)%mc_env)
207 CALL set_mc_par(mc_par(ibox)%mc_par, mc_molecule_info=mc_molecule_info)
210 force_env_section => force_env(ibox)%force_env%force_env_section
211 root_section => force_env(ibox)%force_env%root_section
213 CALL read_mc_section(mc_par(ibox)%mc_par, para_env, globenv, input_file_name, &
214 root_section, force_env_section)
216 CALL read_mc_section(mc_par(ibox)%mc_par, para_env, globenv, box2_file, &
217 root_section, force_env_section)
224 CALL get_mc_par(mc_par(ibox)%mc_par, mc_input_file=mc_input_file, lhmc=lhmc)
225 CALL get_mc_par(mc_par(1)%mc_par, lbias=lbias)
228 input_file_name, mc_molecule_info, empty_coordinates, lhmc)
231 box2_file, mc_molecule_info, empty_coordinates, lhmc)
233 CALL set_mc_par(mc_par(ibox)%mc_par, mc_input_file=mc_input_file)
236 CALL get_mc_par(mc_par(ibox)%mc_par, mc_bias_file=mc_bias_file)
238 "bias_template.inp", mc_molecule_info, empty_coordinates, lhmc)
239 CALL set_mc_par(mc_par(ibox)%mc_par, mc_bias_file=mc_bias_file)
243 CALL get_mc_par(mc_par(ibox)%mc_par, lrestart=lrestart, &
247 iw, nunits_tot(ibox), rng_stream)
251 input_declaration, para_env, dat_file)
260 IF (nunits_tot(ibox) == 0)
THEN
262 cpabort(
'More than one box has no atoms in it!')
273 nunits_tot=nunits_tot)
275 CALL set_mc_par(mc_par(ibox)%mc_par, mc_molecule_info=mc_molecule_info)
280 CALL find_mc_rcut(mc_par(1)%mc_par, force_env(1)%force_env, lterminate)
282 IF (iw > 0)
WRITE (iw,
'( A,T73,F8.4 )') &
283 ' MC| Interaction cutoff [angstroms]', rcut*
angstrom
285 cpabort(
'Cutoff larger than twice the boxlength')
290 IF (nboxes == 2)
THEN
291 CALL equilize_mc_sim_parameters(mc_par, iw)
300 CALL set_mc_env(mc_env(ibox)%mc_env, mc_par=mc_par(ibox)%mc_par, &
301 force_env=force_env(ibox)%force_env)
307 SELECT CASE (ensemble)
311 CALL mc_run_ensemble(mc_env, para_env, globenv, input_declaration, nboxes, rng_stream)
315 CALL get_mc_env(mc_env(1)%mc_env, mc_par=mc_par(1)%mc_par)
316 CALL get_mc_par(mc_par(1)%mc_par, mc_molecule_info=mc_molecule_info)
321 mc_par=mc_par(ibox)%mc_par, force_env=force_env(ibox)%force_env)
322 CALL get_mc_par(mc_par(ibox)%mc_par, mc_input_file=mc_input_file)
326 CALL get_mc_par(mc_par(ibox)%mc_par, mc_bias_file=mc_bias_file)
332 DEALLOCATE (mc_env(ibox)%mc_env)
336 DEALLOCATE (empty_coordinates)
339 DEALLOCATE (force_env)
355 SUBROUTINE equilize_mc_sim_parameters(mc_par, iw)
356 TYPE(mc_simulation_parameters_p_type), &
357 DIMENSION(:),
POINTER :: mc_par
358 INTEGER,
INTENT(IN) :: iw
360 CHARACTER(20) :: ensemble
361 INTEGER :: iprint, iupcltrans, iuptrans, iupvolume, &
362 nmoves, nstep, nswapmoves
363 INTEGER,
DIMENSION(:),
POINTER :: avbmc_atom
364 LOGICAL :: lbias, lrestart, lstop
365 REAL(
dp) :: beta, pmswap, pmtraion, pmtrans, &
366 pmvolume, pressure, rcut, temperature
367 REAL(
dp),
DIMENSION(:),
POINTER :: avbmc_rmax, avbmc_rmin, pbias, &
368 pmavbmc_mol, pmrot_mol, pmswap_mol, &
369 pmtraion_mol, pmtrans_mol
372 WRITE (iw,
'( A,A )')
'Ignoring some input for box 2, and ', &
373 'using the values for box 1 for the following variables:'
374 WRITE (iw,
'( A,A )')
'nstep,iupvolume,iuptrans,iupcltrans,nmoves,', &
375 'nswapmoves,iprint,lbias,lstop,temperature,pressure'
376 WRITE (iw,
'( A,A )')
'pmvolume,pmtraion,pmtrans,BETA,rcut,', &
378 WRITE (iw,
'( A,A )')
'pmtraion_mol,pmtrans_mol,pmrot_mol,pmswap_mol,', &
380 WRITE (iw,
'( A,A )')
'avbmc_rmin,avmbc_rmax,pmavbmc_mol,pbias,pmswap'
383 CALL get_mc_par(mc_par(1)%mc_par, nstep=nstep, iupvolume=iupvolume, iupcltrans=iupcltrans, &
384 iuptrans=iuptrans, nmoves=nmoves, nswapmoves=nswapmoves, &
385 iprint=iprint, lbias=lbias, lstop=lstop, temperature=temperature, &
386 pressure=pressure, pmswap=pmswap, pmvolume=pmvolume, &
387 pmtraion=pmtraion, pmtrans=pmtrans, beta=beta, rcut=rcut, &
388 lrestart=lrestart, pmtraion_mol=pmtraion_mol, pmtrans_mol=pmtrans_mol, &
389 pmrot_mol=pmrot_mol, pmswap_mol=pmswap_mol, avbmc_atom=avbmc_atom, &
390 avbmc_rmin=avbmc_rmin, avbmc_rmax=avbmc_rmax, pmavbmc_mol=pmavbmc_mol, &
391 pbias=pbias, ensemble=ensemble)
392 CALL set_mc_par(mc_par(2)%mc_par, nstep=nstep, iupvolume=iupvolume, iupcltrans=iupcltrans, &
393 iuptrans=iuptrans, nmoves=nmoves, nswapmoves=nswapmoves, &
394 iprint=iprint, lbias=lbias, lstop=lstop, temperature=temperature, &
395 pressure=pressure, pmswap=pmswap, pmvolume=pmvolume, &
396 pmtraion=pmtraion, pmtrans=pmtrans, beta=beta, rcut=rcut, &
397 lrestart=lrestart, pmtraion_mol=pmtraion_mol, pmtrans_mol=pmtrans_mol, &
398 pmrot_mol=pmrot_mol, pmswap_mol=pmswap_mol, avbmc_atom=avbmc_atom, &
399 avbmc_rmin=avbmc_rmin, avbmc_rmax=avbmc_rmax, pmavbmc_mol=pmavbmc_mol, &
400 pbias=pbias, ensemble=ensemble)
402 END SUBROUTINE equilize_mc_sim_parameters
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...
Interface for the force calculations.
subroutine, public force_env_retain(force_env)
retains the given force env
recursive subroutine, public force_env_release(force_env)
releases the given force env
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
contains some general routines for dealing with the restart files and creating force_env for MC use
subroutine, public read_mc_restart(mc_par, force_env, iw, mc_nunits_tot, rng_stream)
reads the input coordinates of the simulation from a file written above
subroutine, public mc_create_force_env(force_env, input_declaration, para_env, input_file_name, globenv_new)
creates a force environment for any of the different kinds of MC simulations we can do (FIST,...
Used to run the bulk of the MC simulation, doing things like choosing move types and writing data to ...
subroutine, public mc_compute_virial(mc_env, rng_stream)
Computes the second virial coefficient of a molecule by using the integral form of the second virial ...
subroutine, public mc_run_ensemble(mc_env, para_env, globenv, input_declaration, nboxes, rng_stream)
directs the program in running one or two box MC simulations
contains the subroutines for dealing with the mc_env
subroutine, public get_mc_env(mc_env, mc_par, force_env)
provides a method for getting the various structures attached to an mc_env
subroutine, public mc_env_create(mc_env)
creates and initializes an mc_env
subroutine, public set_mc_env(mc_env, mc_par, force_env)
provides a method for attaching various structures to an mc_env
subroutine, public mc_env_release(mc_env)
releases the given mc env
preps the system for a Monte Carlo run (sets up some environments, calls the routines to read in the ...
subroutine, public do_mon_car(force_env_1, globenv, input_declaration, input_file_name)
starts the Monte Carlo simulation and determines which ensemble we're running
holds all the structure types needed for Monte Carlo, except the mc_environment_type
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)
...
subroutine, public read_mc_section(mc_par, para_env, globenv, input_file_name, input_file, force_env_section)
reads in the Monte Carlo simulation parameters from an input file
subroutine, public mc_determine_molecule_info(force_env, mc_molecule_info, box_number, coordinates_empty)
figures out the number of total molecules, the number of atoms in each molecule, an array with the mo...
subroutine, public mc_molecule_info_destroy(mc_molecule_info)
deallocates all the arrays in the mc_molecule_info_type
subroutine, public mc_sim_par_destroy(mc_par)
destroys (deallocates) the mc_simulation_parameters type
subroutine, public set_mc_par(mc_par, rm, cl, diff, nstart, rmvolume, rmcltrans, rmbond, rmangle, rmdihedral, rmrot, rmtrans, PROGRAM, nmoves, nswapmoves, lstop, temperature, pressure, rclus, iuptrans, iupcltrans, iupvolume, pmswap, pmvolume, pmtraion, pmtrans, pmcltrans, BETA, rcut, iprint, lbias, nstep, lrestart, ldiscrete, discrete_step, pmavbmc, mc_molecule_info, pmavbmc_mol, pmtrans_mol, pmrot_mol, pmtraion_mol, pmswap_mol, avbmc_rmin, avbmc_rmax, avbmc_atom, pbias, ensemble, pmvol_box, pmclus_box, eta, mc_input_file, mc_bias_file, exp_max_val, exp_min_val, min_val, max_val, pmhmc, pmhmc_box, lhmc, ionode, source, group, rand2skip)
changes the private elements of the mc_parameters_type
subroutine, public mc_input_parameters_check(mc_par)
...
subroutine, public mc_input_file_destroy(mc_input_file)
destroys (deallocates) things in the mc_input_file_type
subroutine, public find_mc_rcut(mc_par, force_env, lterminate)
finds the largest interaction cutoff value in a classical simulation so we know the smallest size we ...
subroutine, public mc_sim_par_create(mc_par, nmol_types)
creates (allocates) the mc_simulation_parameters type
subroutine, public mc_input_file_create(mc_input_file, input_file_name, mc_molecule_info, empty_coords, lhmc)
creates (allocates) the mc_input_file_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)
...
Interface to the message passing library MPI.
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
integer, parameter, public uniform
Definition of physical constants:
real(kind=dp), parameter, public angstrom