Skip to content

Commit

Permalink
Merge pull request #67 from rsdefever/fix/ring-frags
Browse files Browse the repository at this point in the history
Fix/ring fragments
  • Loading branch information
rsdefever committed Aug 12, 2020
2 parents 0255ae0 + d173528 commit 22441fa
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 14 deletions.
8 changes: 7 additions & 1 deletion Documentation/Tex/howto.tex
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ \subsection{Fragment Library Generation}
bonded to the ring atoms. For each fragment identified, Cassandra runs
a pre\textendash simulation in the gas phase to sample the intramolecular degrees
of freedom. A library of a large number of these conformations are
stored for use in an actual simulation. \\ \\
stored for use in an actual simulation. \emph{Note that intramolecular
degrees of freedom may not be properly sampled in fused-ring systems. We
highly encourage anyone simulating such systems to compare the internal
angle and dihedral distributions in the fragment library with a
constrained bond length molecular dynamics simulation of the relevant fragment
in vacuum.}\\ \\

%
%
The gas phase library generation has been automated with the script \texttt{library\_setup.py} located in the \texttt{Scripts/Frag\_Library\_Setup}
Expand Down
3 changes: 2 additions & 1 deletion Documentation/Tex/introduction.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ \chapter{Introduction}
I''-type force field having fixed bond lengths, harmonic bond angles
and improper angles, a CHARMM or OPLS-style dihedral potential, a
Lennard-Jones 12-6 potential and fixed partial charges. It does {\em
not} treat flexible bond lengths. Cassandra uses OpenMP parallelization and comes
not} treat flexible bond lengths. Fused ring systems should
be simulated with caution. Cassandra uses OpenMP parallelization and comes
with a number of scripts, utilities and examples to help with
simulation setup. \\ \\
%
Expand Down
16 changes: 11 additions & 5 deletions Src/move_ring_flip.f90
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,18 @@ SUBROUTINE Flip_Move

! save the orignal coordinates
Call Save_Old_Cartesian_Coordinates(im,is)

! Choose a ring atom to flip
atom_num = INT ( rranf() * nring_atoms(is)) + 1

! obtain id
this_atom = ring_atom_ids(atom_num,is)
! This do loop is safe b/c ring_fragment_driver
! confirms that not all ring_atoms are multiring_atoms
DO WHILE (.TRUE.)
! Choose a ring atom to flip
atom_num = INT ( rranf() * nring_atoms(is)) + 1
! obtain id
this_atom = ring_atom_ids(atom_num,is)
IF (nonbond_list(this_atom, is)%multiring_atom .EQV. .FALSE.) THEN
EXIT
ENDIF
END DO

! Figure out the bond angle that contains this_atom at the apex
DO i = 1, angle_part_list(this_atom,is)%nangles
Expand Down
4 changes: 2 additions & 2 deletions Src/participation.f90
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ SUBROUTINE Participation
! and all other do not need to be scaled by kboltz. Valid for LJ and Mie.
! Other (and future) potentials perhaps not.
IF (j == 1) THEN
WRITE(201,'(F11.7,2X)',ADVANCE='NO') nonbond_list(ia,is)%vdw_param(j)/kboltz
WRITE(201,'(F11.7,2X)',ADVANCE='NO') nonbond_list(this_atom,is)%vdw_param(j)/kboltz
ELSE
WRITE(201,'(F11.7,2X)',ADVANCE='NO') nonbond_list(ia,is)%vdw_param(j)
WRITE(201,'(F11.7,2X)',ADVANCE='NO') nonbond_list(this_atom,is)%vdw_param(j)
END IF
END DO
IF (nonbond_list(this_atom,is)%ring_atom) THEN
Expand Down
70 changes: 66 additions & 4 deletions Src/ring_fragment_driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ SUBROUTINE Ring_Fragment_Driver
! main
!
! CALLS
!
! ID_Multiring_Atoms
! Flip_Move
! Atom_Displacement
!
Expand All @@ -63,18 +63,21 @@ SUBROUTINE Ring_Fragment_Driver

IMPLICIT NONE

INTEGER :: is, im, ibox, i, ia, nring_success, nexoring_success
INTEGER :: is, im, ibox, ia, nring_success, nexoring_success
INTEGER :: nexoring_trials, nring_trials

REAL(DP) :: rand_no

LOGICAL :: overlap

! Fragment routine is only called with 1 box, species, and molecule
is = 1
im = 1
ibox = 1

! ID atoms that belong to more than 1 ring
IF (cut_ring >= 0.0) THEN
CALL ID_Multiring_Atoms(is)
ENDIF

nring_success = 0
nexoring_success = 0
nring_trials = 0
Expand Down Expand Up @@ -133,4 +136,63 @@ SUBROUTINE Ring_Fragment_Driver
WRITE(*,'(X,A,T40,I8)') 'Number of successful exoring trials', nexoring_success

END SUBROUTINE Ring_Fragment_Driver

SUBROUTINE ID_Multiring_Atoms(is)
!*****************************************************************************
!
! CALLED BY
!
! Ring_Fragment_Driver
!
! CALLS
!
!*****************************************************************************

USE Global_Variables

IMPLICIT NONE

INTEGER, INTENT(IN) :: is
INTEGER :: i, j, atom1, atom2, this_atom, angle_id
INTEGER :: nmultiring_atoms, atom_ring_count

! If trying ring flip moves, identify the ring atoms that
! belong to multiple rings. They cannot be used for flip
! moves. Also ensure >0 atoms can be used for the flip move.
nmultiring_atoms = 0
DO i = 1, nring_atoms(is)
this_atom = ring_atom_ids(i, is)
! Count the number of rings this_atom belongs to
atom_ring_count = 0
! Loop over all angles
DO j = 1, angle_part_list(this_atom, is)%nangles
IF (angle_part_list(this_atom, is)%position(j) == 2 ) THEN
! this_atom is at the apex
angle_id = angle_part_list(this_atom, is)%which_angle(j)
! check if other atoms in the angle are ring atoms
atom1 = angle_list(angle_id, is)%atom1
atom2 = angle_list(angle_id, is)%atom3
IF (nonbond_list(atom1, is)%ring_atom .AND. nonbond_list(atom2, is)%ring_atom) THEN
! If yes, increment counter
atom_ring_count = atom_ring_count + 1
ENDIF
ENDIF
ENDDO
IF (atom_ring_count > 1) THEN
nonbond_list(this_atom, is)%multiring_atom = .TRUE.
nmultiring_atoms = nmultiring_atoms + 1
ENDIF
ENDDO
! Check that at least 1 atom can be used for a flip move
IF (nmultiring_atoms > 0) THEN
WRITE(*,*) "Found", nmultiring_atoms, "multiring atoms"
ENDIF
IF (nmultiring_atoms == nring_atoms(is)) THEN
err_msg = ''
err_msg(1) = 'All ring atoms belong to multiple rings.'
err_msg(2) = 'No flip moves can be performed'
CALL Clean_Abort(err_msg,'ID_Multiring_Atoms')
ENDIF

END SUBROUTINE ID_Multiring_Atoms
!*******************************************************************************
2 changes: 1 addition & 1 deletion Src/type_definitions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ MODULE Type_Definitions
REAL(DP) :: mass, charge
INTEGER :: atom_type_number

LOGICAL :: ring_atom
LOGICAL :: ring_atom, multiring_atom

END TYPE Nonbond_Class
!****************************************************************************
Expand Down

0 comments on commit 22441fa

Please sign in to comment.