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 LOGICAL :: joint_colvar_checks = .false.
137 INTEGER :: ntot = 0, &
140 ng3x3_restraint = 0, &
142 ng4x6_restraint = 0, &
147 POINTER :: colv_list => null()
152 DIMENSION(:),
POINTER :: lcolv => null()
154 POINTER :: lg3x3 => null()
156 POINTER :: lg4x6 => null()
164 INTEGER :: first_atom = 0
165 INTEGER :: last_atom = 0
166 INTEGER :: first_shell = 0
167 INTEGER :: last_shell = 0
207 IF (
ASSOCIATED(gci))
THEN
209 IF (
ASSOCIATED(gci%colv_list))
THEN
210 DO i = 1,
SIZE(gci%colv_list)
211 DEALLOCATE (gci%colv_list(i)%i_atoms)
213 DEALLOCATE (gci%colv_list)
216 IF (
ASSOCIATED(gci%g3x3_list))
THEN
217 DEALLOCATE (gci%g3x3_list)
220 IF (
ASSOCIATED(gci%g4x6_list))
THEN
221 DEALLOCATE (gci%g4x6_list)
225 IF (
ASSOCIATED(gci%lcolv))
THEN
226 DO i = 1,
SIZE(gci%lcolv)
230 DEALLOCATE (gci%lcolv)
233 IF (
ASSOCIATED(gci%lg3x3))
THEN
234 DEALLOCATE (gci%lg3x3)
237 IF (
ASSOCIATED(gci%lg4x6))
THEN
238 DEALLOCATE (gci%lg4x6)
241 IF (
ASSOCIATED(gci%fixd_list))
THEN
242 DEALLOCATE (gci%fixd_list)
259 INTEGER,
INTENT(IN) :: nmolecule
263 ALLOCATE (molecule_set(nmolecule))
277 INTEGER :: imolecule, j
279 IF (
ASSOCIATED(molecule_set))
THEN
281 DO imolecule = 1,
SIZE(molecule_set)
282 IF (
ASSOCIATED(molecule_set(imolecule)%lmi))
THEN
283 DO j = 1,
SIZE(molecule_set(imolecule)%lmi)
284 IF (
ASSOCIATED(molecule_set(imolecule)%lmi(j)%states))
THEN
285 DEALLOCATE (molecule_set(imolecule)%lmi(j)%states)
288 DEALLOCATE (molecule_set(imolecule)%lmi)
290 IF (
ASSOCIATED(molecule_set(imolecule)%lci))
THEN
291 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lcolv))
THEN
292 DO j = 1,
SIZE(molecule_set(imolecule)%lci%lcolv)
294 CALL colvar_release(molecule_set(imolecule)%lci%lcolv(j)%colvar_old)
296 DEALLOCATE (molecule_set(imolecule)%lci%lcolv)
298 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg3x3))
THEN
299 DEALLOCATE (molecule_set(imolecule)%lci%lg3x3)
301 IF (
ASSOCIATED(molecule_set(imolecule)%lci%lg4x6))
THEN
302 DEALLOCATE (molecule_set(imolecule)%lci%lg4x6)
304 DEALLOCATE (molecule_set(imolecule)%lci)
307 DEALLOCATE (molecule_set)
310 NULLIFY (molecule_set)
331 SUBROUTINE get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, &
332 first_atom, last_atom, first_shell, last_shell)
344 OPTIONAL,
POINTER :: lcolv
345 INTEGER,
OPTIONAL :: first_atom, last_atom, first_shell, &
348 IF (
PRESENT(first_atom)) first_atom = molecule%first_atom
349 IF (
PRESENT(last_atom)) last_atom = molecule%last_atom
350 IF (
PRESENT(first_shell)) first_shell = molecule%first_shell
351 IF (
PRESENT(last_shell)) last_shell = molecule%last_shell
352 IF (
PRESENT(molecule_kind)) molecule_kind => molecule%molecule_kind
353 IF (
PRESENT(lmi)) lmi => molecule%lmi
354 IF (
PRESENT(lci)) lci => molecule%lci
355 IF (
PRESENT(lcolv))
THEN
356 IF (
ASSOCIATED(molecule%lci))
THEN
357 lcolv => molecule%lci%lcolv
359 cpabort(
"The pointer lci is not associated")
362 IF (
PRESENT(lg3x3))
THEN
363 IF (
ASSOCIATED(molecule%lci))
THEN
364 lg3x3 => molecule%lci%lg3x3
366 cpabort(
"The pointer lci is not associated")
369 IF (
PRESENT(lg4x6))
THEN
370 IF (
ASSOCIATED(molecule%lci))
THEN
371 lg4x6 => molecule%lci%lg4x6
373 cpabort(
"The pointer lci is not associated")
392 SUBROUTINE set_molecule(molecule, molecule_kind, lmi, lci, lcolv, lg3x3, lg4x6)
399 OPTIONAL,
POINTER :: lcolv
405 IF (
PRESENT(molecule_kind)) molecule%molecule_kind => molecule_kind
406 IF (
PRESENT(lmi)) molecule%lmi => lmi
407 IF (
PRESENT(lci)) molecule%lci => lci
408 IF (
PRESENT(lcolv))
THEN
409 IF (
ASSOCIATED(molecule%lci))
THEN
410 molecule%lci%lcolv => lcolv
412 cpabort(
"The pointer lci is not associated")
415 IF (
PRESENT(lg3x3))
THEN
416 IF (
ASSOCIATED(molecule%lci))
THEN
417 molecule%lci%lg3x3 => lg3x3
419 cpabort(
"The pointer lci is not associated")
422 IF (
PRESENT(lg4x6))
THEN
423 IF (
ASSOCIATED(molecule%lci))
THEN
424 molecule%lci%lg4x6 => lg4x6
426 cpabort(
"The pointer lci is not associated")
442 TYPE(
molecule_type),
DIMENSION(:),
INTENT(INOUT) :: molecule_set
443 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: first_atom, last_atom
447 IF (
PRESENT(first_atom))
THEN
448 IF (
SIZE(first_atom) /=
SIZE(molecule_set))
THEN
449 CALL cp_abort(__location__, &
450 "The sizes of first_atom and molecule_set "// &
454 DO imolecule = 1,
SIZE(molecule_set)
455 molecule_set(imolecule)%first_atom = first_atom(imolecule)
459 IF (
PRESENT(last_atom))
THEN
460 IF (
SIZE(last_atom) /=
SIZE(molecule_set))
THEN
461 CALL cp_abort(__location__, &
462 "The sizes of last_atom and molecule_set "// &
466 DO imolecule = 1,
SIZE(molecule_set)
467 molecule_set(imolecule)%last_atom = last_atom(imolecule)
479 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
480 INTEGER,
DIMENSION(:),
INTENT(OUT) :: atom_to_mol
482 INTEGER :: first_atom, iatom, imol, last_atom
484 DO imol = 1,
SIZE(molecule_set)
485 CALL get_molecule(molecule=molecule_set(imol), first_atom=first_atom, last_atom=last_atom)
486 DO iatom = first_atom, last_atom
487 atom_to_mol(iatom) = imol
508 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, &
511 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
512 INTEGER,
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: atom_to_mol, mol_to_first_atom, &
513 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity
515 INTEGER :: first_atom, iatom, imol, last_atom, &
517 REAL(kind=
dp) :: charge
520 DO imol = 1,
SIZE(molecule_set)
522 CALL get_molecule(molecule=molecule_set(imol), molecule_kind=imol_kind, &
523 first_atom=first_atom, last_atom=last_atom)
525 IF (
PRESENT(mol_to_nelectrons))
THEN
527 mol_to_nelectrons(imol) = nelec
530 IF (
PRESENT(mol_to_multiplicity))
THEN
541 IF (mod(nelec, 2) == 0)
THEN
542 mol_to_multiplicity(imol) = 1
544 mol_to_multiplicity(imol) = 2
548 IF (
PRESENT(mol_to_charge))
THEN
550 mol_to_charge(imol) = nint(charge)
553 IF (
PRESENT(mol_to_nbasis))
THEN
555 mol_to_nbasis(imol) = nbasis
558 IF (
PRESENT(mol_to_first_atom))
THEN
559 mol_to_first_atom(imol) = first_atom
562 IF (
PRESENT(mol_to_last_atom))
THEN
563 mol_to_last_atom(imol) = last_atom
566 IF (
PRESENT(atom_to_mol))
THEN
567 DO iatom = first_atom, last_atom
568 atom_to_mol(iatom) = imol
588 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, &
591 TYPE(
molecule_type),
DIMENSION(:),
INTENT(IN) :: molecule_set
592 INTEGER,
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: atom_to_mol, mol_to_first_atom, &
593 mol_to_last_atom, mol_to_nelectrons, mol_to_nbasis, mol_to_charge, mol_to_multiplicity
595 INTEGER :: first_atom, iatom, imol, last_atom, &
597 REAL(kind=
dp) :: charge
600 DO imol = 1,
SIZE(molecule_set)
602 CALL get_molecule(molecule=molecule_set(imol), molecule_kind=imol_kind, &
603 first_atom=first_atom, last_atom=last_atom)
605 IF (
PRESENT(mol_to_nelectrons))
THEN
607 mol_to_nelectrons(imol) = nelec
610 IF (
PRESENT(mol_to_multiplicity))
THEN
621 IF (mod(nelec, 2) == 0)
THEN
622 mol_to_multiplicity(imol) = 1
624 mol_to_multiplicity(imol) = 2
628 IF (
PRESENT(mol_to_charge))
THEN
630 mol_to_charge(imol) = nint(charge)
633 IF (
PRESENT(mol_to_nbasis))
THEN
635 mol_to_nbasis(imol) = nbasis
638 IF (
PRESENT(mol_to_first_atom))
THEN
639 mol_to_first_atom(imol) = first_atom
642 IF (
PRESENT(mol_to_last_atom))
THEN
643 mol_to_last_atom(imol) = last_atom
646 IF (
PRESENT(atom_to_mol))
THEN
647 DO iatom = first_atom, last_atom
648 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