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
206 IF (
ASSOCIATED(gci))
THEN
208 IF (
ASSOCIATED(gci%colv_list))
THEN
209 DO i = 1,
SIZE(gci%colv_list)
210 DEALLOCATE (gci%colv_list(i)%i_atoms)
212 DEALLOCATE (gci%colv_list)
215 IF (
ASSOCIATED(gci%g3x3_list))
THEN
216 DEALLOCATE (gci%g3x3_list)
219 IF (
ASSOCIATED(gci%g4x6_list))
THEN
220 DEALLOCATE (gci%g4x6_list)
224 IF (
ASSOCIATED(gci%lcolv))
THEN
225 DO i = 1,
SIZE(gci%lcolv)
229 DEALLOCATE (gci%lcolv)
232 IF (
ASSOCIATED(gci%lg3x3))
THEN
233 DEALLOCATE (gci%lg3x3)
236 IF (
ASSOCIATED(gci%lg4x6))
THEN
237 DEALLOCATE (gci%lg4x6)
240 IF (
ASSOCIATED(gci%fixd_list))
THEN
241 DEALLOCATE (gci%fixd_list)
258 INTEGER,
INTENT(IN) :: nmolecule
262 ALLOCATE (molecule_set(nmolecule))
276 INTEGER :: imolecule, j
278 IF (
ASSOCIATED(molecule_set))
THEN
280 DO imolecule = 1,
SIZE(molecule_set)
281 IF (
ASSOCIATED(molecule_set(imolecule)%lmi))
THEN
282 DO j = 1,
SIZE(molecule_set(imolecule)%lmi)
283 IF (
ASSOCIATED(molecule_set(imolecule)%lmi(j)%states))
THEN
284 DEALLOCATE (molecule_set(imolecule)%lmi(j)%states)
287 DEALLOCATE (molecule_set(imolecule)%lmi)
289 IF (
ASSOCIATED(molecule_set(imolecule)%lci))
THEN
290 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lcolv))
THEN
291 DO j = 1,
SIZE(molecule_set(imolecule)%lci%lcolv)
293 CALL colvar_release(molecule_set(imolecule)%lci%lcolv(j)%colvar_old)
295 DEALLOCATE (molecule_set(imolecule)%lci%lcolv)
297 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg3x3))
THEN
298 DEALLOCATE (molecule_set(imolecule)%lci%lg3x3)
300 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg4x6))
THEN
301 DEALLOCATE (molecule_set(imolecule)%lci%lg4x6)
303 DEALLOCATE (molecule_set(imolecule)%lci)
306 DEALLOCATE (molecule_set)
309 NULLIFY (molecule_set)
330 SUBROUTINE get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, &
331 first_atom, last_atom, first_shell, last_shell)
343 OPTIONAL,
POINTER :: lcolv
344 INTEGER,
OPTIONAL :: first_atom, last_atom, first_shell, &
347 IF (
PRESENT(first_atom)) first_atom = molecule%first_atom
348 IF (
PRESENT(last_atom)) last_atom = molecule%last_atom
349 IF (
PRESENT(first_shell)) first_shell = molecule%first_shell
350 IF (
PRESENT(last_shell)) last_shell = molecule%last_shell
351 IF (
PRESENT(molecule_kind)) molecule_kind => molecule%molecule_kind
352 IF (
PRESENT(lmi)) lmi => molecule%lmi
353 IF (
PRESENT(lci)) lci => molecule%lci
354 IF (
PRESENT(lcolv))
THEN
355 IF (
ASSOCIATED(molecule%lci))
THEN
356 lcolv => molecule%lci%lcolv
358 cpabort(
"The pointer lci is not associated")
361 IF (
PRESENT(lg3x3))
THEN
362 IF (
ASSOCIATED(molecule%lci))
THEN
363 lg3x3 => molecule%lci%lg3x3
365 cpabort(
"The pointer lci is not associated")
368 IF (
PRESENT(lg4x6))
THEN
369 IF (
ASSOCIATED(molecule%lci))
THEN
370 lg4x6 => molecule%lci%lg4x6
372 cpabort(
"The pointer lci is not associated")
391 SUBROUTINE set_molecule(molecule, molecule_kind, lmi, lci, lcolv, lg3x3, lg4x6)
398 OPTIONAL,
POINTER :: lcolv
404 IF (
PRESENT(molecule_kind)) molecule%molecule_kind => molecule_kind
405 IF (
PRESENT(lmi)) molecule%lmi => lmi
406 IF (
PRESENT(lci)) molecule%lci => lci
407 IF (
PRESENT(lcolv))
THEN
408 IF (
ASSOCIATED(molecule%lci))
THEN
409 molecule%lci%lcolv => lcolv
411 cpabort(
"The pointer lci is not associated")
414 IF (
PRESENT(lg3x3))
THEN
415 IF (
ASSOCIATED(molecule%lci))
THEN
416 molecule%lci%lg3x3 => lg3x3
418 cpabort(
"The pointer lci is not associated")
421 IF (
PRESENT(lg4x6))
THEN
422 IF (
ASSOCIATED(molecule%lci))
THEN
423 molecule%lci%lg4x6 => lg4x6
425 cpabort(
"The pointer lci is not associated")
441 TYPE(
molecule_type),
DIMENSION(:),
INTENT(INOUT) :: molecule_set
442 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: first_atom, last_atom
446 IF (
PRESENT(first_atom))
THEN
447 IF (
SIZE(first_atom) /=
SIZE(molecule_set))
THEN
448 CALL cp_abort(__location__, &
449 "The sizes of first_atom and molecule_set "// &
453 DO imolecule = 1,
SIZE(molecule_set)
454 molecule_set(imolecule)%first_atom = first_atom(imolecule)
458 IF (
PRESENT(last_atom))
THEN
459 IF (
SIZE(last_atom) /=
SIZE(molecule_set))
THEN
460 CALL cp_abort(__location__, &
461 "The sizes of last_atom and molecule_set "// &
465 DO imolecule = 1,
SIZE(molecule_set)
466 molecule_set(imolecule)%last_atom = last_atom(imolecule)
478 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
479 INTEGER,
DIMENSION(:),
INTENT(OUT) :: atom_to_mol
481 INTEGER :: first_atom, iatom, imol, last_atom
483 DO imol = 1,
SIZE(molecule_set)
484 CALL get_molecule(molecule=molecule_set(imol), first_atom=first_atom, last_atom=last_atom)
485 DO iatom = first_atom, last_atom
486 atom_to_mol(iatom) = imol
507 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, &
510 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
511 INTEGER,
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: atom_to_mol, mol_to_first_atom, &
512 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity
514 INTEGER :: first_atom, iatom, imol, last_atom, &
516 REAL(kind=
dp) :: charge
519 DO imol = 1,
SIZE(molecule_set)
521 CALL get_molecule(molecule=molecule_set(imol), molecule_kind=imol_kind, &
522 first_atom=first_atom, last_atom=last_atom)
524 IF (
PRESENT(mol_to_nelectrons))
THEN
526 mol_to_nelectrons(imol) = nelec
529 IF (
PRESENT(mol_to_multiplicity))
THEN
540 IF (mod(nelec, 2) == 0)
THEN
541 mol_to_multiplicity(imol) = 1
543 mol_to_multiplicity(imol) = 2
547 IF (
PRESENT(mol_to_charge))
THEN
549 mol_to_charge(imol) = nint(charge)
552 IF (
PRESENT(mol_to_nbasis))
THEN
554 mol_to_nbasis(imol) = nbasis
557 IF (
PRESENT(mol_to_first_atom))
THEN
558 mol_to_first_atom(imol) = first_atom
561 IF (
PRESENT(mol_to_last_atom))
THEN
562 mol_to_last_atom(imol) = last_atom
565 IF (
PRESENT(atom_to_mol))
THEN
566 DO iatom = first_atom, last_atom
567 atom_to_mol(iatom) = imol
587 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, &
590 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
591 INTEGER,
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: atom_to_mol, mol_to_first_atom, &
592 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity
594 INTEGER :: first_atom, iatom, imol, last_atom, &
596 REAL(kind=
dp) :: charge
599 DO imol = 1,
SIZE(molecule_set)
601 CALL get_molecule(molecule=molecule_set(imol), molecule_kind=imol_kind, &
602 first_atom=first_atom, last_atom=last_atom)
604 IF (
PRESENT(mol_to_nelectrons))
THEN
606 mol_to_nelectrons(imol) = nelec
609 IF (
PRESENT(mol_to_multiplicity))
THEN
620 IF (mod(nelec, 2) == 0)
THEN
621 mol_to_multiplicity(imol) = 1
623 mol_to_multiplicity(imol) = 2
627 IF (
PRESENT(mol_to_charge))
THEN
629 mol_to_charge(imol) = nint(charge)
632 IF (
PRESENT(mol_to_nbasis))
THEN
634 mol_to_nbasis(imol) = nbasis
637 IF (
PRESENT(mol_to_first_atom))
THEN
638 mol_to_first_atom(imol) = first_atom
641 IF (
PRESENT(mol_to_last_atom))
THEN
642 mol_to_last_atom(imol) = last_atom
645 IF (
PRESENT(atom_to_mol))
THEN
646 DO iatom = first_atom, last_atom
647 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 get_domain_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)
...
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