summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotsukay <otsukay@gmail.com>2022-07-07 01:25:45 +0900
committerGitHub <noreply@github.com>2022-07-06 09:25:45 -0700
commitd9f49d74158bb9fe89e00fb8a7b279950abe3a80 (patch)
treedfa51590285b492ed9387a4e804328656ed41ef7
parentccb5432177533e00861adebe8a071285c94fe84e (diff)
downloadspack-d9f49d74158bb9fe89e00fb8a7b279950abe3a80.tar.gz
spack-d9f49d74158bb9fe89e00fb8a7b279950abe3a80.tar.bz2
spack-d9f49d74158bb9fe89e00fb8a7b279950abe3a80.tar.xz
spack-d9f49d74158bb9fe89e00fb8a7b279950abe3a80.zip
add recipe for improved-rdock (#31158)
* add recipe for improved-rdock * style: fix format * style: fix format again * Fix location of the directory * Fix copyright * Fix according to the reviewer's comments. * Revert "Fix according to the reviewer's comments." This reverts commit 4877877dafda4566a18a33c6ffef6e681b4da896. * Fix according to the reviewer's comments. * style: fix format * Update var/spack/repos/builtin/packages/improved-rdock/package.py Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> Co-authored-by: Yuichi Otsuka <otsukay@riken.jp> Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/package.py81
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/rdock_const.patch21
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/rdock_const2.patch11
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/rdock_erase.patch21
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/rdock_ld.patch11
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/rdock_loop.patch13
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/rdock_newcxx.patch114
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/rdock_python3.patch276
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/rdock_useint.patch24
-rw-r--r--var/spack/repos/builtin/packages/improved-rdock/test/test.sh4
10 files changed, 576 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/improved-rdock/package.py b/var/spack/repos/builtin/packages/improved-rdock/package.py
new file mode 100644
index 0000000000..a32cd3ed2e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/package.py
@@ -0,0 +1,81 @@
+# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+
+from spack.package import *
+
+
+class ImprovedRdock(MakefilePackage):
+ """Improved version of rDock.
+ rDock is a fast and versatile Open Source docking program
+ that can be used to dock small molecules against proteins and
+ nucleic acids.
+ The original version is found at the following URL:
+ https://sourceforge.net/projects/rdock/files/rDock_2013.1_src.tar.gz
+ """
+
+ homepage = "https://github.com/clinfo/improved_rDock"
+ git = "https://github.com/clinfo/improved_rDock.git"
+
+ version('main', branch='main')
+
+ depends_on('popt')
+ depends_on('cppunit')
+ depends_on('openbabel @3.0.0: +python', type='run')
+ depends_on('py-numpy', type='run')
+ depends_on('mpi')
+
+ patch('rdock_ld.patch')
+ patch('rdock_python3.patch', when='^python@3:')
+ patch('rdock_newcxx.patch')
+ patch('rdock_useint.patch')
+ patch('rdock_erase.patch')
+ patch('rdock_loop.patch', when='target=aarch64:')
+ patch('rdock_const.patch', when='%fj')
+ patch('rdock_const2.patch', when='%fj')
+
+ def edit(self, spec, prefix):
+ # compiler path
+ tm = FileFilter(join_path('build', 'tmakelib', 'linux-g++-64',
+ 'tmake.conf'))
+ tm.filter('/usr/bin/gcc', spack_cc)
+ tm.filter('mpicxx', self.spec['mpi'].mpicxx)
+ # compiler option
+ if self.spec.target.family == 'aarch64':
+ tm.filter('-m64', '')
+ if not self.spec.satisfies('%gcc'):
+ tm.filter('-pipe', '')
+
+ def build(self, spec, prefix):
+ with working_dir("build"):
+ make('linux-g++-64')
+
+ def install(self, spec, prefix):
+ for shfile in find('bin', '*'):
+ set_executable(shfile)
+ install_tree('.', prefix)
+
+ def setup_run_environment(self, env):
+ env.set('RBT_ROOT', self.prefix)
+
+ def test(self):
+ copy(join_path(self.prefix.example, '1sj0', '*'), '.')
+ opts = ['-r', '1sj0_rdock.prm', '-was']
+ self.run_test('rbcavity', options=opts)
+
+ mpiexe = self.spec['mpi'].prefix.bin.mpirun
+ opts = [self.prefix.bin.rbdock, '-r', '1sj0_rdock.prm',
+ '-p', 'dock.prm', '-n', '100', '-i', '1sj0_ligand.sd',
+ '-o', '1sj0_docking_out', '-s', '1']
+ self.run_test(str(mpiexe), options=opts)
+
+ opts = [join_path(self.test_suite.current_test_data_dir, 'test.sh')]
+ self.run_test('bash', options=opts)
+
+ pythonexe = self.spec['python'].command.path
+ opts = [self.spec.prefix.bin.sdrmsd,
+ '1sj0_ligand.sd', '1sj0_docking_out_sorted.sd']
+ expected = ['1\t0.55', '100\t7.91']
+ self.run_test(pythonexe, options=opts, expected=expected)
diff --git a/var/spack/repos/builtin/packages/improved-rdock/rdock_const.patch b/var/spack/repos/builtin/packages/improved-rdock/rdock_const.patch
new file mode 100644
index 0000000000..4efadae308
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/rdock_const.patch
@@ -0,0 +1,21 @@
+diff -u -r -N e/src/lib/RbtToken.cxx f/src/lib/RbtToken.cxx
+--- e/src/lib/RbtToken.cxx 2020-10-14 13:45:40.000000000 +0900
++++ f/src/lib/RbtToken.cxx 2020-10-14 13:46:34.000000000 +0900
+@@ -15,7 +15,7 @@
+ #include "RbtDebug.h"
+
+ RbtString RbtToken::_CT("RbtToken");
+-
++const RbtVble& _ff = RbtVble();
+ ///////////////////
+ // Constructors
+ ///////////////////
+@@ -24,7 +24,7 @@
+ _RBTOBJECTCOUNTER_CONSTR_(_CT);
+ }
+
+-RbtToken::RbtToken(RbtCommands c) : isvble(false), comm(c), vble(RbtVble())
++RbtToken::RbtToken(RbtCommands c) : isvble(false), comm(c), vble(_ff)
+ {
+ _RBTOBJECTCOUNTER_CONSTR_(_CT);
+ }
diff --git a/var/spack/repos/builtin/packages/improved-rdock/rdock_const2.patch b/var/spack/repos/builtin/packages/improved-rdock/rdock_const2.patch
new file mode 100644
index 0000000000..1866e1e1eb
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/rdock_const2.patch
@@ -0,0 +1,11 @@
+--- a/src/exe/rbdock.cxx 2021-02-04 13:32:41.561458052 +0900
++++ b/src/exe/rbdock.cxx 2021-02-04 13:33:07.033202240 +0900
+@@ -465,7 +465,7 @@
+
+ #ifdef _VISUAL_STUDIO
+ #else
+- optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
++ optCon = poptGetContext(NULL, argc, (const char **) argv, optionsTable, 0);
+ poptSetOtherOptionHelp(optCon, "-r<receptor.prm> -p<protocol.prm> -i<infile> -o<outfile> [options]");
+ #endif
+
diff --git a/var/spack/repos/builtin/packages/improved-rdock/rdock_erase.patch b/var/spack/repos/builtin/packages/improved-rdock/rdock_erase.patch
new file mode 100644
index 0000000000..ce87a0bc32
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/rdock_erase.patch
@@ -0,0 +1,21 @@
+diff -u -r -N a/src/lib/RbtBaseMolecularFileSource.cxx b/src/lib/RbtBaseMolecularFileSource.cxx
+--- a/src/lib/RbtBaseMolecularFileSource.cxx 2018-03-28 16:38:36.000000000 +0900
++++ b/src/lib/RbtBaseMolecularFileSource.cxx 2021-02-01 20:20:04.688973560 +0900
+@@ -420,7 +420,7 @@
+ #ifdef _VISUAL_STUDIO
+ but_iterator = std::remove(atList.begin(), atList.end(), _MANDATORY);
+ #else
+- std::remove(atList.begin(), atList.end(), _MANDATORY);
++ atList.erase(std::remove(atList.begin(), atList.end(), _MANDATORY), atList.end());
+ #endif
+
+ }
+@@ -440,7 +440,7 @@
+ #ifdef _VISUAL_STUDIO
+ but_iterator = std::remove(atList.begin(), atList.end(), _FORBIDDEN);
+ #else
+- std::remove(atList.begin(), atList.end(), _FORBIDDEN);
++ atList.erase(std::remove(atList.begin(), atList.end(), _FORBIDDEN), atList.end());
+ #endif
+
+ }
diff --git a/var/spack/repos/builtin/packages/improved-rdock/rdock_ld.patch b/var/spack/repos/builtin/packages/improved-rdock/rdock_ld.patch
new file mode 100644
index 0000000000..4085034f3e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/rdock_ld.patch
@@ -0,0 +1,11 @@
+--- a/build/makefile 2021-02-04 15:24:38.488425167 +0900
++++ b/build/makefile 2021-02-04 15:25:26.053775490 +0900
+@@ -61,7 +61,7 @@
+ # Environment for running rDock unit tests
+ export RBT_ROOT = ../
+ export RBT_HOME = ./test/RBT_HOME
+-export LD_LIBRARY_PATH = ../lib
++export LD_LIBRARY_PATH = $(shell echo $$LD_LIBRARY_PATH):../lib
+
+ ##################################################
+ # Main rDock build targets
diff --git a/var/spack/repos/builtin/packages/improved-rdock/rdock_loop.patch b/var/spack/repos/builtin/packages/improved-rdock/rdock_loop.patch
new file mode 100644
index 0000000000..c9c5d73600
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/rdock_loop.patch
@@ -0,0 +1,13 @@
+diff -u -r -N d/src/lib/RbtBaseMolecularFileSource.cxx y/src/lib/RbtBaseMolecularFileSource.cxx
+--- d/src/lib/RbtBaseMolecularFileSource.cxx 2020-10-19 09:50:06.000000000 +0900
++++ y/src/lib/RbtBaseMolecularFileSource.cxx 2020-10-19 09:35:16.000000000 +0900
+@@ -260,7 +260,8 @@
+ const RbtBondMap& bondMap = spAtom->GetBondMap();
+
+ //First remove all bonds from the atom
+- for (RbtBondMapConstIter mapIter = bondMap.begin(); mapIter != bondMap.end(); mapIter++) {
++ RbtBondMapConstIter mapIter = bondMap.begin();
++ for (int i = 0; i < spAtom->GetNumBonds(); i++, mapIter++) {
+ RbtBondListIter bIter = Rbt::FindBond(m_bondList,Rbt::isBond_eq((*mapIter).first));
+ if (bIter != m_bondList.end()) {
+ #ifdef _DEBUG
diff --git a/var/spack/repos/builtin/packages/improved-rdock/rdock_newcxx.patch b/var/spack/repos/builtin/packages/improved-rdock/rdock_newcxx.patch
new file mode 100644
index 0000000000..5168d57835
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/rdock_newcxx.patch
@@ -0,0 +1,114 @@
+diff -u -r -N a/build/test/OccupancyTest.h b/build/test/OccupancyTest.h
+--- a/build/test/OccupancyTest.h 2017-02-17 17:29:25.000000000 +0900
++++ b/build/test/OccupancyTest.h 2021-02-01 19:23:53.921991677 +0900
+@@ -32,7 +32,11 @@
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
++#if __cplusplus < 201103L
+ static const RbtDouble TINY = 1E-4;
++#else
++ static constexpr RbtDouble TINY = 1E-4;
++#endif
+ //TextFixture methods
+ void setUp();
+ void tearDown();
+diff -u -r -N a/build/test/RbtChromTest.h b/build/test/RbtChromTest.h
+--- a/build/test/RbtChromTest.h 2017-02-17 17:29:25.000000000 +0900
++++ b/build/test/RbtChromTest.h 2021-02-01 19:23:53.921991677 +0900
+@@ -68,7 +68,11 @@
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
++#if __cplusplus < 201103L
+ static const RbtDouble TINY = 1E-4;
++#else
++ static constexpr RbtDouble TINY = 1E-4;
++#endif
+ //TextFixture methods
+ void setUp();
+ void tearDown();
+diff -u -r -N a/build/test/SearchTest.h b/build/test/SearchTest.h
+--- a/build/test/SearchTest.h 2017-02-17 17:29:25.000000000 +0900
++++ b/build/test/SearchTest.h 2021-02-01 19:23:53.921991677 +0900
+@@ -33,7 +33,11 @@
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
++#if __cplusplus < 201103L
+ static const RbtDouble TINY = 1E-4;
++#else
++ static constexpr RbtDouble TINY = 1E-4;
++#endif
+ //TextFixture methods
+ void setUp();
+ void tearDown();
+diff -u -r -N a/import/simplex/src/NMSearch.cxx b/import/simplex/src/NMSearch.cxx
+--- a/import/simplex/src/NMSearch.cxx 2018-03-28 16:26:43.000000000 +0900
++++ b/import/simplex/src/NMSearch.cxx 2021-02-01 19:24:36.587991448 +0900
+@@ -391,7 +391,7 @@
+
+ #ifdef _VISUAL_STUDIO
+ #else
+- if (fp == NULL) {
++ if (!fp) {
+ cerr << "No Input Stream in ReadSimplexFile()!\n";
+ return; // There's no file handle!!
+ }
+diff -u -r -N a/import/tnt/include/tnt_sparse_matrix_csr.h b/import/tnt/include/tnt_sparse_matrix_csr.h
+--- a/import/tnt/include/tnt_sparse_matrix_csr.h 2014-05-05 19:18:06.000000000 +0900
++++ b/import/tnt/include/tnt_sparse_matrix_csr.h 2021-02-01 19:23:53.950991677 +0900
+@@ -49,8 +49,8 @@
+
+ private:
+ Array1D<T> val_; // data values (nz_ elements)
+- Array1D<int> rowptr_; // row_ptr (dim_[0]+1 elements)
+- Array1D<int> colind_; // col_ind (nz_ elements)
++ Array1D<T> rowptr_; // row_ptr (dim_[0]+1 elements)
++ Array1D<T> colind_; // col_ind (nz_ elements)
+
+ int dim1_; // number of rows
+ int dim2_; // number of cols
+diff -u -r -N a/include/RbtAromIdxSF.h b/include/RbtAromIdxSF.h
+--- a/include/RbtAromIdxSF.h 2016-12-28 17:16:27.000000000 +0900
++++ b/include/RbtAromIdxSF.h 2021-02-01 19:23:53.951991677 +0900
+@@ -68,7 +68,7 @@
+ //Generic scoring function params
+ struct f1prms {
+ RbtDouble R0,DRMin,DRMax,slope;
+- f1prms::f1prms(RbtDouble R, RbtDouble DMin, RbtDouble DMax)
++ f1prms(RbtDouble R, RbtDouble DMin, RbtDouble DMax)
+ : R0(R),DRMin(DMin),DRMax(DMax),slope(1.0/(DMax-DMin)) {};
+ };
+
+diff -u -r -N a/include/RbtContainers.h b/include/RbtContainers.h
+--- a/include/RbtContainers.h 2018-03-28 18:25:19.000000000 +0900
++++ b/include/RbtContainers.h 2021-02-01 19:26:10.667990942 +0900
+@@ -37,6 +37,7 @@
+
+ #ifdef _VISUAL_STUDIO
+ #else
++#if __cplusplus < 201103L
+ namespace std
+ {
+ template <class InputIterator, class OutputIterator, class Predicate>
+@@ -51,6 +52,7 @@
+ }
+ }
+ #endif
++#endif
+
+ // Container Typedefs
+
+diff -u -r -N a/include/RbtPolarSF.h b/include/RbtPolarSF.h
+--- a/include/RbtPolarSF.h 2016-12-28 17:16:27.000000000 +0900
++++ b/include/RbtPolarSF.h 2021-02-01 19:23:53.951991677 +0900
+@@ -78,7 +78,7 @@
+ //Generic scoring function params
+ struct f1prms {
+ RbtDouble R0,DRMin,DRMax,slope;
+- f1prms::f1prms(RbtDouble R, RbtDouble DMin, RbtDouble DMax)
++ f1prms(RbtDouble R, RbtDouble DMin, RbtDouble DMax)
+ : R0(R),DRMin(DMin),DRMax(DMax),slope(1.0/(DMax-DMin)) {};
+ };
+
diff --git a/var/spack/repos/builtin/packages/improved-rdock/rdock_python3.patch b/var/spack/repos/builtin/packages/improved-rdock/rdock_python3.patch
new file mode 100644
index 0000000000..bedcadc5b4
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/rdock_python3.patch
@@ -0,0 +1,276 @@
+diff -u -r -N a/bin/sdrmsd b/bin/sdrmsd
+--- a/bin/sdrmsd 2020-10-15 13:34:27.000000000 +0900
++++ b/bin/sdrmsd 2020-10-19 09:21:43.000000000 +0900
+@@ -11,7 +11,7 @@
+ # Date: 08-11-2013
+
+ import math
+-import pybel
++from openbabel import pybel
+ import numpy as npy
+ import optparse
+
+@@ -103,24 +103,24 @@
+ return mappingpose[0]
+
+ def parseArguments():
+- optparse.OptionParser.format_epilog = lambda self, formatter: self.epilog
+- epilog = """Args:
+- reference.sdf SDF file with the reference molecule.
+- input.sdf SDF file with the molecules to be compared to reference.\n"""
+- parser = optparse.OptionParser("usage: %prog [options] reference.sdf input.sdf", epilog=epilog)
+- parser.add_option("-f", "--fit",dest="fit", action="store_true", default=False,
++ optparse.OptionParser.format_epilog = lambda self, formatter: self.epilog
++ epilog = """Args:
++ reference.sdf SDF file with the reference molecule.
++ input.sdf SDF file with the molecules to be compared to reference.\n"""
++ parser = optparse.OptionParser("usage: %prog [options] reference.sdf input.sdf", epilog=epilog)
++ parser.add_option("-f", "--fit",dest="fit", action="store_true", default=False,
+ help="Superpose molecules before RMSD calculation")
+- parser.add_option("--threshold","-t",dest="threshold", action="store", nargs=1,
++ parser.add_option("--threshold","-t",dest="threshold", action="store", nargs=1,
+ help="Discard poses with RMSD < THRESHOLD with respect previous poses which where not rejected based on same principle. A Population SDField will be added to output SD with the population number.", type=float)
+- parser.add_option("-o","--out", dest="outfilename", metavar="FILE", default=False,
++ parser.add_option("-o","--out", dest="outfilename", metavar="FILE", default=False,
+ help="If declared, write an output SDF file with the input molecules with a new sdfield <RMSD>. If molecule was fitted, the fitted molecule coordinates will be saved.")
+- (options, args) = parser.parse_args()
+-
+- #Check we have two arguments
+- if len(args) < 2:
+- parser.error("Incorrect number of arguments. Use -h or --help options to print help.")
++ (options, args) = parser.parse_args()
++
++ #Check we have two arguments
++ if len(args) < 2:
++ parser.error("Incorrect number of arguments. Use -h or --help options to print help.")
+
+- return options, args
++ return options, args
+
+ def updateCoords(obmol, newcoords):
+ "Update OBMol coordinates. newcoords is a numpy array"
+@@ -133,8 +133,8 @@
+ for correct RMSD comparison. Only the lowest RMSD will be returned.
+
+ Returns:
+- If fit=False: bestRMSD (float) RMSD of the best matching mapping.
+- If fit=True: (bestRMSD, molecCoordinates) (float, npy.array) RMSD of best match and its molecule fitted coordinates.
++ If fit=False: bestRMSD (float) RMSD of the best matching mapping.
++ If fit=True: (bestRMSD, molecCoordinates) (float, npy.array) RMSD of best match and its molecule fitted coordinates.
+ """
+ mappings = pybel.ob.vvpairUIntUInt()
+ bitvec = pybel.ob.OBBitVec()
+@@ -148,18 +148,18 @@
+ posecoords = npy.array([atom.coords for atom in molec])[mappose]
+ resultrmsd = 999999999999
+ for mapping in mappings:
+- automorph_coords = [None] * len(targetcoords)
+- for x, y in mapping:
+- automorph_coords[lookup.index(x)] = targetcoords[lookup.index(y)]
+- mapping_rmsd = rmsd(posecoords, automorph_coords)
+- if mapping_rmsd < resultrmsd:
+- resultrmsd = mapping_rmsd
+- fitted_result = False
+- if fit:
+- fitted_pose, fitted_rmsd = superpose3D(npy.array(automorph_coords), npy.array(posecoords))
+- if fitted_rmsd < resultrmsd:
+- resultrmsd = fitted_rmsd
+- fitted_result = fitted_pose
++ automorph_coords = [None] * len(targetcoords)
++ for x, y in mapping:
++ automorph_coords[lookup.index(x)] = targetcoords[lookup.index(y)]
++ mapping_rmsd = rmsd(posecoords, automorph_coords)
++ if mapping_rmsd < resultrmsd:
++ resultrmsd = mapping_rmsd
++ fitted_result = False
++ if fit:
++ fitted_pose, fitted_rmsd = superpose3D(npy.array(automorph_coords), npy.array(posecoords))
++ if fitted_rmsd < resultrmsd:
++ resultrmsd = fitted_rmsd
++ fitted_result = fitted_pose
+
+ if fit:
+ return (resultrmsd, fitted_pose)
+@@ -167,16 +167,16 @@
+ return resultrmsd
+
+ def saveMolecWithRMSD(outsdf, molec, rmsd, population=False):
+- newData = pybel.ob.OBPairData()
++ newData = pybel.ob.OBPairData()
+ newData.SetAttribute("RMSD")
+ newData.SetValue('%.3f'%rmsd)
+
+ if population:
+- popData = pybel.ob.OBPairData()
+- popData.SetAttribute("Population")
+- popData.SetValue('%i'%population)
+- molec.OBMol.CloneData(popData)
+-
++ popData = pybel.ob.OBPairData()
++ popData.SetAttribute("Population")
++ popData.SetValue('%i'%population)
++ molec.OBMol.CloneData(popData)
++
+ molec.OBMol.CloneData(newData) # Add new data
+ outsdf.write(molec)
+
+@@ -184,13 +184,13 @@
+ import sys, os
+
+ (opts, args) = parseArguments()
+-
++
+ xtal = args[0]
+ poses = args[1]
+
+ if not os.path.exists(xtal) or not os.path.exists(poses):
+- sys.exit("Input files not found. Please check the path given is correct.")
+-
++ sys.exit("Input files not found. Please check the path given is correct.")
++
+ fit = opts.fit
+ outfname = opts.outfilename
+ threshold = opts.threshold
+@@ -202,71 +202,71 @@
+
+ #If outfname is defined, prepare an output SDF sink to write molecules
+ if outfname:
+- outsdf = pybel.Outputfile('sdf', outfname, overwrite=True)
++ outsdf = pybel.Outputfile('sdf', outfname, overwrite=True)
+
+ # Find the RMSD between the crystal pose and each docked pose
+ dockedposes = pybel.readfile("sdf", poses)
+- if fit: print "POSE\tRMSD_FIT"
+- else: print "POSE\tRMSD_NOFIT"
++ if fit: print ("POSE\tRMSD_FIT")
++ else: print ("POSE\tRMSD_NOFIT")
+ skipped = []
+- moleclist = {} # Save all poses with their dockid
+- population = {} # Poses to be written
++ moleclist = {} # Save all poses with their dockid
++ population = {} # Poses to be written
+ outlist = {}
+ for docki, dockedpose in enumerate(dockedposes):
+ dockedpose.removeh()
+- natoms = len(dockedpose.atoms)
+- if natoms != crystalnumatoms:
+- skipped.append(docki+1)
+- continue
+- if fit:
+- resultrmsd, fitted_result = getAutomorphRMSD(crystal, dockedpose, fit=True)
+- updateCoords(dockedpose, fitted_result)
+- else:
+- resultrmsd = getAutomorphRMSD(crystal, dockedpose, fit=False)
+-
+- if threshold:
+- # Calculate RMSD between all previous poses
+- # Discard if rmsd < FILTER threshold
+- if moleclist:
+- match = None
+- bestmatchrmsd = 999999
+- for did,prevmol in moleclist.iteritems():
+- tmprmsd = getAutomorphRMSD(prevmol, dockedpose)
+- if tmprmsd < threshold:
+- if tmprmsd < bestmatchrmsd:
+- bestmatchrmsd = tmprmsd
+- match = did
+-
+- if match != None:
+- # Do not write this one
+- # sum one up to the matching previous molecule id
+- print >> sys.stderr, "Pose %i matches pose %i with %.3f RMSD"%(docki+1, match+1, bestmatchrmsd)
+- population[match] += 1
+- else:
+- # There's no match. Print info for this one and write to outsdf if needed
+- # Save this one!
+- if outfname: outlist[docki] = (dockedpose, resultrmsd)
+- print "%d\t%.2f"%((docki+1),resultrmsd)
+- moleclist[docki] = dockedpose
+- population[docki] = 1
+- else:
+- # First molecule in list. Append for sure
+- moleclist[docki] = dockedpose
+- population[docki] = 1
+- if outfname: outlist[docki] = (dockedpose, resultrmsd)
+- else:
+- # Just write best rmsd found and the molecule to outsdf if demanded
+- if outfname: saveMolecWithRMSD(outsdf, dockedpose, resultrmsd)
+- print "%d\t%.2f"%((docki+1),resultrmsd)
++ natoms = len(dockedpose.atoms)
++ if natoms != crystalnumatoms:
++ skipped.append(docki+1)
++ continue
++ if fit:
++ resultrmsd, fitted_result = getAutomorphRMSD(crystal, dockedpose, fit=True)
++ updateCoords(dockedpose, fitted_result)
++ else:
++ resultrmsd = getAutomorphRMSD(crystal, dockedpose, fit=False)
++
++ if threshold:
++ # Calculate RMSD between all previous poses
++ # Discard if rmsd < FILTER threshold
++ if moleclist:
++ match = None
++ bestmatchrmsd = 999999
++ for did,prevmol in moleclist.iteritems():
++ tmprmsd = getAutomorphRMSD(prevmol, dockedpose)
++ if tmprmsd < threshold:
++ if tmprmsd < bestmatchrmsd:
++ bestmatchrmsd = tmprmsd
++ match = did
++
++ if match != None:
++ # Do not write this one
++ # sum one up to the matching previous molecule id
++ print >> sys.stderr, "Pose %i matches pose %i with %.3f RMSD"%(docki+1, match+1, bestmatchrmsd)
++ population[match] += 1
++ else:
++ # There's no match. Print info for this one and write to outsdf if needed
++ # Save this one!
++ if outfname: outlist[docki] = (dockedpose, resultrmsd)
++ print ("%d\t%.2f"%((docki+1),resultrmsd))
++ moleclist[docki] = dockedpose
++ population[docki] = 1
++ else:
++ # First molecule in list. Append for sure
++ moleclist[docki] = dockedpose
++ population[docki] = 1
++ if outfname: outlist[docki] = (dockedpose, resultrmsd)
++ else:
++ # Just write best rmsd found and the molecule to outsdf if demanded
++ if outfname: saveMolecWithRMSD(outsdf, dockedpose, resultrmsd)
++ print ("%d\t%.2f"%((docki+1),resultrmsd))
+
+ if outlist:
+- # Threshold applied and outlist need to be written
+- for docki in sorted(outlist.iterkeys()):
+- molrmsd = outlist[docki]
+- # Get number of matchs in thresholding operation
+- pop = population.get(docki)
+- if not pop: pop = 1
+- # Save molecule
+- saveMolecWithRMSD(outsdf, molrmsd[0], molrmsd[1], pop)
+-
+- if skipped: print >> sys.stderr, "SKIPPED input molecules due to number of atom missmatch: %s"%skipped
++ # Threshold applied and outlist need to be written
++ for docki in sorted(outlist.iterkeys()):
++ molrmsd = outlist[docki]
++ # Get number of matchs in thresholding operation
++ pop = population.get(docki)
++ if not pop: pop = 1
++ # Save molecule
++ saveMolecWithRMSD(outsdf, molrmsd[0], molrmsd[1], pop)
++
++ if skipped: print("SKIPPED input molecules due to number of atom missmatch: %s"%skipped, file=sys.stderr)
+diff -u -r -N a/build/test/RBT_HOME/check_test.py b/build/test/RBT_HOME/check_test.py
+--- a/build/test/RBT_HOME/check_test.py 2020-10-14 11:48:36.000000000 +0900
++++ b/build/test/RBT_HOME/check_test.py 2020-10-19 09:23:31.000000000 +0900
+@@ -21,6 +21,6 @@
+ error = 1
+
+ if error == 1:
+- print "The test failed, please check the compilation is OK and no errors were raised."
++ print ("The test failed, please check the compilation is OK and no errors were raised.")
+ else:
+- print "The test succeeded! The results agree with the reference ones.\nHave fun using rDock!!"
++ print ("The test succeeded! The results agree with the reference ones.\nHave fun using rDock!!")
diff --git a/var/spack/repos/builtin/packages/improved-rdock/rdock_useint.patch b/var/spack/repos/builtin/packages/improved-rdock/rdock_useint.patch
new file mode 100644
index 0000000000..f0be2fa2cc
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/rdock_useint.patch
@@ -0,0 +1,24 @@
+diff -u -r -N a/src/exe/rbcavity.cxx b/src/exe/rbcavity.cxx
+--- a/src/exe/rbcavity.cxx 2016-12-28 17:16:27.000000000 +0900
++++ b/src/exe/rbcavity.cxx 2021-02-01 20:14:47.508975264 +0900
+@@ -50,7 +50,7 @@
+
+ int main(int argc,const char* argv[])
+ {
+- char c; // for argument parsing
++ int c; // for argument parsing
+ poptContext optCon; // ditto
+ char *prmFile=NULL; // will be strReceptorPrmFile
+ char *listDist=NULL; // will be 'dist'
+diff -u -r -N a/src/exe/rbdock.cxx b/src/exe/rbdock.cxx
+--- a/src/exe/rbdock.cxx 2018-04-06 20:14:32.000000000 +0900
++++ b/src/exe/rbdock.cxx 2021-02-01 20:17:20.359974443 +0900
+@@ -401,7 +401,7 @@
+ RbtInt iTrace(0);//Trace level, for debugging
+
+ // variables for popt command-line parsing
+- char c; // for argument parsing
++ int c; // for argument parsing
+
+ #ifdef _VISUAL_STUDIO
+ #else
diff --git a/var/spack/repos/builtin/packages/improved-rdock/test/test.sh b/var/spack/repos/builtin/packages/improved-rdock/test/test.sh
new file mode 100644
index 0000000000..f59cb334bb
--- /dev/null
+++ b/var/spack/repos/builtin/packages/improved-rdock/test/test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+#sdsort for sorting the results according to their score
+sdsort -n -f'SCORE' 1sj0_docking_out.sd > 1sj0_docking_out_sorted.sd
+cat 1sj0_docking_out_sorted.sd