Skip to content

Commit d9f49d7

Browse files
otsukaytldahlgren
andauthored
add recipe for improved-rdock (spack#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 4877877. * 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 <[email protected]> Co-authored-by: Yuichi Otsuka <[email protected]> Co-authored-by: Tamara Dahlgren <[email protected]>
1 parent ccb5432 commit d9f49d7

File tree

10 files changed

+576
-0
lines changed

10 files changed

+576
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
2+
# Spack Project Developers. See the top-level COPYRIGHT file for details.
3+
#
4+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
6+
7+
from spack.package import *
8+
9+
10+
class ImprovedRdock(MakefilePackage):
11+
"""Improved version of rDock.
12+
rDock is a fast and versatile Open Source docking program
13+
that can be used to dock small molecules against proteins and
14+
nucleic acids.
15+
The original version is found at the following URL:
16+
https://sourceforge.net/projects/rdock/files/rDock_2013.1_src.tar.gz
17+
"""
18+
19+
homepage = "https://github.com/clinfo/improved_rDock"
20+
git = "https://github.com/clinfo/improved_rDock.git"
21+
22+
version('main', branch='main')
23+
24+
depends_on('popt')
25+
depends_on('cppunit')
26+
depends_on('openbabel @3.0.0: +python', type='run')
27+
depends_on('py-numpy', type='run')
28+
depends_on('mpi')
29+
30+
patch('rdock_ld.patch')
31+
patch('rdock_python3.patch', when='^python@3:')
32+
patch('rdock_newcxx.patch')
33+
patch('rdock_useint.patch')
34+
patch('rdock_erase.patch')
35+
patch('rdock_loop.patch', when='target=aarch64:')
36+
patch('rdock_const.patch', when='%fj')
37+
patch('rdock_const2.patch', when='%fj')
38+
39+
def edit(self, spec, prefix):
40+
# compiler path
41+
tm = FileFilter(join_path('build', 'tmakelib', 'linux-g++-64',
42+
'tmake.conf'))
43+
tm.filter('/usr/bin/gcc', spack_cc)
44+
tm.filter('mpicxx', self.spec['mpi'].mpicxx)
45+
# compiler option
46+
if self.spec.target.family == 'aarch64':
47+
tm.filter('-m64', '')
48+
if not self.spec.satisfies('%gcc'):
49+
tm.filter('-pipe', '')
50+
51+
def build(self, spec, prefix):
52+
with working_dir("build"):
53+
make('linux-g++-64')
54+
55+
def install(self, spec, prefix):
56+
for shfile in find('bin', '*'):
57+
set_executable(shfile)
58+
install_tree('.', prefix)
59+
60+
def setup_run_environment(self, env):
61+
env.set('RBT_ROOT', self.prefix)
62+
63+
def test(self):
64+
copy(join_path(self.prefix.example, '1sj0', '*'), '.')
65+
opts = ['-r', '1sj0_rdock.prm', '-was']
66+
self.run_test('rbcavity', options=opts)
67+
68+
mpiexe = self.spec['mpi'].prefix.bin.mpirun
69+
opts = [self.prefix.bin.rbdock, '-r', '1sj0_rdock.prm',
70+
'-p', 'dock.prm', '-n', '100', '-i', '1sj0_ligand.sd',
71+
'-o', '1sj0_docking_out', '-s', '1']
72+
self.run_test(str(mpiexe), options=opts)
73+
74+
opts = [join_path(self.test_suite.current_test_data_dir, 'test.sh')]
75+
self.run_test('bash', options=opts)
76+
77+
pythonexe = self.spec['python'].command.path
78+
opts = [self.spec.prefix.bin.sdrmsd,
79+
'1sj0_ligand.sd', '1sj0_docking_out_sorted.sd']
80+
expected = ['1\t0.55', '100\t7.91']
81+
self.run_test(pythonexe, options=opts, expected=expected)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff -u -r -N e/src/lib/RbtToken.cxx f/src/lib/RbtToken.cxx
2+
--- e/src/lib/RbtToken.cxx 2020-10-14 13:45:40.000000000 +0900
3+
+++ f/src/lib/RbtToken.cxx 2020-10-14 13:46:34.000000000 +0900
4+
@@ -15,7 +15,7 @@
5+
#include "RbtDebug.h"
6+
7+
RbtString RbtToken::_CT("RbtToken");
8+
-
9+
+const RbtVble& _ff = RbtVble();
10+
///////////////////
11+
// Constructors
12+
///////////////////
13+
@@ -24,7 +24,7 @@
14+
_RBTOBJECTCOUNTER_CONSTR_(_CT);
15+
}
16+
17+
-RbtToken::RbtToken(RbtCommands c) : isvble(false), comm(c), vble(RbtVble())
18+
+RbtToken::RbtToken(RbtCommands c) : isvble(false), comm(c), vble(_ff)
19+
{
20+
_RBTOBJECTCOUNTER_CONSTR_(_CT);
21+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/src/exe/rbdock.cxx 2021-02-04 13:32:41.561458052 +0900
2+
+++ b/src/exe/rbdock.cxx 2021-02-04 13:33:07.033202240 +0900
3+
@@ -465,7 +465,7 @@
4+
5+
#ifdef _VISUAL_STUDIO
6+
#else
7+
- optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
8+
+ optCon = poptGetContext(NULL, argc, (const char **) argv, optionsTable, 0);
9+
poptSetOtherOptionHelp(optCon, "-r<receptor.prm> -p<protocol.prm> -i<infile> -o<outfile> [options]");
10+
#endif
11+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff -u -r -N a/src/lib/RbtBaseMolecularFileSource.cxx b/src/lib/RbtBaseMolecularFileSource.cxx
2+
--- a/src/lib/RbtBaseMolecularFileSource.cxx 2018-03-28 16:38:36.000000000 +0900
3+
+++ b/src/lib/RbtBaseMolecularFileSource.cxx 2021-02-01 20:20:04.688973560 +0900
4+
@@ -420,7 +420,7 @@
5+
#ifdef _VISUAL_STUDIO
6+
but_iterator = std::remove(atList.begin(), atList.end(), _MANDATORY);
7+
#else
8+
- std::remove(atList.begin(), atList.end(), _MANDATORY);
9+
+ atList.erase(std::remove(atList.begin(), atList.end(), _MANDATORY), atList.end());
10+
#endif
11+
12+
}
13+
@@ -440,7 +440,7 @@
14+
#ifdef _VISUAL_STUDIO
15+
but_iterator = std::remove(atList.begin(), atList.end(), _FORBIDDEN);
16+
#else
17+
- std::remove(atList.begin(), atList.end(), _FORBIDDEN);
18+
+ atList.erase(std::remove(atList.begin(), atList.end(), _FORBIDDEN), atList.end());
19+
#endif
20+
21+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/build/makefile 2021-02-04 15:24:38.488425167 +0900
2+
+++ b/build/makefile 2021-02-04 15:25:26.053775490 +0900
3+
@@ -61,7 +61,7 @@
4+
# Environment for running rDock unit tests
5+
export RBT_ROOT = ../
6+
export RBT_HOME = ./test/RBT_HOME
7+
-export LD_LIBRARY_PATH = ../lib
8+
+export LD_LIBRARY_PATH = $(shell echo $$LD_LIBRARY_PATH):../lib
9+
10+
##################################################
11+
# Main rDock build targets
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff -u -r -N d/src/lib/RbtBaseMolecularFileSource.cxx y/src/lib/RbtBaseMolecularFileSource.cxx
2+
--- d/src/lib/RbtBaseMolecularFileSource.cxx 2020-10-19 09:50:06.000000000 +0900
3+
+++ y/src/lib/RbtBaseMolecularFileSource.cxx 2020-10-19 09:35:16.000000000 +0900
4+
@@ -260,7 +260,8 @@
5+
const RbtBondMap& bondMap = spAtom->GetBondMap();
6+
7+
//First remove all bonds from the atom
8+
- for (RbtBondMapConstIter mapIter = bondMap.begin(); mapIter != bondMap.end(); mapIter++) {
9+
+ RbtBondMapConstIter mapIter = bondMap.begin();
10+
+ for (int i = 0; i < spAtom->GetNumBonds(); i++, mapIter++) {
11+
RbtBondListIter bIter = Rbt::FindBond(m_bondList,Rbt::isBond_eq((*mapIter).first));
12+
if (bIter != m_bondList.end()) {
13+
#ifdef _DEBUG
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
diff -u -r -N a/build/test/OccupancyTest.h b/build/test/OccupancyTest.h
2+
--- a/build/test/OccupancyTest.h 2017-02-17 17:29:25.000000000 +0900
3+
+++ b/build/test/OccupancyTest.h 2021-02-01 19:23:53.921991677 +0900
4+
@@ -32,7 +32,11 @@
5+
CPPUNIT_TEST_SUITE_END();
6+
7+
public:
8+
+#if __cplusplus < 201103L
9+
static const RbtDouble TINY = 1E-4;
10+
+#else
11+
+ static constexpr RbtDouble TINY = 1E-4;
12+
+#endif
13+
//TextFixture methods
14+
void setUp();
15+
void tearDown();
16+
diff -u -r -N a/build/test/RbtChromTest.h b/build/test/RbtChromTest.h
17+
--- a/build/test/RbtChromTest.h 2017-02-17 17:29:25.000000000 +0900
18+
+++ b/build/test/RbtChromTest.h 2021-02-01 19:23:53.921991677 +0900
19+
@@ -68,7 +68,11 @@
20+
CPPUNIT_TEST_SUITE_END();
21+
22+
public:
23+
+#if __cplusplus < 201103L
24+
static const RbtDouble TINY = 1E-4;
25+
+#else
26+
+ static constexpr RbtDouble TINY = 1E-4;
27+
+#endif
28+
//TextFixture methods
29+
void setUp();
30+
void tearDown();
31+
diff -u -r -N a/build/test/SearchTest.h b/build/test/SearchTest.h
32+
--- a/build/test/SearchTest.h 2017-02-17 17:29:25.000000000 +0900
33+
+++ b/build/test/SearchTest.h 2021-02-01 19:23:53.921991677 +0900
34+
@@ -33,7 +33,11 @@
35+
CPPUNIT_TEST_SUITE_END();
36+
37+
public:
38+
+#if __cplusplus < 201103L
39+
static const RbtDouble TINY = 1E-4;
40+
+#else
41+
+ static constexpr RbtDouble TINY = 1E-4;
42+
+#endif
43+
//TextFixture methods
44+
void setUp();
45+
void tearDown();
46+
diff -u -r -N a/import/simplex/src/NMSearch.cxx b/import/simplex/src/NMSearch.cxx
47+
--- a/import/simplex/src/NMSearch.cxx 2018-03-28 16:26:43.000000000 +0900
48+
+++ b/import/simplex/src/NMSearch.cxx 2021-02-01 19:24:36.587991448 +0900
49+
@@ -391,7 +391,7 @@
50+
51+
#ifdef _VISUAL_STUDIO
52+
#else
53+
- if (fp == NULL) {
54+
+ if (!fp) {
55+
cerr << "No Input Stream in ReadSimplexFile()!\n";
56+
return; // There's no file handle!!
57+
}
58+
diff -u -r -N a/import/tnt/include/tnt_sparse_matrix_csr.h b/import/tnt/include/tnt_sparse_matrix_csr.h
59+
--- a/import/tnt/include/tnt_sparse_matrix_csr.h 2014-05-05 19:18:06.000000000 +0900
60+
+++ b/import/tnt/include/tnt_sparse_matrix_csr.h 2021-02-01 19:23:53.950991677 +0900
61+
@@ -49,8 +49,8 @@
62+
63+
private:
64+
Array1D<T> val_; // data values (nz_ elements)
65+
- Array1D<int> rowptr_; // row_ptr (dim_[0]+1 elements)
66+
- Array1D<int> colind_; // col_ind (nz_ elements)
67+
+ Array1D<T> rowptr_; // row_ptr (dim_[0]+1 elements)
68+
+ Array1D<T> colind_; // col_ind (nz_ elements)
69+
70+
int dim1_; // number of rows
71+
int dim2_; // number of cols
72+
diff -u -r -N a/include/RbtAromIdxSF.h b/include/RbtAromIdxSF.h
73+
--- a/include/RbtAromIdxSF.h 2016-12-28 17:16:27.000000000 +0900
74+
+++ b/include/RbtAromIdxSF.h 2021-02-01 19:23:53.951991677 +0900
75+
@@ -68,7 +68,7 @@
76+
//Generic scoring function params
77+
struct f1prms {
78+
RbtDouble R0,DRMin,DRMax,slope;
79+
- f1prms::f1prms(RbtDouble R, RbtDouble DMin, RbtDouble DMax)
80+
+ f1prms(RbtDouble R, RbtDouble DMin, RbtDouble DMax)
81+
: R0(R),DRMin(DMin),DRMax(DMax),slope(1.0/(DMax-DMin)) {};
82+
};
83+
84+
diff -u -r -N a/include/RbtContainers.h b/include/RbtContainers.h
85+
--- a/include/RbtContainers.h 2018-03-28 18:25:19.000000000 +0900
86+
+++ b/include/RbtContainers.h 2021-02-01 19:26:10.667990942 +0900
87+
@@ -37,6 +37,7 @@
88+
89+
#ifdef _VISUAL_STUDIO
90+
#else
91+
+#if __cplusplus < 201103L
92+
namespace std
93+
{
94+
template <class InputIterator, class OutputIterator, class Predicate>
95+
@@ -51,6 +52,7 @@
96+
}
97+
}
98+
#endif
99+
+#endif
100+
101+
// Container Typedefs
102+
103+
diff -u -r -N a/include/RbtPolarSF.h b/include/RbtPolarSF.h
104+
--- a/include/RbtPolarSF.h 2016-12-28 17:16:27.000000000 +0900
105+
+++ b/include/RbtPolarSF.h 2021-02-01 19:23:53.951991677 +0900
106+
@@ -78,7 +78,7 @@
107+
//Generic scoring function params
108+
struct f1prms {
109+
RbtDouble R0,DRMin,DRMax,slope;
110+
- f1prms::f1prms(RbtDouble R, RbtDouble DMin, RbtDouble DMax)
111+
+ f1prms(RbtDouble R, RbtDouble DMin, RbtDouble DMax)
112+
: R0(R),DRMin(DMin),DRMax(DMax),slope(1.0/(DMax-DMin)) {};
113+
};
114+

0 commit comments

Comments
 (0)