Skip to content

Commit

Permalink
Allow to create PDB specific filters
Browse files Browse the repository at this point in the history
  • Loading branch information
awvwgk committed Nov 19, 2020
1 parent bd8faae commit 75a047e
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 11 deletions.
18 changes: 14 additions & 4 deletions app/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ program rmsd_main
call get_value(opts, "help", show_help, size(args) <= 1 .and. .not.show_rc)
call opts%destroy

if (show_help) then
call help(output_unit)
if (show_version) then
call version(output_unit)
stop
end if

if (show_version) then
call version(output_unit)
if (show_help) then
call help(output_unit)
if (size(args) <= 1) error stop
stop
end if

Expand Down Expand Up @@ -212,6 +213,15 @@ subroutine help(unit)
"", &
"Note that this approach will still consider deuterium labeled as D,", &
"which would be excluded as well when using the atomic number instead.", &
"", &
"To create a PDB specific filter use the four character PDB identifier", &
"of the atoms and enable the PDB functionality.", &
"To match only the proteine backbone use", &
"", &
" c-alpha.include = ["" CA "", "" N "", "" C "", "" O ""]", &
" c-alpha.pdb = true", &
"", &
"Atomic numbers and element symbols can be included here as well.", &
""

end subroutine help
Expand Down
2 changes: 1 addition & 1 deletion fpm.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "mctc-rmsd"
version = "0.1.0"
version = "0.1.1"
license = "LGPL-3.0-or-later"

[dependencies]
Expand Down
9 changes: 9 additions & 0 deletions man/mctc-rmsd.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,12 @@ excluding hydrogen with standard symbols, use:

Note that this approach will still consider deuterium labeled as D,
which would be excluded as well when using the atomic number instead.

To create a PDB specific filter use the four character PDB identifier
of the atoms and enable the PDB functionality.
To match only the proteine backbone use

backbone.include = [" CA ", " N ", " C ", " O "]
backbone.pdb = true

Atomic numbers and element symbols can be included here as well.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
project(
'mctc-rmsd',
'fortran',
version: '0.1.0',
version: '0.1.1',
license: 'LGPL-3.0-or-later',
meson_version: '>=0.53',
default_options: [
Expand Down
26 changes: 23 additions & 3 deletions src/rmsd/filter.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ module rmsd_filter
!> Whether the filter contains an allow or a deny list
logical :: allow

!> Use PDB identifiers for filtering
logical :: pdb

contains

!> Create mask from filter and structure
Expand Down Expand Up @@ -112,10 +115,11 @@ subroutine new_rmsd_filter_tbl(self, table, error)
character(symbol_length), allocatable :: sym(:)
character(len=:), allocatable :: name, cval
integer :: ndim, inum, isym, ival, i, stat
logical :: allow
logical :: allow, pdb

call table%get_key(name)

call get_value(table, "pdb", pdb, .false.)
call get_value(table, "include", array, requested=.false.)
allow = associated(array)
if (.not.allow) then
Expand Down Expand Up @@ -159,13 +163,13 @@ subroutine new_rmsd_filter_tbl(self, table, error)
if (allocated(error)) return

call new_rmsd_filter(self, name=name, num=num(:inum), sym=sym(:isym), &
& allow=allow)
& allow=allow, pdb=pdb)

end subroutine new_rmsd_filter_tbl


!> Create a new RMSD filter from parts
subroutine new_rmsd_filter_one(self, name, num, sym, allow)
subroutine new_rmsd_filter_one(self, name, num, sym, allow, pdb)

!> Instance of species filter
type(rmsd_filter_type), intent(out) :: self
Expand All @@ -176,6 +180,9 @@ subroutine new_rmsd_filter_one(self, name, num, sym, allow)
!> Whether the filter contains an allow or a deny list
logical, intent(in) :: allow

!> Filter is specific for PDB identifiers
logical, intent(in) :: pdb

!> Atomic number
integer, intent(in) :: num(:)

Expand All @@ -186,6 +193,7 @@ subroutine new_rmsd_filter_one(self, name, num, sym, allow)
self%sym = sym
self%num = num
self%allow = allow
self%pdb = pdb

end subroutine new_rmsd_filter_one

Expand Down Expand Up @@ -224,6 +232,18 @@ subroutine get_mask(self, mol, mask)
izp = mol%id(iat)
mask(iat) = tmp(izp)
end do

if (self%pdb .and. allocated(mol%pdb)) then
if (self%allow) then
do iat = 1, mol%nat
mask(iat) = mask(iat) .or. any(mol%pdb(iat)%name == self%sym)
end do
else
do iat = 1, mol%nat
mask(iat) = mask(iat) .and. all(mol%pdb(iat)%name /= self%sym)
end do
end if
end if

end subroutine get_mask

Expand Down
4 changes: 2 additions & 2 deletions src/rmsd/version.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ module rmsd_version


!> String representation of the mctc-rmsd version
character(len=*), parameter :: rmsd_version_string = "0.1.0"
character(len=*), parameter :: rmsd_version_string = "0.1.1"

!> Numeric representation of the mctc-rmsd version
integer, parameter :: rmsd_version_compact(3) = [0, 1, 0]
integer, parameter :: rmsd_version_compact(3) = [0, 1, 1]


contains
Expand Down

0 comments on commit 75a047e

Please sign in to comment.