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)) &
216 DEALLOCATE (gci%g3x3_list)
218 IF (
ASSOCIATED(gci%g4x6_list)) &
219 DEALLOCATE (gci%g4x6_list)
222 IF (
ASSOCIATED(gci%lcolv))
THEN
223 DO i = 1,
SIZE(gci%lcolv)
227 DEALLOCATE (gci%lcolv)
230 IF (
ASSOCIATED(gci%lg3x3)) &
231 DEALLOCATE (gci%lg3x3)
233 IF (
ASSOCIATED(gci%lg4x6)) &
234 DEALLOCATE (gci%lg4x6)
236 IF (
ASSOCIATED(gci%fixd_list)) &
237 DEALLOCATE (gci%fixd_list)
253 INTEGER,
INTENT(IN) :: nmolecule
257 ALLOCATE (molecule_set(nmolecule))
271 INTEGER :: imolecule, j
273 IF (
ASSOCIATED(molecule_set))
THEN
275 DO imolecule = 1,
SIZE(molecule_set)
276 IF (
ASSOCIATED(molecule_set(imolecule)%lmi))
THEN
277 DO j = 1,
SIZE(molecule_set(imolecule)%lmi)
278 IF (
ASSOCIATED(molecule_set(imolecule)%lmi(j)%states))
THEN
279 DEALLOCATE (molecule_set(imolecule)%lmi(j)%states)
282 DEALLOCATE (molecule_set(imolecule)%lmi)
284 IF (
ASSOCIATED(molecule_set(imolecule)%lci))
THEN
285 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lcolv))
THEN
286 DO j = 1,
SIZE(molecule_set(imolecule)%lci%lcolv)
288 CALL colvar_release(molecule_set(imolecule)%lci%lcolv(j)%colvar_old)
290 DEALLOCATE (molecule_set(imolecule)%lci%lcolv)
292 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg3x3))
THEN
293 DEALLOCATE (molecule_set(imolecule)%lci%lg3x3)
295 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg4x6))
THEN
296 DEALLOCATE (molecule_set(imolecule)%lci%lg4x6)
298 DEALLOCATE (molecule_set(imolecule)%lci)
301 DEALLOCATE (molecule_set)
304 NULLIFY (molecule_set)
325 SUBROUTINE get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, &
326 first_atom, last_atom, first_shell, last_shell)
338 OPTIONAL,
POINTER :: lcolv
339 INTEGER,
OPTIONAL :: first_atom, last_atom, first_shell, &
342 IF (
PRESENT(first_atom)) first_atom = molecule%first_atom
343 IF (
PRESENT(last_atom)) last_atom = molecule%last_atom
344 IF (
PRESENT(first_shell)) first_shell = molecule%first_shell
345 IF (
PRESENT(last_shell)) last_shell = molecule%last_shell
346 IF (
PRESENT(molecule_kind)) molecule_kind => molecule%molecule_kind
347 IF (
PRESENT(lmi)) lmi => molecule%lmi
348 IF (
PRESENT(lci)) lci => molecule%lci
349 IF (
PRESENT(lcolv))
THEN
350 IF (
ASSOCIATED(molecule%lci))
THEN
351 lcolv => molecule%lci%lcolv
353 cpabort(
"The pointer lci is not associated")
356 IF (
PRESENT(lg3x3))
THEN
357 IF (
ASSOCIATED(molecule%lci))
THEN
358 lg3x3 => molecule%lci%lg3x3
360 cpabort(
"The pointer lci is not associated")
363 IF (
PRESENT(lg4x6))
THEN
364 IF (
ASSOCIATED(molecule%lci))
THEN
365 lg4x6 => molecule%lci%lg4x6
367 cpabort(
"The pointer lci is not associated")
386 SUBROUTINE set_molecule(molecule, molecule_kind, lmi, lci, lcolv, lg3x3, lg4x6)
393 OPTIONAL,
POINTER :: lcolv
399 IF (
PRESENT(molecule_kind)) molecule%molecule_kind => molecule_kind
400 IF (
PRESENT(lmi)) molecule%lmi => lmi
401 IF (
PRESENT(lci)) molecule%lci => lci
402 IF (
PRESENT(lcolv))
THEN
403 IF (
ASSOCIATED(molecule%lci))
THEN
404 molecule%lci%lcolv => lcolv
406 cpabort(
"The pointer lci is not associated")
409 IF (
PRESENT(lg3x3))
THEN
410 IF (
ASSOCIATED(molecule%lci))
THEN
411 molecule%lci%lg3x3 => lg3x3
413 cpabort(
"The pointer lci is not associated")
416 IF (
PRESENT(lg4x6))
THEN
417 IF (
ASSOCIATED(molecule%lci))
THEN
418 molecule%lci%lg4x6 => lg4x6
420 cpabort(
"The pointer lci is not associated")
436 TYPE(
molecule_type),
DIMENSION(:),
INTENT(INOUT) :: molecule_set
437 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: first_atom, last_atom
441 IF (
PRESENT(first_atom))
THEN
442 IF (
SIZE(first_atom) /=
SIZE(molecule_set))
THEN
443 CALL cp_abort(__location__, &
444 "The sizes of first_atom and molecule_set "// &
448 DO imolecule = 1,
SIZE(molecule_set)
449 molecule_set(imolecule)%first_atom = first_atom(imolecule)
453 IF (
PRESENT(last_atom))
THEN
454 IF (
SIZE(last_atom) /=
SIZE(molecule_set))
THEN
455 CALL cp_abort(__location__, &
456 "The sizes of last_atom and molecule_set "// &
460 DO imolecule = 1,
SIZE(molecule_set)
461 molecule_set(imolecule)%last_atom = last_atom(imolecule)
473 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
474 INTEGER,
DIMENSION(:),
INTENT(OUT) :: atom_to_mol
476 INTEGER :: first_atom, iatom, imol, last_atom
478 DO imol = 1,
SIZE(molecule_set)
479 CALL get_molecule(molecule=molecule_set(imol), first_atom=first_atom, last_atom=last_atom)
480 DO iatom = first_atom, last_atom
481 atom_to_mol(iatom) = imol
502 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, &
505 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
506 INTEGER,
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: atom_to_mol, mol_to_first_atom, &
507 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity
509 INTEGER :: first_atom, iatom, imol, last_atom, &
511 REAL(kind=
dp) :: charge
514 DO imol = 1,
SIZE(molecule_set)
516 CALL get_molecule(molecule=molecule_set(imol), molecule_kind=imol_kind, &
517 first_atom=first_atom, last_atom=last_atom)
519 IF (
PRESENT(mol_to_nelectrons))
THEN
521 mol_to_nelectrons(imol) = nelec
524 IF (
PRESENT(mol_to_multiplicity))
THEN
535 IF (mod(nelec, 2) == 0)
THEN
536 mol_to_multiplicity(imol) = 1
538 mol_to_multiplicity(imol) = 2
542 IF (
PRESENT(mol_to_charge))
THEN
544 mol_to_charge(imol) = nint(charge)
547 IF (
PRESENT(mol_to_nbasis))
THEN
549 mol_to_nbasis(imol) = nbasis
552 IF (
PRESENT(mol_to_first_atom))
THEN
553 mol_to_first_atom(imol) = first_atom
556 IF (
PRESENT(mol_to_last_atom))
THEN
557 mol_to_last_atom(imol) = last_atom
560 IF (
PRESENT(atom_to_mol))
THEN
561 DO iatom = first_atom, last_atom
562 atom_to_mol(iatom) = imol
582 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, &
585 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
586 INTEGER,
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: atom_to_mol, mol_to_first_atom, &
587 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity
589 INTEGER :: first_atom, iatom, imol, last_atom, &
591 REAL(kind=
dp) :: charge
594 DO imol = 1,
SIZE(molecule_set)
596 CALL get_molecule(molecule=molecule_set(imol), molecule_kind=imol_kind, &
597 first_atom=first_atom, last_atom=last_atom)
599 IF (
PRESENT(mol_to_nelectrons))
THEN
601 mol_to_nelectrons(imol) = nelec
604 IF (
PRESENT(mol_to_multiplicity))
THEN
615 IF (mod(nelec, 2) == 0)
THEN
616 mol_to_multiplicity(imol) = 1
618 mol_to_multiplicity(imol) = 2
622 IF (
PRESENT(mol_to_charge))
THEN
624 mol_to_charge(imol) = nint(charge)
627 IF (
PRESENT(mol_to_nbasis))
THEN
629 mol_to_nbasis(imol) = nbasis
632 IF (
PRESENT(mol_to_first_atom))
THEN
633 mol_to_first_atom(imol) = first_atom
636 IF (
PRESENT(mol_to_last_atom))
THEN
637 mol_to_last_atom(imol) = last_atom
640 IF (
PRESENT(atom_to_mol))
THEN
641 DO iatom = first_atom, last_atom
642 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