29#include "../base/base_uses.f90"
37 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'molecule_types'
43 REAL(kind=
dp) :: lambda = 0.0_dp, &
45 LOGICAL :: init = .false.
49 LOGICAL :: init = .false.
50 REAL(kind=
dp) :: scale = 0.0_dp, &
55 REAL(kind=
dp),
DIMENSION(3) :: fa = 0.0_dp, &
70 del_lambda = 0.0_dp, &
73 REAL(kind=
dp),
DIMENSION(3, 3) :: amat = 0.0_dp
77 LOGICAL :: init = .false.
78 REAL(kind=
dp) :: scale = 0.0_dp, &
84 REAL(kind=
dp),
DIMENSION(3) :: fa = 0.0_dp, &
114 REAL(kind=
dp),
DIMENSION(6) :: del_lambda = 0.0_dp, &
117 REAL(kind=
dp),
DIMENSION(6, 6) :: amat = 0.0_dp
121 INTEGER :: nstates = 0
122 INTEGER,
DIMENSION(:),
POINTER :: states => null()
127 DIMENSION(:),
POINTER :: lcolv => null()
129 POINTER :: lg3x3 => null()
131 POINTER :: lg4x6 => null()
136 INTEGER :: ntot = 0, &
139 ng3x3_restraint = 0, &
141 ng4x6_restraint = 0, &
146 POINTER :: colv_list => null()
151 DIMENSION(:),
POINTER :: lcolv => null()
153 POINTER :: lg3x3 => null()
155 POINTER :: lg4x6 => null()
163 INTEGER :: first_atom = 0
164 INTEGER :: last_atom = 0
165 INTEGER :: first_shell = 0
166 INTEGER :: last_shell = 0
205 IF (
ASSOCIATED(gci))
THEN
207 IF (
ASSOCIATED(gci%colv_list))
THEN
208 DO i = 1,
SIZE(gci%colv_list)
209 DEALLOCATE (gci%colv_list(i)%i_atoms)
211 DEALLOCATE (gci%colv_list)
214 IF (
ASSOCIATED(gci%g3x3_list)) &
215 DEALLOCATE (gci%g3x3_list)
217 IF (
ASSOCIATED(gci%g4x6_list)) &
218 DEALLOCATE (gci%g4x6_list)
221 IF (
ASSOCIATED(gci%lcolv))
THEN
222 DO i = 1,
SIZE(gci%lcolv)
226 DEALLOCATE (gci%lcolv)
229 IF (
ASSOCIATED(gci%lg3x3)) &
230 DEALLOCATE (gci%lg3x3)
232 IF (
ASSOCIATED(gci%lg4x6)) &
233 DEALLOCATE (gci%lg4x6)
235 IF (
ASSOCIATED(gci%fixd_list)) &
236 DEALLOCATE (gci%fixd_list)
252 INTEGER,
INTENT(IN) :: nmolecule
256 ALLOCATE (molecule_set(nmolecule))
270 INTEGER :: imolecule, j
272 IF (
ASSOCIATED(molecule_set))
THEN
274 DO imolecule = 1,
SIZE(molecule_set)
275 IF (
ASSOCIATED(molecule_set(imolecule)%lmi))
THEN
276 DO j = 1,
SIZE(molecule_set(imolecule)%lmi)
277 IF (
ASSOCIATED(molecule_set(imolecule)%lmi(j)%states))
THEN
278 DEALLOCATE (molecule_set(imolecule)%lmi(j)%states)
281 DEALLOCATE (molecule_set(imolecule)%lmi)
283 IF (
ASSOCIATED(molecule_set(imolecule)%lci))
THEN
284 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lcolv))
THEN
285 DO j = 1,
SIZE(molecule_set(imolecule)%lci%lcolv)
287 CALL colvar_release(molecule_set(imolecule)%lci%lcolv(j)%colvar_old)
289 DEALLOCATE (molecule_set(imolecule)%lci%lcolv)
291 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg3x3))
THEN
292 DEALLOCATE (molecule_set(imolecule)%lci%lg3x3)
294 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg4x6))
THEN
295 DEALLOCATE (molecule_set(imolecule)%lci%lg4x6)
297 DEALLOCATE (molecule_set(imolecule)%lci)
300 DEALLOCATE (molecule_set)
303 NULLIFY (molecule_set)
324 SUBROUTINE get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, &
325 first_atom, last_atom, first_shell, last_shell)
337 OPTIONAL,
POINTER :: lcolv
338 INTEGER,
OPTIONAL :: first_atom, last_atom, first_shell, &
341 IF (
PRESENT(first_atom)) first_atom = molecule%first_atom
342 IF (
PRESENT(last_atom)) last_atom = molecule%last_atom
343 IF (
PRESENT(first_shell)) first_shell = molecule%first_shell
344 IF (
PRESENT(last_shell)) last_shell = molecule%last_shell
345 IF (
PRESENT(molecule_kind)) molecule_kind => molecule%molecule_kind
346 IF (
PRESENT(lmi)) lmi => molecule%lmi
347 IF (
PRESENT(lci)) lci => molecule%lci
348 IF (
PRESENT(lcolv))
THEN
349 IF (
ASSOCIATED(molecule%lci))
THEN
350 lcolv => molecule%lci%lcolv
352 cpabort(
"The pointer lci is not associated")
355 IF (
PRESENT(lg3x3))
THEN
356 IF (
ASSOCIATED(molecule%lci))
THEN
357 lg3x3 => molecule%lci%lg3x3
359 cpabort(
"The pointer lci is not associated")
362 IF (
PRESENT(lg4x6))
THEN
363 IF (
ASSOCIATED(molecule%lci))
THEN
364 lg4x6 => molecule%lci%lg4x6
366 cpabort(
"The pointer lci is not associated")
385 SUBROUTINE set_molecule(molecule, molecule_kind, lmi, lci, lcolv, lg3x3, lg4x6)
392 OPTIONAL,
POINTER :: lcolv
398 IF (
PRESENT(molecule_kind)) molecule%molecule_kind => molecule_kind
399 IF (
PRESENT(lmi)) molecule%lmi => lmi
400 IF (
PRESENT(lci)) molecule%lci => lci
401 IF (
PRESENT(lcolv))
THEN
402 IF (
ASSOCIATED(molecule%lci))
THEN
403 molecule%lci%lcolv => lcolv
405 cpabort(
"The pointer lci is not associated")
408 IF (
PRESENT(lg3x3))
THEN
409 IF (
ASSOCIATED(molecule%lci))
THEN
410 molecule%lci%lg3x3 => lg3x3
412 cpabort(
"The pointer lci is not associated")
415 IF (
PRESENT(lg4x6))
THEN
416 IF (
ASSOCIATED(molecule%lci))
THEN
417 molecule%lci%lg4x6 => lg4x6
419 cpabort(
"The pointer lci is not associated")
435 TYPE(
molecule_type),
DIMENSION(:),
INTENT(INOUT) :: molecule_set
436 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: first_atom, last_atom
440 IF (
PRESENT(first_atom))
THEN
441 IF (
SIZE(first_atom) /=
SIZE(molecule_set))
THEN
442 CALL cp_abort(__location__, &
443 "The sizes of first_atom and molecule_set "// &
447 DO imolecule = 1,
SIZE(molecule_set)
448 molecule_set(imolecule)%first_atom = first_atom(imolecule)
452 IF (
PRESENT(last_atom))
THEN
453 IF (
SIZE(last_atom) /=
SIZE(molecule_set))
THEN
454 CALL cp_abort(__location__, &
455 "The sizes of last_atom and molecule_set "// &
459 DO imolecule = 1,
SIZE(molecule_set)
460 molecule_set(imolecule)%last_atom = last_atom(imolecule)
472 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
473 INTEGER,
DIMENSION(:),
INTENT(OUT) :: atom_to_mol
475 INTEGER :: first_atom, iatom, imol, last_atom
477 DO imol = 1,
SIZE(molecule_set)
478 CALL get_molecule(molecule=molecule_set(imol), first_atom=first_atom, last_atom=last_atom)
479 DO iatom = first_atom, last_atom
480 atom_to_mol(iatom) = imol
501 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, &
504 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
505 INTEGER,
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: atom_to_mol, mol_to_first_atom, &
506 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity
508 INTEGER :: first_atom, iatom, imol, last_atom, &
510 REAL(kind=
dp) :: charge
513 DO imol = 1,
SIZE(molecule_set)
515 CALL get_molecule(molecule=molecule_set(imol), molecule_kind=imol_kind, &
516 first_atom=first_atom, last_atom=last_atom)
518 IF (
PRESENT(mol_to_nelectrons))
THEN
520 mol_to_nelectrons(imol) = nelec
523 IF (
PRESENT(mol_to_multiplicity))
THEN
534 IF (mod(nelec, 2) .EQ. 0)
THEN
535 mol_to_multiplicity(imol) = 1
537 mol_to_multiplicity(imol) = 2
541 IF (
PRESENT(mol_to_charge))
THEN
543 mol_to_charge(imol) = nint(charge)
546 IF (
PRESENT(mol_to_nbasis))
THEN
548 mol_to_nbasis(imol) = nbasis
551 IF (
PRESENT(mol_to_first_atom))
THEN
552 mol_to_first_atom(imol) = first_atom
555 IF (
PRESENT(mol_to_last_atom))
THEN
556 mol_to_last_atom(imol) = last_atom
559 IF (
PRESENT(atom_to_mol))
THEN
560 DO iatom = first_atom, last_atom
561 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