29#include "../base/base_uses.f90"
37 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'molecule_types'
42 LOGICAL :: init = .false.
45 REAL(kind=
dp) :: lambda = 0.0_dp, sigma = 0.0_dp
50 LOGICAL :: init = .false.
51 REAL(kind=
dp) :: scale = 0.0_dp, scale_old = 0.0_dp, &
52 imass1 = 0.0_dp, imass2 = 0.0_dp, imass3 = 0.0_dp
53 REAL(kind=
dp),
DIMENSION(3) :: fa = 0.0_dp, fb = 0.0_dp, fc = 0.0_dp, &
54 f_roll1 = 0.0_dp, f_roll2 = 0.0_dp, f_roll3 = 0.0_dp, &
55 ra_old = 0.0_dp, rb_old = 0.0_dp, rc_old = 0.0_dp, &
56 va = 0.0_dp, vb = 0.0_dp, vc = 0.0_dp, &
57 lambda = 0.0_dp, del_lambda = 0.0_dp, lambda_old = 0.0_dp, &
58 r0_12 = 0.0_dp, r0_13 = 0.0_dp, r0_23 = 0.0_dp
59 REAL(kind=
dp),
DIMENSION(3, 3) :: amat = 0.0_dp
64 LOGICAL :: init = .false.
65 REAL(kind=
dp) :: scale = 0.0_dp, scale_old = 0.0_dp, imass1 = 0.0_dp, &
66 imass2 = 0.0_dp, imass3 = 0.0_dp, imass4 = 0.0_dp
67 REAL(kind=
dp),
DIMENSION(3) :: fa = 0.0_dp, fb = 0.0_dp, fc = 0.0_dp, fd = 0.0_dp, fe = 0.0_dp, ff = 0.0_dp, &
68 f_roll1 = 0.0_dp, f_roll2 = 0.0_dp, f_roll3 = 0.0_dp, &
69 f_roll4 = 0.0_dp, f_roll5 = 0.0_dp, f_roll6 = 0.0_dp, &
70 ra_old = 0.0_dp, rb_old = 0.0_dp, rc_old = 0.0_dp, &
71 rd_old = 0.0_dp, re_old = 0.0_dp, rf_old = 0.0_dp, &
72 va = 0.0_dp, vb = 0.0_dp, vc = 0.0_dp, vd = 0.0_dp, ve = 0.0_dp, vf = 0.0_dp, &
73 r0_12 = 0.0_dp, r0_13 = 0.0_dp, r0_14 = 0.0_dp, &
74 r0_23 = 0.0_dp, r0_24 = 0.0_dp, r0_34 = 0.0_dp
75 REAL(kind=
dp),
DIMENSION(6) :: lambda = 0.0_dp, del_lambda = 0.0_dp, lambda_old = 0.0_dp
76 REAL(kind=
dp),
DIMENSION(6, 6) :: amat = 0.0_dp
81 INTEGER,
DIMENSION(:),
POINTER :: states => null()
82 INTEGER :: nstates = 0
95 INTEGER :: ntot = 0, nrestraint = 0
96 INTEGER :: ng3x3 = 0, ng3x3_restraint = 0
97 INTEGER :: ng4x6 = 0, ng4x6_restraint = 0
98 INTEGER :: nvsite = 0, nvsite_restraint = 0
114 INTEGER :: first_atom = 0
115 INTEGER :: last_atom = 0
116 INTEGER :: first_shell = 0
117 INTEGER :: last_shell = 0
156 IF (
ASSOCIATED(gci))
THEN
158 IF (
ASSOCIATED(gci%colv_list))
THEN
159 DO i = 1,
SIZE(gci%colv_list)
160 DEALLOCATE (gci%colv_list(i)%i_atoms)
162 DEALLOCATE (gci%colv_list)
165 IF (
ASSOCIATED(gci%g3x3_list)) &
166 DEALLOCATE (gci%g3x3_list)
168 IF (
ASSOCIATED(gci%g4x6_list)) &
169 DEALLOCATE (gci%g4x6_list)
172 IF (
ASSOCIATED(gci%lcolv))
THEN
173 DO i = 1,
SIZE(gci%lcolv)
177 DEALLOCATE (gci%lcolv)
180 IF (
ASSOCIATED(gci%lg3x3)) &
181 DEALLOCATE (gci%lg3x3)
183 IF (
ASSOCIATED(gci%lg4x6)) &
184 DEALLOCATE (gci%lg4x6)
186 IF (
ASSOCIATED(gci%fixd_list)) &
187 DEALLOCATE (gci%fixd_list)
203 INTEGER,
INTENT(IN) :: nmolecule
207 ALLOCATE (molecule_set(nmolecule))
221 INTEGER :: imolecule, j
223 IF (
ASSOCIATED(molecule_set))
THEN
225 DO imolecule = 1,
SIZE(molecule_set)
226 IF (
ASSOCIATED(molecule_set(imolecule)%lmi))
THEN
227 DO j = 1,
SIZE(molecule_set(imolecule)%lmi)
228 IF (
ASSOCIATED(molecule_set(imolecule)%lmi(j)%states))
THEN
229 DEALLOCATE (molecule_set(imolecule)%lmi(j)%states)
232 DEALLOCATE (molecule_set(imolecule)%lmi)
234 IF (
ASSOCIATED(molecule_set(imolecule)%lci))
THEN
235 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lcolv))
THEN
236 DO j = 1,
SIZE(molecule_set(imolecule)%lci%lcolv)
238 CALL colvar_release(molecule_set(imolecule)%lci%lcolv(j)%colvar_old)
240 DEALLOCATE (molecule_set(imolecule)%lci%lcolv)
242 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg3x3))
THEN
243 DEALLOCATE (molecule_set(imolecule)%lci%lg3x3)
245 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg4x6))
THEN
246 DEALLOCATE (molecule_set(imolecule)%lci%lg4x6)
248 DEALLOCATE (molecule_set(imolecule)%lci)
251 DEALLOCATE (molecule_set)
254 NULLIFY (molecule_set)
275 SUBROUTINE get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, &
276 first_atom, last_atom, first_shell, last_shell)
288 OPTIONAL,
POINTER :: lcolv
289 INTEGER,
OPTIONAL :: first_atom, last_atom, first_shell, &
292 IF (
PRESENT(first_atom)) first_atom = molecule%first_atom
293 IF (
PRESENT(last_atom)) last_atom = molecule%last_atom
294 IF (
PRESENT(first_shell)) first_shell = molecule%first_shell
295 IF (
PRESENT(last_shell)) last_shell = molecule%last_shell
296 IF (
PRESENT(molecule_kind)) molecule_kind => molecule%molecule_kind
297 IF (
PRESENT(lmi)) lmi => molecule%lmi
298 IF (
PRESENT(lci)) lci => molecule%lci
299 IF (
PRESENT(lcolv))
THEN
300 IF (
ASSOCIATED(molecule%lci))
THEN
301 lcolv => molecule%lci%lcolv
303 cpabort(
"The pointer lci is not associated")
306 IF (
PRESENT(lg3x3))
THEN
307 IF (
ASSOCIATED(molecule%lci))
THEN
308 lg3x3 => molecule%lci%lg3x3
310 cpabort(
"The pointer lci is not associated")
313 IF (
PRESENT(lg4x6))
THEN
314 IF (
ASSOCIATED(molecule%lci))
THEN
315 lg4x6 => molecule%lci%lg4x6
317 cpabort(
"The pointer lci is not associated")
336 SUBROUTINE set_molecule(molecule, molecule_kind, lmi, lci, lcolv, lg3x3, lg4x6)
343 OPTIONAL,
POINTER :: lcolv
349 IF (
PRESENT(molecule_kind)) molecule%molecule_kind => molecule_kind
350 IF (
PRESENT(lmi)) molecule%lmi => lmi
351 IF (
PRESENT(lci)) molecule%lci => lci
352 IF (
PRESENT(lcolv))
THEN
353 IF (
ASSOCIATED(molecule%lci))
THEN
354 molecule%lci%lcolv => lcolv
356 cpabort(
"The pointer lci is not associated")
359 IF (
PRESENT(lg3x3))
THEN
360 IF (
ASSOCIATED(molecule%lci))
THEN
361 molecule%lci%lg3x3 => lg3x3
363 cpabort(
"The pointer lci is not associated")
366 IF (
PRESENT(lg4x6))
THEN
367 IF (
ASSOCIATED(molecule%lci))
THEN
368 molecule%lci%lg4x6 => lg4x6
370 cpabort(
"The pointer lci is not associated")
386 TYPE(
molecule_type),
DIMENSION(:),
INTENT(INOUT) :: molecule_set
387 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: first_atom, last_atom
391 IF (
PRESENT(first_atom))
THEN
392 IF (
SIZE(first_atom) /=
SIZE(molecule_set))
THEN
393 CALL cp_abort(__location__, &
394 "The sizes of first_atom and molecule_set "// &
398 DO imolecule = 1,
SIZE(molecule_set)
399 molecule_set(imolecule)%first_atom = first_atom(imolecule)
403 IF (
PRESENT(last_atom))
THEN
404 IF (
SIZE(last_atom) /=
SIZE(molecule_set))
THEN
405 CALL cp_abort(__location__, &
406 "The sizes of last_atom and molecule_set "// &
410 DO imolecule = 1,
SIZE(molecule_set)
411 molecule_set(imolecule)%last_atom = last_atom(imolecule)
423 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
424 INTEGER,
DIMENSION(:),
INTENT(OUT) :: atom_to_mol
426 INTEGER :: first_atom, iatom, imol, last_atom
428 DO imol = 1,
SIZE(molecule_set)
429 CALL get_molecule(molecule=molecule_set(imol), first_atom=first_atom, last_atom=last_atom)
430 DO iatom = first_atom, last_atom
431 atom_to_mol(iatom) = imol
452 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, &
455 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
456 INTEGER,
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: atom_to_mol, mol_to_first_atom, &
457 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity
459 INTEGER :: first_atom, iatom, imol, last_atom, &
461 REAL(kind=
dp) :: charge
464 DO imol = 1,
SIZE(molecule_set)
466 CALL get_molecule(molecule=molecule_set(imol), molecule_kind=imol_kind, &
467 first_atom=first_atom, last_atom=last_atom)
469 IF (
PRESENT(mol_to_nelectrons))
THEN
471 mol_to_nelectrons(imol) = nelec
474 IF (
PRESENT(mol_to_multiplicity))
THEN
485 IF (mod(nelec, 2) .EQ. 0)
THEN
486 mol_to_multiplicity(imol) = 1
488 mol_to_multiplicity(imol) = 2
492 IF (
PRESENT(mol_to_charge))
THEN
494 mol_to_charge(imol) = nint(charge)
497 IF (
PRESENT(mol_to_nbasis))
THEN
499 mol_to_nbasis(imol) = nbasis
502 IF (
PRESENT(mol_to_first_atom))
THEN
503 mol_to_first_atom(imol) = first_atom
506 IF (
PRESENT(mol_to_last_atom))
THEN
507 mol_to_last_atom(imol) = last_atom
510 IF (
PRESENT(atom_to_mol))
THEN
511 DO iatom = first_atom, last_atom
512 atom_to_mol(iatom) = imol
Initialize the collective variables types.
recursive subroutine, public colvar_release(colvar)
releases the memory that might have been allocated by the colvar
Defines the basic variable types.
integer, parameter, public dp
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.
Define the data structure for the molecule information.
subroutine, public deallocate_molecule_set(molecule_set)
Deallocate a molecule set.
subroutine, public deallocate_global_constraint(gci)
Deallocate a global constraint.
subroutine, public get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, first_atom, last_atom, first_shell, last_shell)
Get components from a molecule data set.
subroutine, public allocate_molecule_set(molecule_set, nmolecule)
Allocate a molecule set.
subroutine, public molecule_of_atom(molecule_set, atom_to_mol)
finds for each atom the molecule it belongs to
subroutine, public set_molecule_set(molecule_set, first_atom, last_atom)
Set a molecule data set.
subroutine, public set_molecule(molecule, molecule_kind, lmi, lci, lcolv, lg3x3, lg4x6)
Set a molecule data set.
subroutine, public get_molecule_set_info(molecule_set, atom_to_mol, mol_to_first_atom, mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity)
returns information about molecules in the set.
parameters for a collective variable