diff --git a/CHANGELOG b/CHANGELOG index 29954ad..eee0468 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -26,3 +26,7 @@ - modify setup.py to compile lbfgsb.f directly - added chrg_scorpion_wrap.cpp to interface with chrg_scorpion.f - shortened test for reduce scorpion --cgopt + +25-26 July 2017 CHR +- renamed 69 method names (.py, .pyx, .cpp, .h) to lowercase with underscores, except Print. +- Complete list in NAMES_TXN diff --git a/INSTALL.rst b/INSTALL.rst index 483fbc2..24f3831 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -11,7 +11,7 @@ Quick setup guide This is the very minimal set of instructions required to install Ptools in a Python virtual environment. -It assumes all Ptools dependencies have been duly installed:: +It assumes python 2.7 and all Ptools dependencies have been duly installed:: $ virtualenv ptools-env $ source ptools-env/bin/activate @@ -29,6 +29,7 @@ Building and installing Ptools The Ptools library has few dependencies namely : +- python 2.7.xx - a C++ compiler (e.g. the `GNU Compiler`_), - a developers version of the Python_ interpreter, - the Boost_ library, @@ -185,4 +186,4 @@ location as described in `f2c.h: No such file or directory`_. .. _GNU Compiler: http://gcc.gnu.org/ .. _Python: http://www.python.org/ .. _Git: http://git-scm.com/ -.. _pip: https://pypi.python.org/pypi/pip \ No newline at end of file +.. _pip: https://pypi.python.org/pypi/pip diff --git a/Makefile b/Makefile index ac2a62f..2fec621 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ clean-build: rm -fr dist/ rm -fr .eggs/ rm -f bindings/_ptools.cpp - rm -f bindings/_cgopt.c + rm -f bindings/_cgopt.cpp rm -f $(MANIFEST_OUT) rm -f headers/gitrev.h find . -name '*.egg-info' -exec rm -fr {} + @@ -84,6 +84,11 @@ build: clean install: python setup.py install --record $(MANIFEST_OUT) +undo: + git checkout -- "*.py" "*.pyx" "*.cpp" "*.h" + +rename: + python names.py rename NAMES_TXN uninstall: cat $(MANIFEST_OUT) | xargs rm -f diff --git a/Tests/__init__.py b/Tests/__init__.py index 32ca961..cfc3ef2 100644 --- a/Tests/__init__.py +++ b/Tests/__init__.py @@ -58,7 +58,7 @@ # --------------------------------------------------------------------------- # -# Reduce test files +# reduce test files # # --------------------------------------------------------------------------- TEST_REDUCE_DATA_DIR = os.path.join(TEST_DATA_DIR, 'reduce') @@ -95,7 +95,7 @@ # --------------------------------------------------------------------------- # -# Translate test files +# translate test files # # --------------------------------------------------------------------------- diff --git a/Tests/cpp/cxxtest/ErrorFormatter.h b/Tests/cpp/cxxtest/ErrorFormatter.h index 968c310..cfc0713 100644 --- a/Tests/cpp/cxxtest/ErrorFormatter.h +++ b/Tests/cpp/cxxtest/ErrorFormatter.h @@ -252,15 +252,15 @@ namespace CxxTest void dumpBuffer( const void *buffer, unsigned size ) { - unsigned dumpSize = size; - if ( maxDumpSize() && dumpSize > maxDumpSize() ) - dumpSize = maxDumpSize(); + unsigned dumpsize = size; + if ( maxDumpsize() && dumpsize > maxDumpsize() ) + dumpsize = maxDumpsize(); const unsigned char *p = (const unsigned char *)buffer; (*_o) << " { "; - for ( unsigned i = 0; i < dumpSize; ++ i ) + for ( unsigned i = 0; i < dumpsize; ++ i ) (*_o) << byteToHex( *p++ ) << " "; - if ( dumpSize < size ) + if ( dumpsize < size ) (*_o) << "... "; (*_o) << "}" << endl; } diff --git a/Tests/cpp/cxxtest/TestRunner.h b/Tests/cpp/cxxtest/TestRunner.h index 43f0832..7bd2819 100644 --- a/Tests/cpp/cxxtest/TestRunner.h +++ b/Tests/cpp/cxxtest/TestRunner.h @@ -82,7 +82,7 @@ namespace CxxTest #ifdef _CXXTEST_HAVE_EH bool _abortTestOnFail; #endif // _CXXTEST_HAVE_EH - unsigned _maxDumpSize; + unsigned _maxDumpsize; public: StateGuard() @@ -90,7 +90,7 @@ namespace CxxTest #ifdef _CXXTEST_HAVE_EH _abortTestOnFail = abortTestOnFail(); #endif // _CXXTEST_HAVE_EH - _maxDumpSize = maxDumpSize(); + _maxDumpsize = maxDumpsize(); } ~StateGuard() @@ -98,7 +98,7 @@ namespace CxxTest #ifdef _CXXTEST_HAVE_EH setAbortTestOnFail( _abortTestOnFail ); #endif // _CXXTEST_HAVE_EH - setMaxDumpSize( _maxDumpSize ); + setMaxDumpsize( _maxDumpsize ); } }; @@ -110,7 +110,7 @@ namespace CxxTest #ifdef _CXXTEST_HAVE_EH setAbortTestOnFail( CXXTEST_DEFAULT_ABORT ); #endif // _CXXTEST_HAVE_EH - setMaxDumpSize( CXXTEST_MAX_DUMP_SIZE ); + setMaxDumpsize( CXXTEST_MAX_DUMP_SIZE ); } }; }; diff --git a/Tests/cpp/cxxtest/TestSuite.cpp b/Tests/cpp/cxxtest/TestSuite.cpp index bc14c2c..ac04f9c 100644 --- a/Tests/cpp/cxxtest/TestSuite.cpp +++ b/Tests/cpp/cxxtest/TestSuite.cpp @@ -38,16 +38,16 @@ namespace CxxTest // // Max dump size // - static unsigned currentMaxDumpSize = CXXTEST_MAX_DUMP_SIZE; + static unsigned currentMaxDumpsize = CXXTEST_MAX_DUMP_SIZE; - unsigned maxDumpSize() + unsigned maxDumpsize() { - return currentMaxDumpSize; + return currentMaxDumpsize; } - void setMaxDumpSize( unsigned value ) + void setMaxDumpsize( unsigned value ) { - currentMaxDumpSize = value; + currentMaxDumpsize = value; } // diff --git a/Tests/cpp/cxxtest/TestSuite.h b/Tests/cpp/cxxtest/TestSuite.h index fc5a206..137f5df 100644 --- a/Tests/cpp/cxxtest/TestSuite.h +++ b/Tests/cpp/cxxtest/TestSuite.h @@ -33,8 +33,8 @@ namespace CxxTest bool abortTestOnFail(); void setAbortTestOnFail( bool value = CXXTEST_DEFAULT_ABORT ); - unsigned maxDumpSize(); - void setMaxDumpSize( unsigned value = CXXTEST_MAX_DUMP_SIZE ); + unsigned maxDumpsize(); + void setMaxDumpsize( unsigned value = CXXTEST_MAX_DUMP_SIZE ); void doTrace( const char *file, unsigned line, const char *message ); void doWarn( const char *file, unsigned line, const char *message ); diff --git a/Tests/cpp/cxxtest/Win32Gui.h b/Tests/cpp/cxxtest/Win32Gui.h index 6b3e758..898750a 100644 --- a/Tests/cpp/cxxtest/Win32Gui.h +++ b/Tests/cpp/cxxtest/Win32Gui.h @@ -161,7 +161,7 @@ namespace CxxTest void registerWindowClass() { - _windowClass.cbSize = sizeof(_windowClass); + _windowClass.cbsize = sizeof(_windowClass); _windowClass.style = CS_HREDRAW | CS_VREDRAW; _windowClass.lpfnWndProc = &(Win32Gui::windowProcedure); _windowClass.cbClsExtra = 0; @@ -189,7 +189,7 @@ namespace CxxTest return; typedef void (WINAPI *FUNC)( void ); - FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" ); + FUNC func = (FUNC)GetProcaddress( dll, "InitCommonControls" ); if ( !func ) return; diff --git a/Tests/cpp/cxxtest/X11Gui.h b/Tests/cpp/cxxtest/X11Gui.h index f14431d..5e5ed32 100644 --- a/Tests/cpp/cxxtest/X11Gui.h +++ b/Tests/cpp/cxxtest/X11Gui.h @@ -251,14 +251,14 @@ namespace CxxTest void redraw() { - getWindowSize(); + getWindowsize(); drawSolidBar(); drawDividers(); drawPercentage(); flush(); } - void getWindowSize() + void getWindowsize() { XWindowAttributes attributes; XGetWindowAttributes( _display, _window, &attributes ); diff --git a/Tests/cpp/cxxtestgen.py b/Tests/cpp/cxxtestgen.py index 800d4a4..8c39997 100755 --- a/Tests/cpp/cxxtestgen.py +++ b/Tests/cpp/cxxtestgen.py @@ -304,7 +304,7 @@ def scanLineForTest(suite, lineNo, line): def addTest(suite, name, line): - '''Add a test function to the current suite''' + '''add a test function to the current suite''' test = {'name': name, 'suite': suite, 'class': 'TestDescription_%s_%s' % (suite['name'], name), @@ -356,7 +356,7 @@ def cstr(str): def addSuiteCreateDestroy(suite, which, line): - '''Add createSuite()/destroySuite() to current suite''' + '''add createSuite()/destroySuite() to current suite''' if which in suite: abort('%s:%s: %sSuite() already declared' % (suite['file'], str(line), which)) suite[which] = line @@ -383,7 +383,7 @@ def verifySuite(suite): def rememberSuite(suite): - '''Add current suite to list''' + '''add current suite to list''' global suites suites.append(suite) @@ -539,7 +539,7 @@ def isDynamic(suite): def writeInclude(output, file): - '''Add #include "file" statement''' + '''add #include "file" statement''' global lastIncluded if file == lastIncluded: return diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index 47cbf15..a9a71d1 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -71,49 +71,49 @@ Coord3D A, B; void testCopy() { s = Rigidbody(r); - TS_ASSERT_EQUALS(s.Size(), r.Size()) - TS_ASSERT_EQUALS(r.FindCenter(), s.FindCenter()); + TS_ASSERT_EQUALS(s.size(), r.size()) + TS_ASSERT_EQUALS(r.find_center(), s.find_center()); } - void testSize() - { TS_ASSERT_EQUALS(r.Size(), 2365); + void testsize() + { TS_ASSERT_EQUALS(r.size(), 2365); } - void testSetAtom() + void testset_atom() { - Atom atom (r.CopyAtom(3) ) ; + Atom atom (r.copy_atom(3) ) ; atom.coords = Coord3D(3,4,5); - r.SetAtom(3,atom); + r.set_atom(3,atom); //#test to see if the mofification worked: - Atom atom2 = r.CopyAtom(3); + Atom atom2 = r.copy_atom(3); TS_ASSERT( Norm2(atom2.coords - Coord3D(3,4,5) ) < 1e6 ); } - void testUnsafeGetCoords() + void testUnsafeget_coords() { -// """in principle GetCoords(i,co) and unsafeGetCoords(i,co) should +// """in principle get_coords(i,co) and unsafeget_coords(i,co) should // lead to the exact same coordinates if a sync has been done before // calling the 'unsafe' version""" r2 = Rigidbody(TEST_1FIN_R_PDB); A = Coord3D(4.23, 5.72, 99.02); B = Coord3D(1.23, 6.33, 1.234); - r.ABrotate(A,B, 2.2345); - r2.ABrotate(A,B, 2.2345); - r.Translate(Coord3D(34.23, 123.45,11.972)); - r2.Translate(Coord3D(34.23, 123.45,11.972)); + r.rotate(A,B, 2.2345); + r2.rotate(A,B, 2.2345); + r.translate(Coord3D(34.23, 123.45,11.972)); + r2.translate(Coord3D(34.23, 123.45,11.972)); - r2.syncCoords(); + r2.sync_coords(); // #same rotation and translation for r and r2: should have exact same coordinates - for (int i=0; i 0, check the dimension of the matrix is `n`. @@ -55,7 +55,7 @@ def assertIsSquare(self, source, n=0): err = 'matrix is not {1}x{1} (dims are ({2},{2})'.format(n, nrow) raise AssertionError(err) - def assertSameDimensions(self, source, target): + def assert_same_dimensions(self, source, target): """Assert that two matrices have the same dimensions.""" nrow = len(source) ncol = len(source[0]) @@ -64,9 +64,9 @@ def assertSameDimensions(self, source, target): err = err.format(nrow, ncol, len(target), len(target[0])) raise AssertionError(err) - def assertMatrixAlmostEqual(self, source, target): + def assert_matrix_almost_equal(self, source, target): """Assert that two square matrices elements are almost equal.""" - self.assertSameDimensions(source, target) + self.assert_same_dimensions(source, target) nrow, ncol = len(source), len(source[0]) for i in xrange(nrow): for j in xrange(ncol): @@ -85,22 +85,22 @@ def setUp(self): def test_Movement(self): mov = ptools.Movement() - self.assertMatrixAlmostEqual(get_movement_matrix(mov), zeros(4, 4)) + self.assert_matrix_almost_equal(get_movement_matrix(mov), zeros(4, 4)) def test_Shift(self): mov = ptools.Shift(self.alpha) self.target[0][3] = self.alpha - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Slide(self): mov = ptools.Slide(self.alpha) self.target[1][3] = self.alpha - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Rise(self): mov = ptools.Rise(self.alpha) self.target[2][3] = self.alpha - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Twist(self): mov = ptools.Twist(self.alpha) @@ -108,7 +108,7 @@ def test_Twist(self): self.target[0][1] = -math.sin(self.ralpha) self.target[1][0] = math.sin(self.ralpha) self.target[1][1] = math.cos(self.ralpha) - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Roll(self): mov = ptools.Roll(self.alpha) @@ -116,7 +116,7 @@ def test_Roll(self): self.target[0][2] = math.sin(self.ralpha) self.target[2][0] = -math.sin(self.ralpha) self.target[2][2] = math.cos(self.ralpha) - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Tilt(self): mov = ptools.Tilt(self.alpha) @@ -124,7 +124,7 @@ def test_Tilt(self): self.target[1][2] = -math.sin(self.ralpha) self.target[2][1] = math.sin(self.ralpha) self.target[2][2] = math.cos(self.ralpha) - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_ADNA(self): mov = ptools.ADNA() @@ -135,7 +135,7 @@ def test_ADNA(self): [-0.03595566, 0.03697002, 0.99866932, 3.3059932], [0.00000000, 0.00000000, 0.00000000, 1.0000000], ] - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_BDNA(self): mov = ptools.BDNA() @@ -146,7 +146,7 @@ def test_BDNA(self): [0.04651246, -0.03141768, 0.998423518, 3.2887760], [0.00000000, 0.00000000, 0.000000000, 1.0000000], ] - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def zeros(n, m): @@ -163,7 +163,7 @@ def identity(n): def get_movement_matrix(mov): """Return a Movement matrix.""" - return string_to_matrix(mov.toString()) + return string_to_matrix(mov.to_string()) def string_to_matrix(s): diff --git a/Tests/test_pairlist.py b/Tests/test_pairlist.py index b360a54..6d8598b 100644 --- a/Tests/test_pairlist.py +++ b/Tests/test_pairlist.py @@ -21,20 +21,20 @@ def setUp(self): r = Rigidbody() at = Atom() at.coords = Coord3D(1, 0, 0) - r.AddAtom(at) + r.add_atom(at) at.coords = Coord3D(2, 0, 0) - r.AddAtom(at) + r.add_atom(at) l = Rigidbody() at.coords = Coord3D(4, 0, 0) - l.AddAtom(at) + l.add_atom(at) at.coords = Coord3D(5, 0, 0) - l.AddAtom(at) + l.add_atom(at) self.ar = AttractRigidbody(r) self.al = AttractRigidbody(l) - def testAtomPair(self): + def test_atompair(self): atp = AtomPair() atp.atlig = 23 atp.atrec = 45 diff --git a/Tests/test_rigidbody.py b/Tests/test_rigidbody.py index 5424431..2686e26 100644 --- a/Tests/test_rigidbody.py +++ b/Tests/test_rigidbody.py @@ -23,74 +23,74 @@ def test_Rigidbody_has_len(self): def test_Rigidbody_has_size(self): self.assertTrue(hasattr(Rigidbody, 'size')) - def test_Rigidbody_has_getCoords(self): - self.assertTrue(hasattr(Rigidbody, 'getCoords')) + def test_Rigidbody_has_get_coords(self): + self.assertTrue(hasattr(Rigidbody, 'get_coords')) - def test_Rigidbody_has_unsafeGetCoords(self): - self.assertTrue(hasattr(Rigidbody, 'unsafeGetCoords')) + def test_Rigidbody_has_unsafeget_coords(self): + self.assertTrue(hasattr(Rigidbody, 'unsafeget_coords')) - def test_Rigidbody_has_setCoords(self): - self.assertTrue(hasattr(Rigidbody, 'setCoords')) + def test_Rigidbody_has_set_coords(self): + self.assertTrue(hasattr(Rigidbody, 'set_coords')) - def test_Rigidbody_has_Translate(self): - self.assertTrue(hasattr(Rigidbody, 'Translate')) + def test_Rigidbody_has_translate(self): + self.assertTrue(hasattr(Rigidbody, 'translate')) - def test_Rigidbody_has_FindCenter(self): - self.assertTrue(hasattr(Rigidbody, 'FindCenter')) + def test_Rigidbody_has_find_center(self): + self.assertTrue(hasattr(Rigidbody, 'find_center')) - def test_Rigidbody_has_ABrotate(self): - self.assertTrue(hasattr(Rigidbody, 'ABrotate')) + def test_Rigidbody_has_rotate(self): + self.assertTrue(hasattr(Rigidbody, 'rotate')) - def test_Rigidbody_has_AttractEulerRotate(self): - self.assertTrue(hasattr(Rigidbody, 'AttractEulerRotate')) + def test_Rigidbody_has_euler_rotate(self): + self.assertTrue(hasattr(Rigidbody, 'euler_rotate')) - def test_Rigidbody_has_syncCoords(self): - self.assertTrue(hasattr(Rigidbody, 'syncCoords')) + def test_Rigidbody_has_sync_coords(self): + self.assertTrue(hasattr(Rigidbody, 'sync_coords')) def test_Rigidbody_has_apply_matrix(self): self.assertTrue(hasattr(Rigidbody, 'apply_matrix')) - def test_Rigidbody_has_CopyAtom(self): - self.assertTrue(hasattr(Rigidbody, 'CopyAtom')) + def test_Rigidbody_has_copy_atom(self): + self.assertTrue(hasattr(Rigidbody, 'copy_atom')) - def test_Rigidbody_has_AddAtom(self): - self.assertTrue(hasattr(Rigidbody, 'AddAtom')) + def test_Rigidbody_has_add_atom(self): + self.assertTrue(hasattr(Rigidbody, 'add_atom')) - def test_Rigidbody_has_SetAtom(self): - self.assertTrue(hasattr(Rigidbody, 'SetAtom')) + def test_Rigidbody_has_set_atom(self): + self.assertTrue(hasattr(Rigidbody, 'set_atom')) - def test_Rigidbody_has_GetAtomProperty(self): - self.assertTrue(hasattr(Rigidbody, 'GetAtomProperty')) + def test_Rigidbody_has_get_atom_property(self): + self.assertTrue(hasattr(Rigidbody, 'get_atom_property')) - def test_Rigidbody_has_SetAtomProperty(self): - self.assertTrue(hasattr(Rigidbody, 'SetAtomProperty')) + def test_Rigidbody_has_set_atom_property(self): + self.assertTrue(hasattr(Rigidbody, 'set_atom_property')) - def test_Rigidbody_has_Radius(self): - self.assertTrue(hasattr(Rigidbody, 'Radius')) + def test_Rigidbody_has_radius(self): + self.assertTrue(hasattr(Rigidbody, 'radius')) - def test_Rigidbody_has_RadiusGyration(self): - self.assertTrue(hasattr(Rigidbody, 'RadiusGyration')) + def test_Rigidbody_has_radius_of_gyration(self): + self.assertTrue(hasattr(Rigidbody, 'radius_of_gyration')) - def test_Rigidbody_has_SelectAllAtoms(self): - self.assertTrue(hasattr(Rigidbody, 'SelectAllAtoms')) + def test_Rigidbody_has_select_all_atoms(self): + self.assertTrue(hasattr(Rigidbody, 'select_all_atoms')) - def test_Rigidbody_has_SelectAtomType(self): - self.assertTrue(hasattr(Rigidbody, 'SelectAtomType')) + def test_Rigidbody_has_select_atomtype(self): + self.assertTrue(hasattr(Rigidbody, 'select_atomtype')) - def test_Rigidbody_has_SelectResidType(self): - self.assertTrue(hasattr(Rigidbody, 'SelectResidType')) + def test_Rigidbody_has_select_restype(self): + self.assertTrue(hasattr(Rigidbody, 'select_restype')) - def test_Rigidbody_has_SelectChainId(self): - self.assertTrue(hasattr(Rigidbody, 'SelectChainId')) + def test_Rigidbody_has_select_chainid(self): + self.assertTrue(hasattr(Rigidbody, 'select_chainid')) - def test_Rigidbody_has_SelectResRange(self): - self.assertTrue(hasattr(Rigidbody, 'SelectResRange')) + def test_Rigidbody_has_select_resid_range(self): + self.assertTrue(hasattr(Rigidbody, 'select_resid_range')) - def test_Rigidbody_has_CA(self): - self.assertTrue(hasattr(Rigidbody, 'CA')) + def test_Rigidbody_has_get_CA(self): + self.assertTrue(hasattr(Rigidbody, 'get_CA')) - def test_Rigidbody_has_Backbone(self): - self.assertTrue(hasattr(Rigidbody, 'Backbone')) + def test_Rigidbody_has_backbone(self): + self.assertTrue(hasattr(Rigidbody, 'backbone')) def test_has_operator_add(self): self.assertTrue(hasattr(Rigidbody, '__add__')) @@ -105,16 +105,16 @@ def setUp(self): self.r2 = Rigidbody() at = Atom() at.coords = Coord3D(1, 0, 0) - self.r2.AddAtom(at) + self.r2.add_atom(at) at.coords = Coord3D(0, 1, 0) - self.r2.AddAtom(at) + self.r2.add_atom(at) at.coords = Coord3D(0, 0, 1) - self.r2.AddAtom(at) + self.r2.add_atom(at) - def testCopy(self): + def test_copy(self): s = Rigidbody(self.r) self.assertEqual(len(s), len(self.r)) - self.assertEqual(self.r.FindCenter(), s.FindCenter()) + self.assertEqual(self.r.find_center(), s.find_center()) def test_len(self): self.assertEqual(len(self.r), 2365) @@ -133,108 +133,108 @@ def coordinates_equal(test, ref): d = abs(test - ref) return d.x < t and d.y < t and d.z < t origin = Coord3D(0, 0, 0) - self.assertFalse(coordinates_equal(origin, self.r.FindCenter())) # assertEqual won't work + self.assertFalse(coordinates_equal(origin, self.r.find_center())) # assertEqual won't work self.r.center_to_origin() - self.assertTrue(coordinates_equal(origin, self.r.FindCenter())) # assertEqual won't work + self.assertTrue(coordinates_equal(origin, self.r.find_center())) # assertEqual won't work - def testCopyAtom(self): - atom = self.r.CopyAtom(3) + def testcopy_atom(self): + atom = self.r.copy_atom(3) coords = atom.coords assertCoordsAlmostEqual(self, coords, Coord3D(-16.159, 189.782, 106.402)) self.assertEqual(atom.atomId, 4) self.assertEqual(atom.chainId, '') - def testGetCoords(self): - coords = self.r.getCoords(3) + def testget_coords(self): + coords = self.r.get_coords(3) assertCoordsAlmostEqual(self, coords, Coord3D(-16.159, 189.782, 106.402)) - def testTranslate(self): + def testtranslate(self): tr = Coord3D(3.2, 2.98, 14.22) s = Rigidbody(self.r) - s.Translate(tr) - coords = s.getCoords(3) + s.translate(tr) + coords = s.get_coords(3) ref = Coord3D(-16.159 + 3.2, 189.782 + 2.98, 106.402 + 14.22) assertCoordsAlmostEqual(self, coords, ref) - def testFindCenter(self): - cen = self.r.FindCenter() + def testfind_center(self): + cen = self.r.find_center() ref = Coord3D(-20.171249, 215.498060, 119.427781) assertCoordsAlmostEqual(self, cen, ref) - def testSetAtom(self): - atom = self.r.CopyAtom(3) + def testset_atom(self): + atom = self.r.copy_atom(3) atom.coords = Coord3D(3, 4, 5) - self.r.SetAtom(3, atom) + self.r.set_atom(3, atom) # test to see if the mofification worked: - atom2 = self.r.CopyAtom(3) + atom2 = self.r.copy_atom(3) coords2 = atom2.coords assertCoordsAlmostEqual(self, atom2.coords, Coord3D(3, 4, 5)) assertCoordsAlmostEqual(self, coords2, Coord3D(3, 4, 5)) - def testSetAtomWithOutOfBoundsPosition(self): + def testset_atom_with_out_of_bounds_position(self): maxpos = len(self.r) - 1 with self.assertRaisesRegexp(IndexError, 'out of bounds'): - self.r.SetAtomProperty(maxpos + 1, Atom()) + self.r.set_atom_property(maxpos + 1, Atom()) - def testSetAtomWithNegativePosition(self): + def testset_atom_with_negative_position(self): with self.assertRaisesRegexp(OverflowError, "can't convert negative value to unsigned int"): - self.r.SetAtomProperty(-1, Atom()) + self.r.set_atom_property(-1, Atom()) - def testUnsafeGetCoords(self): - """in principle GetCoords(i,co) and unsafeGetCoords(i,co) should + def test_unsafe_get_coords(self): + """in principle get_coords(i,co) and unsafeget_coords(i,co) should lead to the exact same coordinates if a sync has been done before calling the 'unsafe' version""" r2 = Rigidbody(TEST_LIGAND_PDB) A = Coord3D(4.23, 5.72, 99.02) B = Coord3D(1.23, 6.33, 1.234) - self.r.ABrotate(A, B, 2.2345) - r2.ABrotate(A, B, 2.2345) - self.r.Translate(Coord3D(34.23, 123.45, 11.972)) - r2.Translate(Coord3D(34.23, 123.45, 11.972)) + self.r.rotate(A, B, 2.2345) + r2.rotate(A, B, 2.2345) + self.r.translate(Coord3D(34.23, 123.45, 11.972)) + r2.translate(Coord3D(34.23, 123.45, 11.972)) - r2.syncCoords() + r2.sync_coords() # same rotation and translation for r and r2: should have exact # same coordinates for i in range(len(self.r)): co1 = Coord3D() co2 = Coord3D() - co1 = self.r.getCoords(i) - r2.unsafeGetCoords(i, co2) + co1 = self.r.get_coords(i) + r2.unsafeget_coords(i, co2) assertCoordsAlmostEqual(self, co1, co2) - def testAddAtoms(self): + def testadd_atoms(self): r = Rigidbody() self.assertEqual(len(r), 0) at = Atom() at.coords = Coord3D(2, 3, 4) - r.AddAtom(at) + r.add_atom(at) self.assertAlmostEqual(len(r), 1) - def testGetAtomProperty(self): - atprop = self.r.GetAtomProperty(8) + def testget_atom_property(self): + atprop = self.r.get_atom_property(8) self.assertEqual(atprop.residType, 'GLU') self.assertEqual(atprop.residId, 2) self.assertEqual(atprop.atomId, 9) - def testSetAtomProperty(self): + def testset_atom_property(self): prop = Atomproperty() prop.residType = 'AAA' - self.r.SetAtomProperty(0, prop) - prop = self.r.GetAtomProperty(0) + self.r.set_atom_property(0, prop) + prop = self.r.get_atom_property(0) self.assertEqual(prop.residType, 'AAA') - def testSetAtomPropertyWithOutOfBoundsPosition(self): + def test_set_atom_property_with_out_of_bounds_position(self): maxpos = len(self.r) - 1 with self.assertRaisesRegexp(IndexError, 'out of bounds'): - self.r.SetAtomProperty(maxpos + 1, Atomproperty()) + self.r.set_atom_property(maxpos + 1, Atomproperty()) - def testSetAtomPropertyWithNegativePosition(self): + def test_set_atom_property_with_negative_position(self): with self.assertRaisesRegexp(OverflowError, "can't convert negative value to unsigned int"): - self.r.SetAtomProperty(-1, Atomproperty()) + self.r.set_atom_property(-1, Atomproperty()) - def testNegativeResId(self): + def test_negative_residId(self): rigid = Rigidbody(TEST_2AAV_PDB) - at1 = rigid.CopyAtom(0) + at1 = rigid.copy_atom(0) self.assertEqual(at1.residId, -4) diff --git a/Tests/test_superpose.py b/Tests/test_superpose.py index 1b9dd4f..2177392 100644 --- a/Tests/test_superpose.py +++ b/Tests/test_superpose.py @@ -16,14 +16,14 @@ class TestSuperposeBindings(unittest.TestCase): def test_ptools_has_superpose(self): self.assertTrue(hasattr(ptools, 'superpose')) - def test_ptools_has_MatTrans2screw(self): - self.assertTrue(hasattr(ptools, 'MatTrans2screw')) + def test_ptools_has_mat44_to_screw(self): + self.assertTrue(hasattr(ptools, 'mat44_to_screw')) -class TestMatTrans2screw(unittest.TestCase): - def test_MatTrans2screw(self): +class Testmat44_to_screw(unittest.TestCase): + def test_mat44_to_screw(self): m = ptools.Matrix(3, 3) # Initialize 3 x 3 matrix - s = ptools.MatTrans2screw(m) + s = ptools.mat44_to_screw(m) self.assertTrue(isinstance(s, ptools.Screw)) self.assertAlmostEqual(s.angle, 1.57079632679) @@ -36,7 +36,7 @@ class TestSuperposition(unittest.TestCase): def setUp(self): self.prot1 = ptools.Rigidbody(TEST_LIGAND_PDB) - def testTransRot(self): + def test_trans_rot(self): prot2 = ptools.Rigidbody(self.prot1) for i in xrange(20): @@ -44,16 +44,16 @@ def testTransRot(self): x = (random.random() - 0.5) * 50.0 y = (random.random() - 0.5) * 50.0 z = (random.random() - 0.5) * 50.0 - prot2.Translate(ptools.Coord3D(x, y, z)) + prot2.translate(ptools.Coord3D(x, y, z)) a = (random.random() - 0.5) * 50.0 b = (random.random() - 0.5) * 50.0 c = (random.random() - 0.5) * 50.0 - prot2.AttractEulerRotate(a, b, c) + prot2.euler_rotate(a, b, c) sup = ptools.superpose(self.prot1, prot2) # superpose(reference, mobile) matrix = sup.matrix prot2.apply_matrix(matrix) - self.assertAlmostEqual(ptools.Rmsd(prot2, self.prot1), 0.0) + self.assertAlmostEqual(ptools.rmsd(prot2, self.prot1), 0.0) if __name__ == '__main__': diff --git a/bindings/atom.pyx b/bindings/atom.pyx index ec6be8d..e925dc8 100644 --- a/bindings/atom.pyx +++ b/bindings/atom.pyx @@ -21,12 +21,12 @@ cdef extern from "atom.h" namespace "PTools": CppAtom(CppAtomproperty, CppCoord3D) string ToString() - string ToPdbString() - void Translate(CppCoord3D&) + string to_pdb_string() + void translate(CppCoord3D&) CppCoord3D coords - cdef double cppDist "PTools::Dist" (CppAtom& , CppAtom& ) - cdef double cppDist2 "PTools::Dist2" (CppAtom& , CppAtom& ) + cdef double cppdist "PTools::dist" (CppAtom& , CppAtom& ) + cdef double cppdist2 "PTools::dist2" (CppAtom& , CppAtom& ) cdef extern from "cython_wrappers.h": cdef void cy_copy_atom(CppAtom* , CppAtom* ) @@ -180,16 +180,16 @@ cdef class Atom(Atomproperty): def __str__(self): return self.ToString() - def ToPdbString(self): - return (self.thisptr).ToPdbString().c_str() + def to_pdb_string(self): + return (self.thisptr).to_pdb_string().c_str() - def Translate(self,Coord3D co): - (self.thisptr).Translate(deref(co.thisptr)) + def translate(self,Coord3D co): + (self.thisptr).translate(deref(co.thisptr)) -def Dist(Atom at1, Atom at2): - return cppDist(deref(at1.thisptr), deref(at2.thisptr)) +def dist(Atom at1, Atom at2): + return cppdist(deref(at1.thisptr), deref(at2.thisptr)) -def Dist2(Atom at1, Atom at2): - return cppDist2(deref(at1.thisptr), deref(at2.thisptr)) +def dist2(Atom at1, Atom at2): + return cppdist2(deref(at1.thisptr), deref(at2.thisptr)) diff --git a/bindings/atomselection.pyx b/bindings/atomselection.pyx index 63f82d6..1219479 100644 --- a/bindings/atomselection.pyx +++ b/bindings/atomselection.pyx @@ -8,12 +8,12 @@ cdef extern from "atomselection.h" namespace "PTools": CppAtomSelection(CppAtomSelection&) CppAtomSelection(CppRigidbody) - unsigned int Size() - void SetRigid(CppRigidbody&) + unsigned int size() + void set_rigid(CppRigidbody&) CppAtom operator[] - CppAtom CopyAtom(unsigned int) - void AddAtomIndex(unsigned int) - CppRigidbody CreateRigid() + CppAtom copy_atom(unsigned int) + void add_atomIndex(unsigned int) + CppRigidbody create_rigid() CppAtomSelection non(CppAtomSelection &) @@ -57,7 +57,7 @@ cdef class AtomSelection: del self.thisptr def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() def __and__(AtomSelection self, AtomSelection second): ret = AtomSelection() @@ -85,14 +85,14 @@ cdef class AtomSelection: return self.__invert__() - def CreateRigid(self): + def create_rigid(self): ret = Rigidbody() if ret.thisptr: del ret.thisptr - cdef CppRigidbody rig = self.thisptr.CreateRigid() + cdef CppRigidbody rig = self.thisptr.create_rigid() ret.thisptr = new CppRigidbody(rig) return ret - def SetRigid(self, Rigidbody r): + def set_rigid(self, Rigidbody r): self.pyRigid = r # to increase the refcount of r, preventing bad things if r is destroyed - self.thisptr.SetRigid(deref(r.thisptr)) \ No newline at end of file + self.thisptr.set_rigid(deref(r.thisptr)) \ No newline at end of file diff --git a/bindings/attractforcefield.pyx b/bindings/attractforcefield.pyx index a600ccc..441dabe 100644 --- a/bindings/attractforcefield.pyx +++ b/bindings/attractforcefield.pyx @@ -25,10 +25,10 @@ cdef extern from "forcefield.h" namespace "PTools": cdef extern from "attractforcefield.h" namespace "PTools": cdef cppclass CppBaseAttractForceField "PTools::BaseAttractForceField" (CppForceField): - unsigned int ProblemSize() + unsigned int Problemsize() double Function(vector[double]&) - void AddLigand(CppAttractRigidbody &) - double getVdw() + void addLigand(CppAttractRigidbody &) + double get_vdw() double getCoulomb() double nonbon8(CppAttractRigidbody& , CppAttractRigidbody& , CppAttractPairList & , int) @@ -61,9 +61,9 @@ cdef class AttractForceField2(BaseAttractForceField): def __dealloc__(self): del self.thisptr - def AddLigand(self, AttractRigidbody rig): + def addLigand(self, AttractRigidbody rig): self.rigidlist.append(rig) - self.thisptr.AddLigand(deref(rig.thisptr)) + self.thisptr.addLigand(deref(rig.thisptr)) def Function(self, vec): cdef vector[double] v @@ -72,8 +72,8 @@ cdef class AttractForceField2(BaseAttractForceField): return self.thisptr.Function(v) - def getVdw(self): - return self.thisptr.getVdw() + def get_vdw(self): + return self.thisptr.get_vdw() def getCoulomb(self): return self.thisptr.getCoulomb() @@ -85,9 +85,9 @@ cdef class AttractForceField2(BaseAttractForceField): cdef extern from "attractforcefield.h" namespace "PTools": cdef cppclass CppAttractForceField1 "PTools::AttractForceField1"(CppBaseAttractForceField): CppAttractForceField1(string&, double) - void AddLigand(CppAttractRigidbody&) + void addLigand(CppAttractRigidbody&) double Function(vector[double]&) - double getVdw() + double get_vdw() double getCoulomb() @@ -109,8 +109,8 @@ cdef class AttractForceField1(BaseAttractForceField): def __dealloc__(self): del self.thisptr - def AddLigand(self, AttractRigidbody rig): - self.thisptr.AddLigand(deref(rig.thisptr)) + def addLigand(self, AttractRigidbody rig): + self.thisptr.addLigand(deref(rig.thisptr)) def Function(self, vec): cdef vector[double] v @@ -119,8 +119,8 @@ cdef class AttractForceField1(BaseAttractForceField): return self.thisptr.Function(v) - def getVdw(self): - return self.thisptr.getVdw() + def get_vdw(self): + return self.thisptr.get_vdw() def getCoulomb(self): return self.thisptr.getCoulomb() diff --git a/bindings/attractrigidbody.pyx b/bindings/attractrigidbody.pyx index 13942e1..c99d3a4 100644 --- a/bindings/attractrigidbody.pyx +++ b/bindings/attractrigidbody.pyx @@ -18,22 +18,22 @@ cdef extern from "attractrigidbody.h" namespace "PTools": void resetForces() #void addForces( #TODO: later - void setRotation(int) - void setTranslation(int) - CppCoord3D FindCenter() + void set_rotation(int) + void set_translation(int) + CppCoord3D find_center() - unsigned int Size() + unsigned int size() #returns radius of gyration - double RadiusGyration() + double radius_of_gyration() #returns the radius of a Rigidbody (max distance from center) - double Radius() + double radius() - void PrintMatrix() + void print_matrix() - CppAtomSelection CA() + CppAtomSelection get_CA() @@ -86,13 +86,13 @@ cdef class AttractRigidbody (Rigidbody) : def getCharge(self, atomid): return (self.thisptr).getCharge(atomid) - #void setRotation(bool) - def setRotation(self, flag): - ( self.thisptr).setRotation(flag) + #void set_rotation(bool) + def set_rotation(self, flag): + ( self.thisptr).set_rotation(flag) - #void setTranslation(bool) - def setTranslation(self, flag): - ( self.thisptr).setTranslation(flag) + #void set_translation(bool) + def set_translation(self, flag): + ( self.thisptr).set_translation(flag) def isAtomActive(self, atomid): return ( self.thisptr).isAtomActive(atomid) @@ -102,47 +102,47 @@ cdef class AttractRigidbody (Rigidbody) : ( self.thisptr).resetForces() - def Size(self): - return self.thisptr.Size() + def size(self): + return self.thisptr.size() #define also the __len__ method: def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() - def FindCenter(self): + def find_center(self): cdef CppRigidbody* rig = self.thisptr - cdef CppCoord3D* co = new CppCoord3D (rig.FindCenter()) + cdef CppCoord3D* co = new CppCoord3D (rig.find_center()) ret = Coord3D() del ret.thisptr ret.thisptr = co return ret - def Translate(self, Coord3D co): + def translate(self, Coord3D co): cdef CppRigidbody* rig = self.thisptr - rig.Translate(deref(co.thisptr)) + rig.translate(deref(co.thisptr)) - def AttractEulerRotate(self, double phi, double ssi, double rot): + def euler_rotate(self, double phi, double ssi, double rot): cdef CppRigidbody* rig = self.thisptr - rig.AttractEulerRotate(phi, ssi, rot) + rig.euler_rotate(phi, ssi, rot) #these function should be defined only in Rigdibody object and attractrigdbody should inherit from it:œ - def Radius(self): - return self.thisptr.Radius() + def radius(self): + return self.thisptr.radius() - def RadiusGyration(self): - return self.thisptr.RadiusGyration() + def radius_of_gyration(self): + return self.thisptr.radius_of_gyration() - def PrintMatrix(self): - ( self.thisptr).PrintMatrix() + def print_matrix(self): + ( self.thisptr).print_matrix() - def CA(self): + def get_CA(self): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.CA() + cdef CppAtomSelection new_sel = self.thisptr.get_CA() ret.thisptr = new CppAtomSelection(new_sel) return ret \ No newline at end of file diff --git a/bindings/basepair.pyx b/bindings/basepair.pyx index e8a48e0..520534e 100644 --- a/bindings/basepair.pyx +++ b/bindings/basepair.pyx @@ -4,8 +4,8 @@ cdef extern from "BasePair.h" namespace "PTools": CppBasePair(string) CppBasePair(CppRigidbody&) CppBasePair(CppBasePair&) - CppRigidbody GetRigidBody() - unsigned int Size() + CppRigidbody get_rigid() + unsigned int size() cdef class BasePair: @@ -30,14 +30,14 @@ cdef class BasePair: self.thisptr = 0 def __len__(self): - return self.Size() + return self.size() - def Size(self): - return self.thisptr.Size() + def size(self): + return self.thisptr.size() - def GetRigidBody(self): + def get_rigid(self): # Get a pointer to the RigidBody. - cdef CppRigidbody * new_rb = new CppRigidbody(self.thisptr.GetRigidBody()) + cdef CppRigidbody * new_rb = new CppRigidbody(self.thisptr.get_rigid()) # Create a new Python Rigidbody and makes it point to the cpp copy. cdef Rigidbody rb = Rigidbody() diff --git a/bindings/coord3d.pyx b/bindings/coord3d.pyx index 479fc0a..fc410c4 100644 --- a/bindings/coord3d.pyx +++ b/bindings/coord3d.pyx @@ -113,10 +113,10 @@ def norm(Coord3D v): def norm2(Coord3D v): return Norm2(deref(v.thisptr)) -def dotproduct(Coord3D u, Coord3D v): +def dot_product(Coord3D u, Coord3D v): return dotProduct(deref(u.thisptr), deref(v.thisptr)) -def crossproduct(Coord3D u, Coord3D v): +def cross_product(Coord3D u, Coord3D v): cdef CppCoord3D cppresult = crossProduct(deref(u.thisptr), deref(v.thisptr)) cdef Coord3D result = Coord3D(cppresult.x, cppresult.y, cppresult.z) return result diff --git a/bindings/coordsarray.pyx b/bindings/coordsarray.pyx index 296ba62..c176aab 100644 --- a/bindings/coordsarray.pyx +++ b/bindings/coordsarray.pyx @@ -2,13 +2,13 @@ cdef extern from "coordsarray.h" namespace "PTools": cdef cppclass CppCoordsArray "PTools::CoordsArray": CppCoordsArray() CppCoordsArray( CppCoordsArray & ) - void unsafeGetCoords(unsigned int , CppCoord3D& ) - void AddCoord(CppCoord3D& co) - unsigned int Size() - void GetCoords(unsigned int, CppCoord3D&) - void SetCoords(unsigned int, CppCoord3D&) - void Translate(CppCoord3D&) - void AttractEulerRotate(double , double, double) + void unsafeget_coords(unsigned int , CppCoord3D& ) + void add_coord(CppCoord3D& co) + unsigned int size() + void get_coords(unsigned int, CppCoord3D&) + void set_coords(unsigned int, CppCoord3D&) + void translate(CppCoord3D&) + void euler_rotate(double , double, double) cdef class CoordsArray: @@ -23,34 +23,34 @@ cdef class CoordsArray: self.thisptr = new CppCoordsArray() def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() - def Size(self): + def size(self): print "Depreciated, use len(obj) instead" - return self.thisptr.Size() + return self.thisptr.size() - #def unsafeGetCoords(self, int i, Coord3D co): + #def unsafeget_coords(self, int i, Coord3D co): # cdef Coord3D c # cdef CppCoord3D *coptr # c = co # coptr = c.thisptr - # self.thisptr.unsafeGetCoords(i, deref(coptr)) + # self.thisptr.unsafeget_coords(i, deref(coptr)) - def unsafeGetCoords(self, int i, Coord3D co): - self.thisptr.unsafeGetCoords(i, deref(co.thisptr)) + def unsafeget_coords(self, int i, Coord3D co): + self.thisptr.unsafeget_coords(i, deref(co.thisptr)) - def AddCoord(self, Coord3D co): - self.thisptr.AddCoord( deref(co.thisptr) ) + def add_coord(self, Coord3D co): + self.thisptr.add_coord( deref(co.thisptr) ) - def GetCoords(self, i, Coord3D co): - self.thisptr.GetCoords(i, deref(co.thisptr)) + def get_coords(self, i, Coord3D co): + self.thisptr.get_coords(i, deref(co.thisptr)) - def SetCoords(self, i, Coord3D co): - self.thisptr.SetCoords(i, deref(co.thisptr)) + def set_coords(self, i, Coord3D co): + self.thisptr.set_coords(i, deref(co.thisptr)) - def Translate(self, Coord3D co): - self.thisptr.Translate(deref(co.thisptr)) + def translate(self, Coord3D co): + self.thisptr.translate(deref(co.thisptr)) - def AttractEulerRotate(self, double phi, double ssi, double rot): - self.thisptr.AttractEulerRotate(phi, ssi, rot) \ No newline at end of file + def euler_rotate(self, double phi, double ssi, double rot): + self.thisptr.euler_rotate(phi, ssi, rot) \ No newline at end of file diff --git a/bindings/dna.pyx b/bindings/dna.pyx index d8c7670..70b5903 100644 --- a/bindings/dna.pyx +++ b/bindings/dna.pyx @@ -7,17 +7,17 @@ cdef extern from "DNA.h" namespace "PTools": CppDNA(CppDNA&) CppDNA(string&, string&, CppMovement&) CppDNA(string&, string&) #with default value for third parameter - CppDNA SubDNA(int, int) + CppDNA subDNA(int, int) CppBasePair operator[](int) - unsigned int Size() - void Add(CppBasePair, const CppMovement &) - void Add(CppBasePair) - void Add(CppDNA, const CppMovement &) - void Add(CppDNA) - void ChangeType(int, string, string) - void ApplyLocal(const CppMovement&, int) - void ChangeRepresentation(string) - string PrintPDB() + unsigned int size() + void add(CppBasePair, const CppMovement &) + void add(CppBasePair) + void add(CppDNA, const CppMovement &) + void add(CppDNA) + void change_type(int, string, string) + void apply_local(const CppMovement&, int) + void change_representation(string) + string print_pdb() cdef class DNA: @@ -45,10 +45,10 @@ cdef class DNA: self.thisptr = 0 def __len__(self): - return self.Size() + return self.size() def __getitem__(self, unsigned int i): - if i>=self.thisptr.Size(): + if i>=self.thisptr.size(): raise IndexError bp = BasePair() if bp.thisptr: @@ -57,18 +57,18 @@ cdef class DNA: bp.thisptr = new CppBasePair(deref(self.thisptr)[i]) return bp - def Size(self): - return self.thisptr.Size() + def size(self): + return self.thisptr.size() - def SubDNA(self, int start, int end): + def subDNA(self, int start, int end): ret = DNA() if ret.thisptr: del ret.thisptr - cdef CppDNA cdna = self.thisptr.SubDNA(start, end) + cdef CppDNA cdna = self.thisptr.subDNA(start, end) ret.thisptr = new CppDNA(cdna) return ret - def Add(self, bp_or_dna, mov=None): + def add(self, bp_or_dna, mov=None): if isinstance(bp_or_dna, DNA): self._add_dna(bp_or_dna, mov) else: @@ -76,26 +76,26 @@ cdef class DNA: def _add_bp(self, BasePair bp, Movement mov=None): if mov == None: - self.thisptr.Add(deref(bp.thisptr)) + self.thisptr.add(deref(bp.thisptr)) else: - self.thisptr.Add(deref(bp.thisptr), deref(mov.thisptr)) + self.thisptr.add(deref(bp.thisptr), deref(mov.thisptr)) def _add_dna(self, DNA dna, Movement mov=None): if mov == None: - self.thisptr.Add(deref(dna.thisptr)) + self.thisptr.add(deref(dna.thisptr)) else: - self.thisptr.Add(deref(dna.thisptr), deref(mov.thisptr)) + self.thisptr.add(deref(dna.thisptr), deref(mov.thisptr)) - def ChangeType(self, int pos, bytes basetype, bytes filename): + def change_type(self, int pos, bytes basetype, bytes filename): cdef const char * c_basetype = basetype cdef const char * c_filename = filename - self.thisptr.ChangeType(pos, str(c_basetype), str(c_filename)) + self.thisptr.change_type(pos, str(c_basetype), str(c_filename)) - def ApplyLocal(self, Movement mov, int posMov): - self.thisptr.ApplyLocal(deref(mov.thisptr), posMov) + def apply_local(self, Movement mov, int posMov): + self.thisptr.apply_local(deref(mov.thisptr), posMov) - def ChangeRepresentation(self, bytes rep): - self.thisptr.ChangeRepresentation(rep) + def change_representation(self, bytes rep): + self.thisptr.change_representation(rep) - def PrintPDB(self): - return self.thisptr.PrintPDB() + def print_pdb(self): + return self.thisptr.print_pdb() diff --git a/bindings/lbfgs.pyx b/bindings/lbfgs.pyx index fee4def..7783c82 100644 --- a/bindings/lbfgs.pyx +++ b/bindings/lbfgs.pyx @@ -5,9 +5,9 @@ cdef extern from "lbfgs_interface.h" namespace "PTools": cdef cppclass CppLbfgs "PTools::Lbfgs": CppLbfgs(CppBaseAttractForceField&) void minimize(int) - vector[double] GetMinimizedVars() - vector[double] GetMinimizedVarsAtIter(int) - int GetNumberIter() + vector[double] get_minimized_vars() + vector[double] get_minimized_vars_at_iter(int) + int get_number_iter() cdef class Lbfgs: @@ -25,18 +25,18 @@ cdef class Lbfgs: def minimize(self, int maxiter): self.thisptr.minimize(maxiter) - def GetMinimizedVars(self): - cdef vector[double] vars = self.thisptr.GetMinimizedVars() + def get_minimized_vars(self): + cdef vector[double] vars = self.thisptr.get_minimized_vars() out = [] for i in xrange(vars.size()): out.append(vars[i]) return out - def GetNumberIter(self): - return self.thisptr.GetNumberIter() + def get_number_iter(self): + return self.thisptr.get_number_iter() - def GetMinimizedVarsAtIter(self, int iter): - cdef vector[double] vars = self.thisptr.GetMinimizedVarsAtIter(iter) + def get_minimized_vars_at_iter(self, int iter): + cdef vector[double] vars = self.thisptr.get_minimized_vars_at_iter(iter) out = [] for i in xrange(vars.size()): out.append(vars[i]) diff --git a/bindings/matrix.pyx b/bindings/matrix.pyx index 8a7068e..621ce78 100644 --- a/bindings/matrix.pyx +++ b/bindings/matrix.pyx @@ -12,7 +12,7 @@ cdef extern from "basetypes.h": string str() int get_nrows() int get_ncolumns() - pair[int,int] getDim() + pair[int,int] get_dim() void Print() cdef cppclass cppSuperpose_t "Superpose_t" : @@ -60,8 +60,8 @@ cdef class Matrix: def get_ncolumns(self): return self.thisptr.get_ncolumns() - def getDim(self): - return self.thisptr.getDim() + def get_dim(self): + return self.thisptr.get_dim() def Print(self): self.thisptr.Print() diff --git a/bindings/movement.pyx b/bindings/movement.pyx index 581a0ea..daedf3a 100644 --- a/bindings/movement.pyx +++ b/bindings/movement.pyx @@ -22,9 +22,9 @@ cdef extern from "Movement.h" namespace "PTools": CppMovement() except+ CppMovement(Array2D[double] &) Array2D[double] m - void Apply(CppRigidbody&) + void apply(CppRigidbody&) void Print() const - string toString() const; + string to_string() const; cdef cppclass CppShift "PTools::Shift"(CppMovement): CppShift(double alpha) @@ -64,14 +64,14 @@ cdef class Movement: if self.thisptr: del self.thisptr - def Apply(self, Rigidbody rigid): - self.thisptr.Apply(deref(rigid.thisptr)) + def apply(self, Rigidbody rigid): + self.thisptr.apply(deref(rigid.thisptr)) def Print(self): self.thisptr.Print() - def toString(self): - return self.thisptr.toString() + def to_string(self): + return self.thisptr.to_string() cdef class Shift(Movement): diff --git a/bindings/pairlist.pyx b/bindings/pairlist.pyx index 79f6fbf..6fb20c0 100644 --- a/bindings/pairlist.pyx +++ b/bindings/pairlist.pyx @@ -51,7 +51,7 @@ cdef extern from "pairlist.h" namespace "PTools": CppAttractPairList() CppAttractPairList(CppAttractRigidbody &, CppAttractRigidbody &, double ) CppAttractPairList(CppAttractRigidbody &, CppAttractRigidbody & ) - int Size() + int size() CppAtomPair operator[](int) @@ -82,10 +82,10 @@ cdef class AttractPairList: def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() def __getitem__(self, unsigned int i): - if i>=self.thisptr.Size(): + if i>=self.thisptr.size(): raise IndexError cdef CppAtomPair * catp = new CppAtomPair(deref(self.thisptr)[i]) atp = AtomPair() diff --git a/bindings/pdbio.pyx b/bindings/pdbio.pyx index 71741cf..0a472d5 100644 --- a/bindings/pdbio.pyx +++ b/bindings/pdbio.pyx @@ -3,18 +3,18 @@ from libcpp.string cimport string cdef extern from "pdbio.h" namespace "PTools": - cdef void CppWritePDB "PTools::WritePDB" (CppRigidbody&, string) + cdef void Cppwrite_pdb "PTools::write_pdb" (CppRigidbody&, string) cdef void CppReadAtom "PTools::readAtom" (string, CppAtom) except+ -def WritePDB(Rigidbody rig, bytes filename): +def write_pdb(Rigidbody rig, bytes filename): """writes a rigidbody object to a PDB file""" if rig is None: raise RuntimeError("expected Rigidbody, None given") cdef string cpp_filename = filename - CppWritePDB(deref(rig.thisptr), cpp_filename) + Cppwrite_pdb(deref(rig.thisptr), cpp_filename) def strToAtom(bytes line): diff --git a/bindings/rigidbody.pyx b/bindings/rigidbody.pyx index cc05b52..a6266f5 100644 --- a/bindings/rigidbody.pyx +++ b/bindings/rigidbody.pyx @@ -17,41 +17,41 @@ cdef extern from "rigidbody.h" namespace "PTools": CppRigidbody(string) except+ CppRigidbody() CppRigidbody(CppRigidbody &) - unsigned int Size() - CppCoord3D GetCoords(unsigned int) - void unsafeGetCoords(unsigned int, CppCoord3D &) - void SetCoords(unsigned int, CppCoord3D &) - void ABrotate(CppCoord3D &, CppCoord3D &, double) - void Translate(CppCoord3D &) - CppCoord3D FindCenter() - void syncCoords() - void AttractEulerRotate(double, double, double) - void ApplyMatrix(Array2D[double] &) - CppAtom CopyAtom(unsigned int) - void AddAtom(CppAtomproperty &, CppCoord3D) - void AddAtom(CppAtom &) - void SetAtom(unsigned int, CppAtom &) - string PrintPDB() + unsigned int size() + CppCoord3D get_coords(unsigned int) + void unsafeget_coords(unsigned int, CppCoord3D &) + void set_coords(unsigned int, CppCoord3D &) + void rotate(CppCoord3D &, CppCoord3D &, double) + void translate(CppCoord3D &) + CppCoord3D find_center() + void sync_coords() + void euler_rotate(double, double, double) + void apply_matrix(Array2D[double] &) + CppAtom copy_atom(unsigned int) + void add_atom(CppAtomproperty &, CppCoord3D) + void add_atom(CppAtom &) + void set_atom(unsigned int, CppAtom &) + string print_pdb() CppRigidbody operator+(CppRigidbody &) void CenterToOrigin() # Returns radius of gyration. - double RadiusGyration() + double radius_of_gyration() # Returns the radius of a Rigidbody (max distance from center). - double Radius() + double radius() - CppAtomproperty & GetAtomProperty(unsigned int) - void SetAtomProperty(unsigned int, CppAtomproperty &) + CppAtomproperty & get_atom_property(unsigned int) + void set_atom_property(unsigned int, CppAtomproperty &) # AtomSelection: - CppAtomSelection SelectAllAtoms() - CppAtomSelection SelectAtomType(string) - CppAtomSelection SelectResidType(string) - CppAtomSelection SelectChainId(string) - CppAtomSelection SelectResRange(int, int) - CppAtomSelection CA() - CppAtomSelection Backbone() + CppAtomSelection select_all_atoms() + CppAtomSelection select_atomtype(string) + CppAtomSelection select_restype(string) + CppAtomSelection select_chainid(string) + CppAtomSelection select_resid_range(int, int) + CppAtomSelection get_CA() + CppAtomSelection backbone() cdef extern from "pdbio.h" namespace "PTools": @@ -104,10 +104,10 @@ cdef class Rigidbody: self.thisptr = 0 def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() def __str__(self): - s = self.thisptr.PrintPDB() + s = self.thisptr.print_pdb() return s def __add__(Rigidbody self, Rigidbody other): @@ -122,9 +122,9 @@ cdef class Rigidbody: def size(self): return len(self) - def getCoords(self, unsigned int i): + def get_coords(self, unsigned int i): cdef Coord3D c = Coord3D() - cdef CppCoord3D cpp = self.thisptr.GetCoords(i) + cdef CppCoord3D cpp = self.thisptr.get_coords(i) c.x = cpp.x c.y = cpp.y c.z = cpp.z @@ -133,123 +133,123 @@ cdef class Rigidbody: def print_pdb(self): return str(self) - def unsafeGetCoords(self, unsigned int i, Coord3D co): - self.thisptr.unsafeGetCoords(i, deref(co.thisptr)) + def unsafeget_coords(self, unsigned int i, Coord3D co): + self.thisptr.unsafeget_coords(i, deref(co.thisptr)) - def setCoords(self, int i, Coord3D co): - self.thisptr.SetCoords(i, deref(co.thisptr)) + def set_coords(self, int i, Coord3D co): + self.thisptr.set_coords(i, deref(co.thisptr)) - def Translate(self, Coord3D tr): - self.thisptr.Translate(deref(tr.thisptr)) + def translate(self, Coord3D tr): + self.thisptr.translate(deref(tr.thisptr)) - def FindCenter(self): + def find_center(self): cdef Coord3D c = Coord3D() - cdef CppCoord3D cpp = self.thisptr.FindCenter() + cdef CppCoord3D cpp = self.thisptr.find_center() c.x = cpp.x c.y = cpp.y c.z = cpp.z return c - def ABrotate(self, Coord3D A, Coord3D B, double theta): - self.thisptr.ABrotate(deref(A.thisptr), deref(B.thisptr), theta) + def rotate(self, Coord3D A, Coord3D B, double theta): + self.thisptr.rotate(deref(A.thisptr), deref(B.thisptr), theta) return None - def AttractEulerRotate(self, double phi, double ssi, double rot): - self.thisptr.AttractEulerRotate(phi, ssi, rot) + def euler_rotate(self, double phi, double ssi, double rot): + self.thisptr.euler_rotate(phi, ssi, rot) - def syncCoords(self): - self.thisptr.syncCoords() + def sync_coords(self): + self.thisptr.sync_coords() def apply_matrix(self, Matrix mat): - self.thisptr.ApplyMatrix(deref(mat.thisptr)) + self.thisptr.apply_matrix(deref(mat.thisptr)) - def CopyAtom(self, unsigned int atid): - cdef CppAtom cpp_at = self.thisptr.CopyAtom(atid) + def copy_atom(self, unsigned int atid): + cdef CppAtom cpp_at = self.thisptr.copy_atom(atid) cdef Atom at = Atom() cdef CppAtom * cpp_dest = at.thisptr cy_copy_atom(& cpp_at, cpp_dest) return at - def AddAtom(self, Atom at): - self.thisptr.AddAtom(deref(at.thisptr)) + def add_atom(self, Atom at): + self.thisptr.add_atom(deref(at.thisptr)) - def SetAtom(self, unsigned int position, Atom at): - self.thisptr.SetAtom(position, deref(at.thisptr)) + def set_atom(self, unsigned int position, Atom at): + self.thisptr.set_atom(position, deref(at.thisptr)) - def GetAtomProperty(self, unsigned int position): - cdef CppAtomproperty cppatprop = self.thisptr.GetAtomProperty(position) + def get_atom_property(self, unsigned int position): + cdef CppAtomproperty cppatprop = self.thisptr.get_atom_property(position) cdef Atomproperty pyAtprop = Atomproperty() cdef CppAtomproperty * new_atomprop = new CppAtomproperty(cppatprop) del pyAtprop.thisptr pyAtprop.thisptr = new_atomprop return pyAtprop - def SetAtomProperty(self, unsigned int position, Atomproperty prop): + def set_atom_property(self, unsigned int position, Atomproperty prop): if position < 0 or position >= len(self): raise IndexError('atom index out of bounds') - self.thisptr.SetAtomProperty(position, deref(prop.thisptr)) + self.thisptr.set_atom_property(position, deref(prop.thisptr)) - def Radius(self): - return self.thisptr.Radius() + def radius(self): + return self.thisptr.radius() - def RadiusGyration(self): - return self.thisptr.RadiusGyration() + def radius_of_gyration(self): + return self.thisptr.radius_of_gyration() - def SelectAllAtoms(self): + def select_all_atoms(self): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.SelectAllAtoms() + cdef CppAtomSelection new_sel = self.thisptr.select_all_atoms() ret.thisptr = new CppAtomSelection(new_sel) return ret - def SelectAtomType(self, bytes b): + def select_atomtype(self, bytes b): ret = AtomSelection() del ret.thisptr cdef char * c_typename = b cdef string * cpp_atomtype = new string(c_typename) - cdef CppAtomSelection new_sel = self.thisptr.SelectAtomType(deref(cpp_atomtype)) + cdef CppAtomSelection new_sel = self.thisptr.select_atomtype(deref(cpp_atomtype)) del cpp_atomtype ret.thisptr = new CppAtomSelection(new_sel) return ret - def SelectResidType(self, bytes b): + def select_restype(self, bytes b): ret = AtomSelection() del ret.thisptr cdef char * c_typename = b cdef string * cpp_residtype = new string(c_typename) - cdef CppAtomSelection new_sel = self.thisptr.SelectResidType(deref(cpp_residtype)) + cdef CppAtomSelection new_sel = self.thisptr.select_restype(deref(cpp_residtype)) del cpp_residtype ret.thisptr = new CppAtomSelection(new_sel) return ret - def SelectChainId(self, bytes b): + def select_chainid(self, bytes b): ret = AtomSelection() del ret.thisptr cdef char * c_typename = b cdef string * cpp_chainid = new string(c_typename) - cdef CppAtomSelection new_sel = self.thisptr.SelectChainId(deref(cpp_chainid)) + cdef CppAtomSelection new_sel = self.thisptr.select_chainid(deref(cpp_chainid)) del cpp_chainid ret.thisptr = new CppAtomSelection(new_sel) return ret - def SelectResRange(self, int i, int j): + def select_resid_range(self, int i, int j): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.SelectResRange(i, j) + cdef CppAtomSelection new_sel = self.thisptr.select_resid_range(i, j) ret.thisptr = new CppAtomSelection(new_sel) return ret - def CA(self): + def get_CA(self): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.CA() + cdef CppAtomSelection new_sel = self.thisptr.get_CA() ret.thisptr = new CppAtomSelection(new_sel) return ret - def Backbone(self): + def backbone(self): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.Backbone() + cdef CppAtomSelection new_sel = self.thisptr.backbone() ret.thisptr = new CppAtomSelection(new_sel) return ret diff --git a/bindings/rmsd.pyx b/bindings/rmsd.pyx index 8c44944..e443f3d 100644 --- a/bindings/rmsd.pyx +++ b/bindings/rmsd.pyx @@ -1,9 +1,9 @@ cdef extern from "rmsd.h" namespace "PTools": - cdef double CppRmsd "PTools::Rmsd" (CppRigidbody& r1, CppRigidbody& r2) except +ValueError - cdef double CppRmsd "PTools::Rmsd" (CppAtomSelection & r1, CppAtomSelection& r2) except +ValueError + cdef double Cpprmsd "PTools::rmsd" (CppRigidbody& r1, CppRigidbody& r2) except +ValueError + cdef double Cpprmsd "PTools::rmsd" (CppAtomSelection & r1, CppAtomSelection& r2) except +ValueError -def Rmsd(r1, r2): +def rmsd(r1, r2): """calculates the RMSD between two objects (either Rigibody or AtomSelection). This function does NOT perform superposition before the calculation""" @@ -41,7 +41,7 @@ def Rmsd(r1, r2): del_er2 = True else: raise RuntimeError("second argument should be an AtomSelection or a Rigidbody") - rmsd = CppRmsd(deref(er1), deref(er2)) + rmsd = Cpprmsd(deref(er1), deref(er2)) if del_er1: del er1 @@ -52,7 +52,7 @@ def Rmsd(r1, r2): #cdef CppRigidbody* er1 = r1.thisptr #cdef CppRigidbody* er2 = r2.thisptr - #return CppRmsd(deref(er1), deref(er2)) + #return Cpprmsd(deref(er1), deref(er2)) \ No newline at end of file diff --git a/bindings/scorpion_lbfgs.pyx b/bindings/scorpion_lbfgs.pyx index 0ac2a22..61a6d31 100644 --- a/bindings/scorpion_lbfgs.pyx +++ b/bindings/scorpion_lbfgs.pyx @@ -5,9 +5,9 @@ cdef extern from "lbfgs_interface.h" namespace "PTools": cdef cppclass CppScorpionLbfgs "PTools::Lbfgs": CppScorpionLbfgs(CppScorpionForceField&) void minimize(int) - vector[double] GetMinimizedVars() - vector[double] GetMinimizedVarsAtIter(int) - int GetNumberIter() + vector[double] get_minimized_vars() + vector[double] get_minimized_vars_at_iter(int) + int get_number_iter() cdef class ScorpionLbfgs: @@ -25,18 +25,18 @@ cdef class ScorpionLbfgs: def minimize(self, int maxiter): self.thisptr.minimize(maxiter) - def GetMinimizedVars(self): - cdef vector[double] vars = self.thisptr.GetMinimizedVars() + def get_minimized_vars(self): + cdef vector[double] vars = self.thisptr.get_minimized_vars() out = [] for i in xrange(vars.size()): out.append(vars[i]) return out - def GetNumberIter(self): - return self.thisptr.GetNumberIter() + def get_number_iter(self): + return self.thisptr.get_number_iter() - def GetMinimizedVarsAtIter(self, int iter): - cdef vector[double] vars = self.thisptr.GetMinimizedVarsAtIter(iter) + def get_minimized_vars_at_iter(self, int iter): + cdef vector[double] vars = self.thisptr.get_minimized_vars_at_iter(iter) out = [] for i in xrange(vars.size()): out.append(vars[i]) diff --git a/bindings/scorpionforcefield.pyx b/bindings/scorpionforcefield.pyx index 0be6502..c05c955 100644 --- a/bindings/scorpionforcefield.pyx +++ b/bindings/scorpionforcefield.pyx @@ -5,9 +5,9 @@ from libcpp.string cimport string cdef extern from "scorpionforcefield.h" namespace "PTools": cdef cppclass CppScorpionForceField "PTools::ScorpionForceField": CppScorpionForceField(string&, double) - void AddLigand(CppAttractRigidbody&) + void addLigand(CppAttractRigidbody&) double Function(vector[double]&) - double getVdw() + double get_vdw() double getCoulomb() double nonbon8(CppAttractRigidbody& , CppAttractRigidbody& , CppAttractPairList & , int) @@ -29,8 +29,8 @@ cdef class ScorpionForceField: def __dealloc__(self): del self.thisptr - def AddLigand(self, AttractRigidbody rig): - self.thisptr.AddLigand(deref( rig.thisptr)) + def addLigand(self, AttractRigidbody rig): + self.thisptr.addLigand(deref( rig.thisptr)) def Function(self, vec): cdef vector[double] v @@ -39,8 +39,8 @@ cdef class ScorpionForceField: return self.thisptr.Function(v) - def getVdw(self): - return self.thisptr.getVdw() + def get_vdw(self): + return self.thisptr.get_vdw() def getCoulomb(self): return self.thisptr.getCoulomb() diff --git a/bindings/superpose.pyx b/bindings/superpose.pyx index 99317a4..d818007 100644 --- a/bindings/superpose.pyx +++ b/bindings/superpose.pyx @@ -1,7 +1,7 @@ cdef extern from "superpose.h" namespace "PTools": cdef cppSuperpose_t cppsuperpose "PTools::superpose" ( CppRigidbody& ,CppRigidbody& , int ) - cdef CppScrew cppMatTrans2screw "PTools::MatTrans2screw" ( Array2D[double]& ) except + + cdef CppScrew cppmat44_to_screw "PTools::mat44_to_screw" ( Array2D[double]& ) except + cdef extern from "screw.h" namespace "PTools": @@ -67,8 +67,8 @@ def superpose(Rigidbody ref, Rigidbody mob, int verbosity=0): return pysup -def MatTrans2screw(Matrix mat): - cpp_screw = cppMatTrans2screw(deref(mat.thisptr)) +def mat44_to_screw(Matrix mat): + cpp_screw = cppmat44_to_screw(deref(mat.thisptr)) screw = Screw() screw.angle = cpp_screw.angle screw.normtranslation = cpp_screw.normtranslation diff --git a/bindings/surface.pyx b/bindings/surface.pyx index 5394c33..94dc817 100644 --- a/bindings/surface.pyx +++ b/bindings/surface.pyx @@ -6,9 +6,9 @@ cdef extern from "surface.h" namespace "PTools": cdef cppclass CppSurface "PTools::Surface": CppSurface(int, int , string ) CppRigidbody surfpoint(CppRigidbody & , double) - void surfpointParams(int, double) + void surfpoint_params(int, double) CppRigidbody outergrid(CppRigidbody &, CppRigidbody & , double) - CppRigidbody removeclosest(CppRigidbody & , double) + CppRigidbody remove_closest(CppRigidbody & , double) void readsolvparam(string) @@ -33,8 +33,8 @@ cdef class Surface: ret.thisptr = new CppRigidbody(r) return ret - def surfpointParams(self, int max, double shift): - self.thisptr.surfpointParams(max, shift) + def surfpoint_params(self, int max, double shift): + self.thisptr.surfpoint_params(max, shift) def outergrid(self, Rigidbody rigid1, Rigidbody rigid2, double srad): cdef CppRigidbody r = self.thisptr.outergrid(deref(rigid1.thisptr), deref(rigid2.thisptr), srad) @@ -43,8 +43,8 @@ cdef class Surface: ret.thisptr = new CppRigidbody(r) return ret - def removeclosest(self, Rigidbody rigid1, double srad): - cdef CppRigidbody r = self.thisptr.removeclosest(deref(rigid1.thisptr), srad) + def remove_closest(self, Rigidbody rigid1, double srad): + cdef CppRigidbody r = self.thisptr.remove_closest(deref(rigid1.thisptr), srad) ret = Rigidbody() del ret.thisptr ret.thisptr = new CppRigidbody(r) diff --git a/docs/source/conf.py b/docs/source/conf.py index 5dbf004..ead6f15 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -42,11 +42,11 @@ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' -# Add any Sphinx extension module names here, as strings. They can be +# add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] -# Add any paths that contain templates here, relative to this directory. +# add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. @@ -124,7 +124,7 @@ # documentation. #html_theme_options = {} -# Add any paths that contain custom themes here, relative to this directory. +# add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to @@ -144,7 +144,7 @@ # 16x16 or 32x32 pixels large. #html_favicon = None -# Add any paths that contain custom static files (such as style sheets) +# add any paths that contain custom static files (such as style sheets) # here, relative to this directory. They are copied after the builtin # static files, so a file named "default.css" will overwrite the builtin # "default.css". @@ -161,7 +161,7 @@ # Custom sidebar templates, maps document names to template names. #html_sidebars = {} -# Additional templates that should be rendered to pages, maps page names +# additional templates that should be rendered to pages, maps page names # to template names. #html_additional_pages = {} @@ -206,7 +206,7 @@ # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. + # additional stuff for the LaTeX preamble. #'preamble': '', } diff --git a/headers/BasePair.h b/headers/BasePair.h index 5bbae60..4641a01 100644 --- a/headers/BasePair.h +++ b/headers/BasePair.h @@ -23,52 +23,52 @@ namespace PTools virtual ~BasePair() {} ///return a string containing the atoms data following the PDB format - std::string PrintPDB() const; + std::string print_pdb() const; ///return a string containing the atoms data of a base (identified by its chain) following the PDB format - std::string PrintPDBofBase(std::string chain) ; + std::string print_pdbofBase(std::string chain) ; ///change the chainID of the internal bases to 'A' for the first base (coresponding to the type) and 'B' for the second one void SetChainID(); /// apply a Movement to the BasePair - void Apply(const Movement& ); + void apply(const Movement& ); /// apply a Matrix to the BasePair - void Apply(const Matrix&); + void apply(const Matrix&); /// return the Matrix of the BasePair - Matrix GetMatrix()const; + Matrix get_matrix()const; /// return the Movemeny of the BasePair Movement GetMovement()const; /// return the Rigidbody of the BasePair - Rigidbody GetRigidBody()const; + Rigidbody get_rigid()const; /// return the Rigidbody of the specified base (by chain) - Rigidbody GetRigidBodyOfBase(std::string chain); + Rigidbody get_rigidOfBase(std::string chain); /// define the Rigidbody of the BasePair - void SetRigidBody(const Rigidbody&); + void set_rigidBody(const Rigidbody&); /// return the Residue ID of the specified base (by chain) uint GetResIDofBase(std::string chain); /// change the ID of res to idA for base on strand A and idB for the one on strand B void SetResID(int idA,int idB); /// change the atoms numbers of the specified base (by chain) starting at startnum and returning the last atom number - uint SetAtomNumberOfBase(std::string chain,int); + uint set_atomNumberOfBase(std::string chain,int); - std::string GetType() const; + std::string get_type() const; void SetType(std::string type); ///return the number of Atom - unsigned int Size() const { return rigbody.Size(); } + unsigned int size() const { return rigbody.size(); } /// return the i-th Atom of the basePair Atom operator[] (uint i) const { - if (i>=this->Size()) throw std::range_error("DNA: array out of bounds"); - return rigbody.CopyAtom(i);}; + if (i>=this->size()) throw std::range_error("DNA: array out of bounds"); + return rigbody.copy_atom(i);}; private: //atribut diff --git a/headers/DNA.h b/headers/DNA.h index a5b0fba..1870c43 100644 --- a/headers/DNA.h +++ b/headers/DNA.h @@ -26,41 +26,41 @@ namespace PTools ///return the number of BasePair - unsigned int Size() const; + unsigned int size() const; ///return the number of Atom - unsigned int AtomSize() const; + unsigned int Atomsize() const; ///return a string containing the atoms data following the PDB format - std::string PrintPDB() ; + std::string print_pdb() ; ///return a string containing the atoms data following the PDB format - std::string PrintPDBofStrand( std::string chain ); + std::string print_pdbofStrand( std::string chain ); ///return a string containing all the local parameter formated - std::string PrintParam(); + std::string print_param(); ///write in a file the atoms data following the PDB format - void WritePDB(std::string); + void write_pdb(std::string); ///change the database use for the BasePair. the new database must contain the same names for pdb that the old one. - void ChangeRepresentation(std::string); + void change_representation(std::string); ///apply a Matrix/Movement to a specified BasePair. you can specify an anchor - void ApplyLocal(const Matrix&,int posMov, int posAnchor = 0); - void ApplyLocal(const Movement&,int posMov, int posAnchor = 0); + void apply_local(const Matrix&,int posMov, int posAnchor = 0); + void apply_local(const Movement&,int posMov, int posAnchor = 0); ///apply a Matrix/Movement to all the BasePairs and reposition the DNA according to the anchor - void ApplyGlobal(const Matrix&,int posAnchor); - void ApplyGlobal(const Movement&,int posAnchor); + void applyGlobal(const Matrix&,int posAnchor); + void applyGlobal(const Movement&,int posAnchor); ///apply a Matrix/Movement to the DNA as a rigidbody - void Apply(const Matrix&); - void Apply(const Movement&); + void apply(const Matrix&); + void apply(const Movement&); ///apply a vector to the DNA as a rigidbody - void Translate(Coord3D coord); + void translate(Coord3D coord); ///return the local Matrix of the specified BasePair (for the position i the Matrix to go from i-1 to i) Matrix GetLocalMatrix(int pos)const; @@ -68,9 +68,9 @@ namespace PTools Parameter GetLocalParameter(int pos); ///return a Rigidbody of the DNA() - Rigidbody CreateRigid(); + Rigidbody create_rigid(); ///return a Rigidbody of the strand - Rigidbody CreateRigidOfStrand(std::string chain); + Rigidbody create_rigidOfStrand(std::string chain); //replace the base pair at the indicated position by the new base pair @@ -78,28 +78,28 @@ namespace PTools /// return the RMSD between two DNA (not aligning them and assuming they are comparable) - double Rmsd(const DNA&)const; + double rmsd(const DNA&)const; ///------edition functions------ /// return the i-th BasePair of the strand BasePair operator[] (uint i) const { - if (i>=this->Size()) throw std::range_error("DNA: array out of bounds"); + if (i>=this->size()) throw std::range_error("DNA: array out of bounds"); return strand[i];}; /// add the basePairs of a DNA to the strand of this DNA. the specified movement do the liason betwen the two strand - void Add(const DNA & d, const Movement & mov = BDNA()); + void add(const DNA & d, const Movement & mov = BDNA()); /// add a basepair at the end of the strand of this DNA - void Add(BasePair bp, const Movement & mov = BDNA()); + void add(BasePair bp, const Movement & mov = BDNA()); ///return the specified subDNA - DNA SubDNA(uint start, uint end)const; + DNA subDNA(uint start, uint end)const; ///replace the basePair of this DNA by the basePair of a given DNA starting from a given position to the end of one of the DNAs void Replace(const DNA & d,int start); ///change the type of the base pair at position pos to the indicated type using the coresponding structure in the designed database of pdb. - void ChangeType(int pos, std::string type, std::string filename ); + void change_type(int pos, std::string type, std::string filename ); @@ -115,15 +115,15 @@ namespace PTools ///construct the strand from the sequence, the chain Ids and a corresponding vector of Rigidbody void BuildStrand(std::string,std::string,const std::vector &); /// apply an initial Movement during the initialisation of the DNA - void ApplyInitialMov(const Movement&); + void applyInitialMov(const Movement&); ///rebuild the DNA from a specified position. useful for taking into account a change in a base. Matrix Reconstruct(int pos,const Matrix&); ///give the BasePair a correct number according to they rank in the strand void ChangeFormat(); ///apply a Movement to a specified BasePair. - void ApplylocalMov(const Movement&,int pos); + void applylocalMov(const Movement&,int pos); ///apply a Movement to all the BasePairs - void ApplyglobalMov(const Movement& ); + void applyglobalMov(const Movement& ); ///reposition the DNA according to the anchor void Relocate(const BasePair& anchor,int posAnchor); diff --git a/headers/Movement.h b/headers/Movement.h index 2c90794..dafbf0a 100644 --- a/headers/Movement.h +++ b/headers/Movement.h @@ -27,16 +27,16 @@ namespace PTools Movement operator+ (const Movement&) const; /// apply the Matrix to a Rigidbody - void Apply(Rigidbody& rigbody)const; + void apply(Rigidbody& rigbody)const; ///return the Matrix - const Matrix& GetMatrix() const; + const Matrix& get_matrix() const; ///print the Matrix void Print() const; /// Return a string representing the Movement' matrix. - std::string toString() const; + std::string to_string() const; }; //fonction pour les matrices, a relocaliser dans la partie ptools adapter diff --git a/headers/atom.h b/headers/atom.h index fcd7830..48712cb 100644 --- a/headers/atom.h +++ b/headers/atom.h @@ -79,22 +79,22 @@ struct Atom : public Atomproperty std::string ToString() const; /// convert atom (properties and coordinates) to classical PDB-like string - std::string ToPdbString() const ; + std::string to_pdb_string() const ; /// translation of an atom - void Translate(const Coord3D& tr); + void translate(const Coord3D& tr); }; /// distance between two atoms -inline dbl Dist(const Atom& at1, const Atom& at2) +inline dbl dist(const Atom& at1, const Atom& at2) { return Norm(at1.coords-at2.coords); } /// distance**2 between two atoms -inline dbl Dist2(const Atom& at1, const Atom& at2) +inline dbl dist2(const Atom& at1, const Atom& at2) { return Norm2(at1.coords - at2.coords ); } diff --git a/headers/atomselection.h b/headers/atomselection.h index b137c57..cdbfe1a 100644 --- a/headers/atomselection.h +++ b/headers/atomselection.h @@ -30,17 +30,17 @@ class AtomSelection{ AtomSelection(const Rigidbody& rigid); ///< translate a Rigidbody object into an AtomSelection ~AtomSelection(); - uint Size() const {return m_list.size();}; ///< returns the size of the selection - void SetRigid(const Rigidbody& rig) {m_rigid=&rig;}; + uint size() const {return m_list.size();}; ///< returns the size of the selection + void set_rigid(const Rigidbody& rig) {m_rigid=&rig;}; /// return the i-th atom of the list Atom operator[] (uint i) const { - if (i>=this->Size()) throw std::range_error("AtomSelection: array out of bounds"); - return m_rigid->CopyAtom(m_list[i]);}; + if (i>=this->size()) throw std::range_error("AtomSelection: array out of bounds"); + return m_rigid->copy_atom(m_list[i]);}; - Atom CopyAtom(uint i) const {return m_rigid->CopyAtom(m_list[i]);} - void AddAtomIndex(int i) {m_list.push_back(i);}; ///< adds an Atom index - Rigidbody CreateRigid(); ///< makes a new rigid copy (independant copy) from an AtomsSelection object. + Atom copy_atom(uint i) const {return m_rigid->copy_atom(m_list[i]);} + void add_atomIndex(int i) {m_list.push_back(i);}; ///< adds an Atom index + Rigidbody create_rigid(); ///< makes a new rigid copy (independant copy) from an AtomsSelection object. AtomSelection non(const AtomSelection& atsel); diff --git a/headers/attractforcefield.h b/headers/attractforcefield.h index 76c35a4..476bd23 100644 --- a/headers/attractforcefield.h +++ b/headers/attractforcefield.h @@ -23,11 +23,11 @@ class BaseAttractForceField: public ForceField virtual void initMinimization(); ///analytical derivative void Derivatives(const Vdouble&, Vdouble&); - uint ProblemSize(); + uint Problemsize(); dbl Function(const Vdouble&); ///add a new ligand to the ligand list... - void AddLigand(AttractRigidbody & lig); + void addLigand(AttractRigidbody & lig); ///after a minimization, get minimized ligand 'i' AttractRigidbody GetLigand(uint i); @@ -38,8 +38,8 @@ class BaseAttractForceField: public ForceField ///non-bonded interactions virtual dbl nonbon8(AttractRigidbody& rec, AttractRigidbody& lig, AttractPairList & pairlist, bool print=false) { - std::vector forcesrec (rec.Size()); - std::vector forceslig (lig.Size()); + std::vector forcesrec (rec.size()); + std::vector forceslig (lig.size()); dbl ener = nonbon8_forces(rec, lig, pairlist, forcesrec, forceslig, print); rec.addForces(forcesrec); @@ -60,7 +60,7 @@ class BaseAttractForceField: public ForceField void Rota(uint molIndex, dbl phi, dbl ssi, dbl rot, Vdouble& delta, uint shift, bool print=false); ///return van der waals energy - dbl getVdw(){return m_vdw;} + dbl get_vdw(){return m_vdw;} ///coulomb (electrostatic) energy dbl getCoulomb(){return m_elec;} @@ -134,7 +134,7 @@ class TestForceField: public ForceField //virtual dbl Function() {return 0.0;}; - virtual uint ProblemSize(){ + virtual uint Problemsize(){ return 2; }; diff --git a/headers/attractrigidbody.h b/headers/attractrigidbody.h index e014ae2..b465bdd 100644 --- a/headers/attractrigidbody.h +++ b/headers/attractrigidbody.h @@ -68,7 +68,7 @@ class AttractRigidbody: public Rigidbody void resetForces() { - m_forces = std::vector (this->Size() ) ; + m_forces = std::vector (this->size() ) ; } void addForces(const std::vector& forces) @@ -78,8 +78,8 @@ class AttractRigidbody: public Rigidbody } - void setRotation(bool value) {hasrotation = value;} ///< allow/disallow rotation - void setTranslation(bool value) {hastranslation = value;} ///< allow/disallow translation + void set_rotation(bool value) {hasrotation = value;} ///< allow/disallow rotation + void set_translation(bool value) {hastranslation = value;} ///< allow/disallow translation void setDummyTypes(const std::vector& dummy); ///< set a list of ignored atom types diff --git a/headers/basetypes.h b/headers/basetypes.h index a6822e8..b009108 100644 --- a/headers/basetypes.h +++ b/headers/basetypes.h @@ -180,7 +180,7 @@ class Array2D } ///get size of the array - std::pair getDim() const + std::pair get_dim() const { std::pair out; out.first = m_rows; diff --git a/headers/coord3d.h b/headers/coord3d.h index c09d26d..347b978 100644 --- a/headers/coord3d.h +++ b/headers/coord3d.h @@ -24,7 +24,7 @@ struct Coord3D inline bool operator==(const Coord3D& b) {return (b.x==x && b.y==y && b.z==z); }; Coord3D& Normalize(); ///< Normalize vector to unity (in place) - std::string toString(bool newline=true); + std::string to_string(bool newline=true); }; diff --git a/headers/coordsarray.h b/headers/coordsarray.h index 22b0dae..0b26c37 100644 --- a/headers/coordsarray.h +++ b/headers/coordsarray.h @@ -78,7 +78,7 @@ class CoordsArray _uptodate = true; //modify the function pointer _getcoords to call the "unsafe" method next time (faster) - _getcoords = & CoordsArray::unsafeGetCoords; + _getcoords = & CoordsArray::unsafeget_coords; (*this.* _getcoords)(i, co); //return the correct function }; @@ -92,27 +92,27 @@ class CoordsArray CoordsArray(const CoordsArray & ca); //copy constructor /// get the cached coordinates. You must ensure that update() has been called first ! - void inline unsafeGetCoords(const uint i, Coord3D& co) const { co = _movedcoords[i];}; + void inline unsafeget_coords(const uint i, Coord3D& co) const { co = _movedcoords[i];}; - void AddCoord(const Coord3D& co) {_refcoords.push_back(co); _movedcoords.push_back(co); _modified(); }; - uint Size() const {return _refcoords.size();}; + void add_coord(const Coord3D& co) {_refcoords.push_back(co); _movedcoords.push_back(co); _modified(); }; + uint size() const {return _refcoords.size();}; - void GetCoords(const uint i, Coord3D& co) const throw(std::out_of_range) ; + void get_coords(const uint i, Coord3D& co) const throw(std::out_of_range) ; - void SetCoords(const uint k, const Coord3D& co); + void set_coords(const uint k, const Coord3D& co); - /// Translate the whole object - void Translate(const Coord3D& tr); + /// translate the whole object + void translate(const Coord3D& tr); /// Euler Rotation - void AttractEulerRotate(dbl phi, dbl ssi, dbl rot); + void euler_rotate(dbl phi, dbl ssi, dbl rot); void ResetMatrix(); - std::string PrintMatrix() const; + std::string print_matrix() const; ///return the rotation/translation matrix - Matrix GetMatrix() const; + Matrix get_matrix() const; diff --git a/headers/forcefield.h b/headers/forcefield.h index f47408a..cad68fe 100644 --- a/headers/forcefield.h +++ b/headers/forcefield.h @@ -35,7 +35,7 @@ class ForceField virtual void NumDerivatives(const Vdouble& StateVars, Vdouble& delta, bool print=false); ///size of the problem (number of variables the minimizer must optimize) - virtual uint ProblemSize()=0; + virtual uint Problemsize()=0; ///this function is called at the beginning of a minimization, by the minimizer (Lbfgs) virtual void initMinimization()=0; diff --git a/headers/geometry.h b/headers/geometry.h index 7a33180..e38b67b 100644 --- a/headers/geometry.h +++ b/headers/geometry.h @@ -26,7 +26,7 @@ inline void mat44xVect(const dbl mat[ 4 ][ 4 ], const Coord3D& vect, Coord3D& ou void mat44xrigid(const Rigidbody& source, Rigidbody& result, dbl mat[4][4]); -void ABrotate(Coord3D A, Coord3D B, Rigidbody& target, dbl theta); +void rotate(Coord3D A, Coord3D B, Rigidbody& target, dbl theta); // void EulerZYZ(const Rigidbody & source, Rigidbody & cible, dbl theta, dbl phi, dbl psi); // void AttractEuler(const Rigidbody& source, Rigidbody& dest, dbl phi, dbl ssi, dbl rot); diff --git a/headers/lbfgs_interface.h b/headers/lbfgs_interface.h index a149275..ac28810 100644 --- a/headers/lbfgs_interface.h +++ b/headers/lbfgs_interface.h @@ -23,10 +23,10 @@ class Lbfgs Lbfgs(ForceField& toMinim); ~Lbfgs(); void minimize(int maxiter); - std::vector GetMinimizedVars() const {return x;}; + std::vector get_minimized_vars() const {return x;}; - std::vector GetMinimizedVarsAtIter(uint iter); - int GetNumberIter() {return m_opt->niter;} + std::vector get_minimized_vars_at_iter(uint iter); + int get_number_iter() {return m_opt->niter;} diff --git a/headers/mcopff.h b/headers/mcopff.h index 4e5048a..ab40cee 100644 --- a/headers/mcopff.h +++ b/headers/mcopff.h @@ -24,20 +24,20 @@ std::vector _copies; public: /* - void AttractEulerRotate(const dbl& phi, const dbl& ssi, const dbl& rot) + void euler_rotate(const dbl& phi, const dbl& ssi, const dbl& rot) { for (uint i=0; i<_copies.size(); i++) { - _copies[i].AttractEulerRotate(phi, ssi, rot); + _copies[i].euler_rotate(phi, ssi, rot); } }; - void Translate(const Coord3D& co) + void translate(const Coord3D& co) { for(uint i =0; i< _copies.size(); ++i) { - _copies[i].Translate(co); + _copies[i].translate(co); } }*/ @@ -67,8 +67,8 @@ class Mcoprigid //multicopy rigidbody void addEnsemble(const Region& reg){ _vregion.push_back(reg); std::vector v; _weights.push_back(v); }; - void AttractEulerRotate(const dbl& phi, const dbl& ssi, const dbl& rot); - void Translate(const Coord3D& c); + void euler_rotate(const dbl& phi, const dbl& ssi, const dbl& rot); + void translate(const Coord3D& c); void PrintWeights(); @@ -114,7 +114,7 @@ class McopForceField: public ForceField void calculate_weights(Mcoprigid& lig, bool print=false); - uint ProblemSize() {return 6;}; + uint Problemsize() {return 6;}; void initMinimization(){}; private: diff --git a/headers/pairlist.h b/headers/pairlist.h index 91d1dda..dbabfd4 100644 --- a/headers/pairlist.h +++ b/headers/pairlist.h @@ -36,7 +36,7 @@ class AttractPairList ///update pairlist void update(); - ///< Add a pair and checks if correct ligand and receptor are provided + ///< add a pair and checks if correct ligand and receptor are provided void addPair(const AttractRigidbody& ligand, const AttractRigidbody& receptor, const AtomPair& pair) ; ///return the current cutoff @@ -45,7 +45,7 @@ class AttractPairList }; ///return number of pairs of atoms in interaction (distance <= cutoff) - uint Size() { + uint size() { return vectl.size(); }; diff --git a/headers/pdbio.h b/headers/pdbio.h index 7d76d00..6fb0b9a 100644 --- a/headers/pdbio.h +++ b/headers/pdbio.h @@ -19,7 +19,7 @@ namespace PTools void readAtom(const std::string & line, Atom& at); ///< create an Atom from a PDB-formatted string void ReadPDB(std::istream& fichier,Rigidbody& protein ); ///< read a PDB file from a file pointer and load data in Rigidbody void ReadPDB(const std::string name,Rigidbody& protein ); ///< read a PDB file from a filename and load data in Rigidbody -void WritePDB(const Rigidbody& rigid, std::string filename); ///< write a PDB file given a Rigidbody and a filename +void write_pdb(const Rigidbody& rigid, std::string filename); ///< write a PDB file given a Rigidbody and a filename } diff --git a/headers/rigidbody.h b/headers/rigidbody.h index 3617afe..f20bd50 100644 --- a/headers/rigidbody.h +++ b/headers/rigidbody.h @@ -52,7 +52,7 @@ class Rigidbody:private CoordsArray std::vector mForces; ///< forces for each atom std::string _description; ///< some string to describe the molecule -// bool isBackbone(const std::string & atomtype); /// mAtomProp; ///< array of atom properties @@ -69,124 +69,124 @@ class Rigidbody:private CoordsArray virtual ~Rigidbody(){}; /// return number of atoms in the rigidbody - uint Size() const {return CoordsArray::Size();}; + uint size() const {return CoordsArray::size();}; - void PrintMatrix() const {std::cout << CoordsArray::PrintMatrix() << std::endl; } + void print_matrix() const {std::cout << CoordsArray::print_matrix() << std::endl; } /// make a deep copy of one atom (the atom extracted is then totally independent) - virtual Atom CopyAtom(uint i) const ; + virtual Atom copy_atom(uint i) const ; /* /// const version of GetAtom*/ /*Atom GetAtom(uint pos) const { Coord3D co; - CoordsArray::GetCoords(pos, co); + CoordsArray::get_coords(pos, co); Atom at(mAtomProp[pos], co ); return at; }*/ /// return atom properties - Atomproperty const & GetAtomProperty(uint pos) const + Atomproperty const & get_atom_property(uint pos) const { return mAtomProp[pos]; } /// define atom properties - void SetAtomProperty(uint pos, const Atomproperty& atprop) + void set_atom_property(uint pos, const Atomproperty& atprop) { mAtomProp[pos] = atprop; } /// define atom pos - void SetAtom(uint pos, const Atom& atom); + void set_atom(uint pos, const Atom& atom); /// add an atom to the molecule (deep copy) - void AddAtom(const Atomproperty& at, Coord3D co); + void add_atom(const Atomproperty& at, Coord3D co); /// add an atom to the molecule - void AddAtom(const Atom& at); + void add_atom(const Atom& at); //returns the coordinates of atom i - Coord3D GetCoords(uint i) const + Coord3D get_coords(uint i) const { - assert(i 1: print("Working on translations group {:d} of {:d}".format(args.ngroup, args.ngroups)) translations = docking.get_group(translations, args.ngroups, args.ngroup) diff --git a/ptools/commands/heligeom_cmd.py b/ptools/commands/heligeom_cmd.py index 650c5aa..cfe0bd0 100644 --- a/ptools/commands/heligeom_cmd.py +++ b/ptools/commands/heligeom_cmd.py @@ -77,14 +77,14 @@ def check_args(args): def distance(a, b): """Calculate the distance between two ptools.Coord3D.""" - return ptools.norm(ptools.crossproduct(a, b)) + return ptools.norm(ptools.cross_product(a, b)) def distAxis(rig, hp): """Return the minimal and maximal distances between the axis and the rigid body.""" natoms = len(rig) - all_distances = [distance(rig.getCoords(i) - hp.point, hp.unitVector) + all_distances = [distance(rig.get_coords(i) - hp.point, hp.unitVector) for i in xrange(0, natoms)] return min(all_distances), max(all_distances) @@ -94,9 +94,9 @@ def getpstart(start, hp, dmin, dmax): # position of the sphere point ap = ptools.Atomproperty() m1 = start - cm = m1.FindCenter() + cm = m1.find_center() v = cm - hp.point - s = ptools.dotproduct(v, hp.unitVector) + s = ptools.dot_product(v, hp.unitVector) p = (hp.point + hp.unitVector * s) # normal to the axis that contains the center of mass of the monomer @@ -111,17 +111,17 @@ def getpstart(start, hp, dmin, dmax): pgroove = pmid + (hp.unitVector * (pitch / 2)) pstart = ptools.Rigidbody() - pstart.AddAtom(ptools.Atom(ap, pgroove)) + pstart.add_atom(ptools.Atom(ap, pgroove)) return pstart def getpart(groove, n, nbmono): inf = ptools.Rigidbody() for i in xrange(n - 1, n + 3): - inf = inf + groove.SelectChainId(string.ascii_uppercase[i % 26]).CreateRigid() + inf = inf + groove.select_chainid(string.ascii_uppercase[i % 26]).create_rigid() sup = ptools.Rigidbody() for i in xrange(n - 2 + nbmono, n + 2 + nbmono): - sup = sup + groove.SelectChainId(string.ascii_uppercase[i % 26]).CreateRigid() + sup = sup + groove.select_chainid(string.ascii_uppercase[i % 26]).create_rigid() return inf, sup @@ -133,7 +133,7 @@ def groove_width_calculation(hp, mono1): O = hp.point axe = hp.unitVector groove = extend(hp, mono1, nbmono * 3, False, False) - start = groove.SelectChainId(string.ascii_uppercase[n]).CreateRigid() + start = groove.select_chainid(string.ascii_uppercase[n]).create_rigid() dmin, dmax = distAxis(mono1, hp) nb = 0 @@ -141,27 +141,27 @@ def groove_width_calculation(hp, mono1): for i in xrange(n, end): # gen point inf, sup = getpart(groove, i, nbmono) - infSize = inf.size() - supSize = sup.size() + infsize = inf.size() + supsize = sup.size() nbpoint = abs(int(math.degrees(hp.angle)) * 2) for j in xrange(nbpoint): ldist = [] - start.ABrotate(O, O + axe, hp.angle / nbpoint) - start.Translate(axe * hp.normtranslation / nbpoint) + start.rotate(O, O + axe, hp.angle / nbpoint) + start.translate(axe * hp.normtranslation / nbpoint) for k in xrange(int(round(dmin + (dmax - dmin) / 2)), int(round(dmax))): pstart = getpstart(start, hp, k, k) # get the min dist on the inferior part - mindistinf = ptools.Dist(pstart.CopyAtom(0), inf.CopyAtom(0)) - for k in xrange(1, infSize): - tempdist = ptools.Dist(pstart.CopyAtom(0), inf.CopyAtom(k)) + mindistinf = ptools.dist(pstart.copy_atom(0), inf.copy_atom(0)) + for k in xrange(1, infsize): + tempdist = ptools.dist(pstart.copy_atom(0), inf.copy_atom(k)) if tempdist < mindistinf: mindistinf = tempdist # the same on the superior part - mindistsup = ptools.Dist(pstart.CopyAtom(0), sup.CopyAtom(0)) - for k in xrange(1, supSize): - tempdist = ptools.Dist(pstart.CopyAtom(0), sup.CopyAtom(k)) + mindistsup = ptools.dist(pstart.copy_atom(0), sup.copy_atom(0)) + for k in xrange(1, supsize): + tempdist = ptools.dist(pstart.copy_atom(0), sup.copy_atom(k)) if tempdist < mindistsup: mindistsup = tempdist # get the two point on the vector and take the mid size @@ -174,15 +174,15 @@ def groove_width_calculation(hp, mono1): def changeChain(rig, letter): rsize = rig.size() for i in xrange(0, rsize): - at = rig.GetAtomProperty(i) + at = rig.get_atom_property(i) at.chainId = letter - rig.SetAtomProperty(i, at) + rig.set_atom_property(i, at) return rig def extend(hp, mono1, nb, Z=False, seq=False): final = ptools.Rigidbody() - monoTest = mono1.SelectAllAtoms().CreateRigid() + monoTest = mono1.select_all_atoms().create_rigid() i = 0 O = hp.point axe = hp.unitVector @@ -193,13 +193,13 @@ def extend(hp, mono1, nb, Z=False, seq=False): Zaxis = ptools.Rigidbody() O = ptools.Coord3D(0, 0, 0) - Zaxis.AddAtom(ptools.Atom(at, O)) + Zaxis.add_atom(ptools.Atom(at, O)) axe = ptools.Coord3D(0, 0, 1) - Zaxis.AddAtom(ptools.Atom(at, ptools.Coord3D(0, 0, 1))) + Zaxis.add_atom(ptools.Atom(at, ptools.Coord3D(0, 0, 1))) Protaxis = ptools.Rigidbody() - Protaxis.AddAtom(ptools.Atom(at, hp.point)) - Protaxis.AddAtom(ptools.Atom(at, hp.point + hp.unitVector.Normalize())) + Protaxis.add_atom(ptools.Atom(at, hp.point)) + Protaxis.add_atom(ptools.Atom(at, hp.point + hp.unitVector.Normalize())) # 2 superpose and get matrix m = ptools.superpose(Zaxis, Protaxis).matrix # 3 apply matrix to rigidbody @@ -212,8 +212,8 @@ def extend(hp, mono1, nb, Z=False, seq=False): print(final.print_pdb()) i += 1 for j in xrange(nb - 1): - monoTest.ABrotate(O, O + axe, hp.angle) - monoTest.Translate(axe * hp.normtranslation) + monoTest.rotate(O, O + axe, hp.angle) + monoTest.translate(axe * hp.normtranslation) monoTest = changeChain(monoTest, string.ascii_uppercase[i % 26]) if seq: print(monoTest.print_pdb()) @@ -228,7 +228,7 @@ def heliAnalyze(mono1, mono2, doprint=True): def coord3d_to_str(v): return '{:6.2f}{:8.2f}{:8.2f}'.format(v.x, v.y, v.z) - hp = ptools.MatTrans2screw(ptools.superpose(mono2, mono1).matrix) + hp = ptools.mat44_to_screw(ptools.superpose(mono2, mono1).matrix) if doprint: dmin, dmax = distAxis(mono1, hp) @@ -263,7 +263,7 @@ def heliConstruct(mono1, hp, N, Z=False, seq=False, writefile=None): else: if writefile is not None: # Write to file with name provided - ptools.WritePDB(final, writefile) + ptools.write_pdb(final, writefile) return final diff --git a/ptools/commands/reduce_cmd.py b/ptools/commands/reduce_cmd.py index 1056ffc..05bc690 100644 --- a/ptools/commands/reduce_cmd.py +++ b/ptools/commands/reduce_cmd.py @@ -112,7 +112,7 @@ def run(args): ptools.io.check_file_exists(convname) ptools.io.check_file_exists(atomicname) - reducer = ptools.reduce.Reducer(atomicname, redname) + reducer = ptools.reduce.reducer(atomicname, redname) reducer.name_conversion_file = convname # Convert exception list of names as list of classes. diff --git a/ptools/commands/translate_cmd.py b/ptools/commands/translate_cmd.py index bba7eeb..4f8c7a7 100644 --- a/ptools/commands/translate_cmd.py +++ b/ptools/commands/translate_cmd.py @@ -50,7 +50,7 @@ def write_grid_to_pdb(grid, fp): fp (file): file pointer to output file """ for i in xrange(len(grid)): - coords = grid.getCoords(i) + coords = grid.get_coords(i) print(PDB_FMT % {'atomid': i + 1, 'atomname': 'POSI', 'resname': 'PRO', @@ -71,20 +71,20 @@ def run(args): rec = ptools.Rigidbody(args.receptor) lig = ptools.Rigidbody(args.ligand) - # Distance to receptor. - distance_to_receptor = args.distance_to_receptor or lig.Radius() + # distance to receptor. + distance_to_receptor = args.distance_to_receptor or lig.radius() distance_to_receptor *= args.distance_to_receptor_factor # Initialize surface. surf = ptools.Surface(30, 30, SOLVATION_PARAMETER_FILE) - surf.surfpointParams(5000, distance_to_receptor) + surf.surfpoint_params(5000, distance_to_receptor) # Generate grid points. grid = surf.surfpoint(rec, 1.4) # Remove points too clore from the receptor. outergrid = surf.outergrid(grid, rec, distance_to_receptor) - outergrid = surf.removeclosest(outergrid, args.density) + outergrid = surf.remove_closest(outergrid, args.density) # Generate output PDB. if args.output: diff --git a/ptools/docking.py b/ptools/docking.py index c5e45df..ae5b04a 100644 --- a/ptools/docking.py +++ b/ptools/docking.py @@ -15,7 +15,7 @@ def read_translations(filename="translation.dat"): """Return dictionary of translations from PDB-format file indexed by translation number (atomid).""" rb = ptools.Rigidbody("translation.dat") print("Read {:d} translations from translation.dat".format(len(rb))) - translations = [(rb.GetAtomProperty(i).atomId, rb.getCoords(i)) for i in xrange(len(rb))] + translations = [(rb.get_atom_property(i).atomId, rb.get_coords(i)) for i in xrange(len(rb))] return dict(translations) @@ -76,7 +76,7 @@ def surreal(i): def rmsdca(l1, l2): """Return the RMSD between the alpha-carbone atom of two RigidBody instances.""" - return ptools.Rmsd(l1.CA().CreateRigid(), l2.CA().CreateRigid()) + return ptools.rmsd(l1.get_CA().create_rigid(), l2.get_CA().create_rigid()) def get_group(collection, ngroups, ngroup): @@ -107,9 +107,9 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, # Use appropriate rmsd calculation if ref is not None: - refca = ref.CA() + refca = ref.get_CA() if len(refca) == 0: # No C alpha atom, ligand is probably a dna - rmsd_func = ptools.Rmsd + rmsd_func = ptools.rmsd print("No Calpha atom found for ligand (DNA?). RMSD will be " "calculated on all grains") else: @@ -129,10 +129,10 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, ligand = ptools.AttractRigidbody(lig) receptor = ptools.AttractRigidbody(rec) - center = ligand.FindCenter() - ligand.Translate(ptools.Coord3D() - center) # set ligand center of mass to 0,0,0 - ligand.AttractEulerRotate(surreal(rot[0]), surreal(rot[1]), surreal(rot[2])) - ligand.Translate(trans) + center = ligand.find_center() + ligand.translate(ptools.Coord3D() - center) # set ligand center of mass to 0,0,0 + ligand.euler_rotate(surreal(rot[0]), surreal(rot[1]), surreal(rot[2])) + ligand.translate(trans) for minim in minimlist: minimcounter += 1 @@ -142,34 +142,34 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, # performs single minimization on receptor and ligand, given maxiter=niter and restraint constant rstk forcefield = ff_specs['ff_class'](ff_specs['ff_file'], surreal(cutoff)) - receptor.setTranslation(False) - receptor.setRotation(False) + receptor.set_translation(False) + receptor.set_rotation(False) - forcefield.AddLigand(receptor) - forcefield.AddLigand(ligand) + forcefield.addLigand(receptor) + forcefield.addLigand(ligand) # rstk = minim['rstk'] # restraint force # if rstk > 0.0: - # forcefield.SetRestraint(rstk) + # forcefield.set_restraint(rstk) lbfgs_minimizer = ff_specs['minimizer_class'](forcefield) lbfgs_minimizer.minimize(niter) - ntraj = lbfgs_minimizer.GetNumberIter() - X = lbfgs_minimizer.GetMinimizedVars() # optimized freedom variables after minimization + ntraj = lbfgs_minimizer.get_number_iter() + X = lbfgs_minimizer.get_minimized_vars() # optimized freedom variables after minimization output = ptools.AttractRigidbody(ligand) - center = output.FindCenter() - output.Translate(ptools.Coord3D() - center) - output.AttractEulerRotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) - output.Translate(ptools.Coord3D(surreal(X[3]), surreal(X[4]), surreal(X[5]))) - output.Translate(center) + center = output.find_center() + output.translate(ptools.Coord3D() - center) + output.euler_rotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) + output.translate(ptools.Coord3D(surreal(X[3]), surreal(X[4]), surreal(X[5]))) + output.translate(center) ligand = ptools.AttractRigidbody(output) if ftraj is not None: for iteration in range(ntraj): - traj = lbfgs_minimizer.GetMinimizedVarsAtIter(iteration) + traj = lbfgs_minimizer.get_minimized_vars_at_iter(iteration) for t in traj[0:6]: ftraj.write("%f " % t) ftraj.write("\n") @@ -184,7 +184,7 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, # calculates true energy, and rmsd if possible # with the new ligand position forcefield = ff_specs['ff_class'](ff_specs['ff_file'], surreal(500)) - print("{:>4s} {:>6s} {:>6s} {:>13s} {:>13s} {:>13s} {:>13s}".format(' ', 'Trans', 'Rot', 'Ener', 'RmsdCA_ref', "VDW", "Coulomb")) + print("{:>4s} {:>6s} {:>6s} {:>13s} {:>13s} {:>13s} {:>13s}".format(' ', 'Trans', 'Rot', 'Ener', 'rmsdCA_ref', "VDW", "Coulomb")) pl = ptools.AttractPairList(receptor, ligand, surreal(500)) - print("{:<4s} {:6d} {:6d} {:13.7f} {:>13s} {:13.7f} {:13.7f}".format("==", transnb, rotnb, forcefield.nonbon8(receptor, ligand, pl), str(rms), forcefield.getVdw(), forcefield.getCoulomb())) - output.PrintMatrix() + print("{:<4s} {:6d} {:6d} {:13.7f} {:>13s} {:13.7f} {:13.7f}".format("==", transnb, rotnb, forcefield.nonbon8(receptor, ligand, pl), str(rms), forcefield.get_vdw(), forcefield.getCoulomb())) + output.print_matrix() diff --git a/ptools/exceptions.py b/ptools/exceptions.py index 94237b4..2bf2200 100644 --- a/ptools/exceptions.py +++ b/ptools/exceptions.py @@ -113,7 +113,7 @@ def duplicate_atoms(self): return [name for name, count in counter.items() if count > 1] -class IgnoredAtomsInReducedResidueError(ResidueReductionError): +class IgnoredAtomsInreducedResidueError(ResidueReductionError): """Exception raised when an atom from all-atom model has not been used in the coarse grain model. @@ -134,7 +134,7 @@ def __init__(self, residue): self.bead_atom_names = [atom.atomType for bead in residue.beads for atom in bead.atoms] - super(IgnoredAtomsInReducedResidueError, self).__init__(residue.resname, residue.resid) + super(IgnoredAtomsInreducedResidueError, self).__init__(residue.resname, residue.resid) @property def unused_atoms(self): diff --git a/ptools/reduce.py b/ptools/reduce.py index 9f47777..bfc838e 100644 --- a/ptools/reduce.py +++ b/ptools/reduce.py @@ -79,14 +79,14 @@ def name(self, value): """Set bead name.""" self.atomType = value - def toatom(self): + def to_atom(self): """Return a ptools.Atom instance with current bead properties and coordinates.""" return ptools.Atom(self, self.coords) def topdb(self): """Return the bead description as a PDB formatted string.""" - return self.toatom().ToPdbString() + return self.to_atom().to_pdb_string() def is_incomplete(self): """Return True if the number of atoms found to build the bead is @@ -156,7 +156,7 @@ def topdb(self): return '\n'.join(b.topdb() for b in self.beads) -class Reducer(object): +class reducer(object): """Class that handle reduction from an atomistic topology to a coarse grain model. @@ -191,7 +191,7 @@ class Reducer(object): """ def __init__(self, topology_file, reduction_parameters_file): - """Initialize Reduce from topology file and reduction parameter file. + """Initialize reduce from topology file and reduction parameter file. Args: topology_file (str): path to all-atom topology file (PDB format). @@ -324,7 +324,7 @@ def read_reduction_parameters(self): def read_topology(self): """Read PDB topology file.""" rb = ptools.Rigidbody(self.allatom_file) - self.atoms = [rb.CopyAtom(i) for i in xrange(len(rb))] + self.atoms = [rb.copy_atom(i) for i in xrange(len(rb))] def read_name_conversion_file(self): """Read YAML file containing residue and atom name conversion rules. @@ -516,7 +516,7 @@ def print_output_model(self, path=''): """ forcefield = self.forcefield header = 'HEADER {} REDUCED PDB FILE'.format(forcefield) - content = '\n'.join(bead.toatom().ToPdbString() for bead in self.beads) + content = '\n'.join(bead.to_atom().to_pdb_string() for bead in self.beads) f = sys.stdout if path: f = open(path, 'wt') diff --git a/src/BasePair.cpp b/src/BasePair.cpp index e703cc2..bc6c17e 100644 --- a/src/BasePair.cpp +++ b/src/BasePair.cpp @@ -17,35 +17,35 @@ BasePair::BasePair(std::string filename) { cout << "opening : " << filename << endl; ReadPDB(filename,rigbody); - this->type = rigbody.GetAtomProperty(0).residType; + this->type = rigbody.get_atom_property(0).residType; } BasePair::BasePair(const Rigidbody& rigbody) { - if (rigbody.Size()==0) + if (rigbody.size()==0) { throw std::runtime_error("cannot initialize a BasePair with an empty Rigidbody"); } this->rigbody=rigbody; - this->type = rigbody.GetAtomProperty(0).residType; + this->type = rigbody.get_atom_property(0).residType; } -string BasePair::PrintPDB()const +string BasePair::print_pdb()const { - return rigbody.PrintPDB (); + return rigbody.print_pdb (); } -std::string BasePair::PrintPDBofBase(std::string chain) +std::string BasePair::print_pdbofBase(std::string chain) { - return rigbody.SelectChainId(chain).CreateRigid().PrintPDB(); + return rigbody.select_chainid(chain).create_rigid().print_pdb(); } void BasePair::SetChainID(){ - unsigned int rigSize=rigbody.Size(); - for(unsigned int i =0; i< rigSize ; i++) + unsigned int rigsize=rigbody.size(); + for(unsigned int i =0; i< rigsize ; i++) { - Atomproperty ap=rigbody.GetAtomProperty(i); + Atomproperty ap=rigbody.get_atom_property(i); if (ap.residType == type) { ap.chainId = "A"; @@ -54,51 +54,51 @@ void BasePair::SetChainID(){ { ap.chainId = "B"; } - rigbody.SetAtomProperty(i,ap); + rigbody.set_atom_property(i,ap); } } -void BasePair::Apply( const Movement& m) +void BasePair::apply( const Movement& m) { - m.Apply(rigbody); + m.apply(rigbody); } -void BasePair::Apply(const Matrix& m) +void BasePair::apply(const Matrix& m) { - Apply(Movement (m)); + apply(Movement (m)); } -Matrix BasePair::GetMatrix() const +Matrix BasePair::get_matrix() const { - return rigbody.GetMatrix(); + return rigbody.get_matrix(); } Movement BasePair::GetMovement()const { - return Movement(GetMatrix()); + return Movement(get_matrix()); } -Rigidbody BasePair::GetRigidBody()const +Rigidbody BasePair::get_rigid()const { return rigbody; } -Rigidbody BasePair::GetRigidBodyOfBase(std::string chain) +Rigidbody BasePair::get_rigidOfBase(std::string chain) { - return rigbody.SelectChainId(chain).CreateRigid(); + return rigbody.select_chainid(chain).create_rigid(); } void BasePair::SetResID(int idA,int idB) { - unsigned int baseSize=rigbody.Size(); - for(unsigned int i =0; i< baseSize ; i++) + unsigned int basesize=rigbody.size(); + for(unsigned int i =0; i< basesize ; i++) { - Atomproperty ap=rigbody.GetAtomProperty(i); + Atomproperty ap=rigbody.get_atom_property(i); if (ap.chainId == "A") { ap.residId = idA; @@ -107,21 +107,21 @@ void BasePair::SetResID(int idA,int idB) { ap.residId = idB; } - rigbody.SetAtomProperty(i,ap); + rigbody.set_atom_property(i,ap); } } -uint BasePair::SetAtomNumberOfBase(std::string chain,int num) +uint BasePair::set_atomNumberOfBase(std::string chain,int num) { - unsigned int baseSize=rigbody.Size(); - for(unsigned int i =0; i< baseSize ; i++) + unsigned int basesize=rigbody.size(); + for(unsigned int i =0; i< basesize ; i++) { - Atomproperty ap=rigbody.GetAtomProperty(i); + Atomproperty ap=rigbody.get_atom_property(i); if (ap.chainId == chain) { ap.atomId = num; num++; - rigbody.SetAtomProperty(i,ap); + rigbody.set_atom_property(i,ap); } } return num; @@ -129,17 +129,17 @@ uint BasePair::SetAtomNumberOfBase(std::string chain,int num) uint BasePair::GetResIDofBase(std::string chain) { - Atomproperty ap = rigbody.SelectChainId(chain).CreateRigid().GetAtomProperty(0); + Atomproperty ap = rigbody.select_chainid(chain).create_rigid().get_atom_property(0); return ap.residId; } -void BasePair::SetRigidBody(const Rigidbody& rigbody) +void BasePair::set_rigidBody(const Rigidbody& rigbody) { this->rigbody=rigbody; } -string BasePair::GetType() const { +string BasePair::get_type() const { return type; } diff --git a/src/DNA.cpp b/src/DNA.cpp index 4d33b32..6163bc3 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -29,14 +29,14 @@ DNA::DNA(const string& dataBaseFile, const string& seq, const Movement& mov) else { AssembleSeq (dataBaseFile,seq); - ApplyInitialMov(mov); + applyInitialMov(mov); } } DNA::DNA( const DNA& model ) { - unsigned int modelSize = model.Size(); - for (uint i =0; i< modelSize; i++) + unsigned int modelsize = model.size(); + for (uint i =0; i< modelsize; i++) { strand.push_back(model[i]); } @@ -74,13 +74,13 @@ DNA::~DNA() void DNA::PlaceBasePairs( Rigidbody& model) { - unsigned int DNASize = (strand.size()*2)-1; - unsigned int strandSize = strand.size(); + unsigned int DNAsize = (strand.size()*2)-1; + unsigned int strandsize = strand.size(); Parameter param =Parameter(); - for ( unsigned int i = 0; i < strandSize; i++ )// strandSize + for ( unsigned int i = 0; i < strandsize; i++ )// strandsize { - Rigidbody modelOfBasePair = GetModelOfBasePair( model, i, DNASize-i); - strand[i].Apply(GetMatBetwenBasePair ( modelOfBasePair,i )); + Rigidbody modelOfBasePair = GetModelOfBasePair( model, i, DNAsize-i); + strand[i].apply(GetMatBetwenBasePair ( modelOfBasePair,i )); } } @@ -88,7 +88,7 @@ void DNA::PlaceBasePairs( Rigidbody& model) Matrix DNA::GetMatBetwenBasePair( Rigidbody& modelOfBasePair,int pos) { Parameter param =Parameter(); - Rigidbody secondAxis = strand[pos].GetRigidBody(); + Rigidbody secondAxis = strand[pos].get_rigid(); Superpose_t sup =superpose (param.BuildAxisCentered(modelOfBasePair), param.BuildAxisCentered( secondAxis ) ); return sup.matrix; } @@ -97,31 +97,31 @@ Matrix DNA::GetMatBetwenBasePair( Rigidbody& modelOfBasePair,int pos) void DNA::RenumberModel (Rigidbody& model) { - unsigned int tempId = model.GetAtomProperty(0).residId; + unsigned int tempId = model.get_atom_property(0).residId; string chain; unsigned int nbRes=0; unsigned int second = 0; - unsigned int strandSize = 0; - if ((model.SelectAtomType("C1'").Size() / 2) > 0) { - strandSize = model.SelectAtomType("C1'").Size() / 2; - } else if ((model.SelectAtomType("C1*").Size() / 2) > 0) { - strandSize = model.SelectAtomType("C1*").Size() / 2; - } else if((model.SelectAtomType("GS1").Size() / 2) > 0) { - strandSize = model.SelectAtomType("GS1").Size() / 2; + unsigned int strandsize = 0; + if ((model.select_atomtype("C1'").size() / 2) > 0) { + strandsize = model.select_atomtype("C1'").size() / 2; + } else if ((model.select_atomtype("C1*").size() / 2) > 0) { + strandsize = model.select_atomtype("C1*").size() / 2; + } else if((model.select_atomtype("GS1").size() / 2) > 0) { + strandsize = model.select_atomtype("GS1").size() / 2; } bool isjumna = IsJumna(model); - unsigned int modelSize=model.Size(); + unsigned int modelsize=model.size(); chain = "A"; - for (unsigned int i =0; i < modelSize; i++ ) + for (unsigned int i =0; i < modelsize; i++ ) { - Atomproperty ap=model.GetAtomProperty(i); + Atomproperty ap=model.get_atom_property(i); unsigned int Id = ap.residId; if ( tempId != Id ) { - if (nbRes >= strandSize -1){ + if (nbRes >= strandsize -1){ chain = "B"; if (isjumna) { @@ -146,7 +146,7 @@ void DNA::RenumberModel (Rigidbody& model) } ap.residId = nbRes; ap.chainId = chain; - model.SetAtomProperty(i,ap); + model.set_atom_property(i,ap); } } @@ -155,13 +155,13 @@ bool DNA::IsJumna ( Rigidbody& model) //jumna have an inversed numerotation so on a 10 base dna (strand A: 0,1,2,3,4 and strand B:5,6,7,8,9) //the base 0 is associated with 5 instead of 9. //to check wich convention is followed, I'm gonna test the distance between 0-5 and 0-9, the shorter being the correct coupling - AtomSelection sel = model.SelectAtomType("C1'"); - if (sel.Size() == 0) sel = model.SelectAtomType("C1*"); - if (sel.Size() == 0) sel = model.SelectAtomType("GS1"); + AtomSelection sel = model.select_atomtype("C1'"); + if (sel.size() == 0) sel = model.select_atomtype("C1*"); + if (sel.size() == 0) sel = model.select_atomtype("GS1"); - double d1 = Dist(sel[0],sel[sel.Size()-1]); - double d2 = Dist(sel[0],sel[sel.Size()/2]); + double d1 = dist(sel[0],sel[sel.size()-1]); + double d2 = dist(sel[0],sel[sel.size()/2]); return (d1>d2); } @@ -169,22 +169,22 @@ bool DNA::IsJumna ( Rigidbody& model) Rigidbody DNA::DelSingleBase (Rigidbody& model) { string seq; - unsigned int strandSize; + unsigned int strandsize; Rigidbody newModel = Rigidbody(); - if ((model.SelectAtomType("C1'").Size()) >0) + if ((model.select_atomtype("C1'").size()) >0) { - strandSize = model.SelectAtomType("C1'").Size(); - }else if ((model.SelectAtomType("C1*").Size()) >0) + strandsize = model.select_atomtype("C1'").size(); + }else if ((model.select_atomtype("C1*").size()) >0) { - strandSize = model.SelectAtomType("C1*").Size(); - }else if ((model.SelectAtomType("GS1").Size()) >0) + strandsize = model.select_atomtype("C1*").size(); + }else if ((model.select_atomtype("GS1").size()) >0) { - strandSize = model.SelectAtomType("GS1").Size(); + strandsize = model.select_atomtype("GS1").size(); }else {return model;} - for ( unsigned int i=0 ; i< strandSize ; i++ ) + for ( unsigned int i=0 ; i< strandsize ; i++ ) { - string type = model.SelectResRange( i, i)[0].residType; + string type = model.select_resid_range( i, i)[0].residType; // /!\ the order of the check is important! somme pdb use a CYT description for C, a wrong order could detect this as a T if ( type.find ('G') != string::npos || type.find ('g') != string::npos) seq+='G'; else if ( type.find ('C') != string::npos || type.find ('c') != string::npos) seq+='C'; @@ -333,10 +333,10 @@ Rigidbody DNA::DelSingleBase (Rigidbody& model) { if ( solution[i]==1) { - newModel= newModel + model.SelectResRange(i,i).CreateRigid(); + newModel= newModel + model.select_resid_range(i,i).create_rigid(); } } - //cout << newModel.PrintPDB()<< endl; + //cout << newModel.print_pdb()<< endl; RenumberModel (newModel); @@ -383,7 +383,7 @@ bool DNA::IsAlign(std::string s1,std::string s2,int shift)const Rigidbody DNA::GetModelOfBasePair( Rigidbody& model,int posA,int posB) { - return (model.SelectResRange(posA, posA)|model.SelectResRange(posB, posB)).CreateRigid(); + return (model.select_resid_range(posA, posA)|model.select_resid_range(posB, posB)).create_rigid(); } @@ -405,20 +405,20 @@ void DNA::AssembleSeq (const std::string &dataBaseFile, const std::string& seq) string DNA::GetSeq ( Rigidbody& model) { string seq; - unsigned int strandSize; - if ((model.SelectAtomType("C1'").Size()/2) >0) + unsigned int strandsize; + if ((model.select_atomtype("C1'").size()/2) >0) { - strandSize = model.SelectAtomType("C1'").Size()/2; - }else if ((model.SelectAtomType("C1*").Size()/2) >0) + strandsize = model.select_atomtype("C1'").size()/2; + }else if ((model.select_atomtype("C1*").size()/2) >0) { - strandSize = model.SelectAtomType("C1*").Size()/2; - }else if ((model.SelectAtomType("GS1").Size()/2) >0) + strandsize = model.select_atomtype("C1*").size()/2; + }else if ((model.select_atomtype("GS1").size()/2) >0) { - strandSize = model.SelectAtomType("GS1").Size()/2; + strandsize = model.select_atomtype("GS1").size()/2; }else {return "";} - for ( unsigned int i=0 ; i< strandSize ; i++ ) + for ( unsigned int i=0 ; i< strandsize ; i++ ) { - string type = model.SelectResRange( i, i)[0].residType; + string type = model.select_resid_range( i, i)[0].residType; // /!\ the order of the check is important! somme pdb use a CYT description for C, a wrong order could detect this as a T if ( type.find ('G') != string::npos || type.find ('g') != string::npos) seq+='G'; else if ( type.find ('C') != string::npos || type.find ('c') != string::npos) seq+='C'; @@ -433,11 +433,11 @@ string DNA::GetSeq ( Rigidbody& model) vector DNA::BuildVbase(string chainIDs, Rigidbody& dataBase)const { vector vbase; - unsigned int chainIDsSize = chainIDs.size(); - for (unsigned int i = 0; i < chainIDsSize ; i++) + unsigned int chainIDssize = chainIDs.size(); + for (unsigned int i = 0; i < chainIDssize ; i++) { - vbase.push_back(dataBase.SelectChainId(chainIDs.substr(i,1)).CreateRigid()); + vbase.push_back(dataBase.select_chainid(chainIDs.substr(i,1)).create_rigid()); } return vbase; } @@ -446,11 +446,11 @@ vector DNA::BuildVbase(string chainIDs, Rigidbody& dataBase)const string DNA::GetChainIDs(const Rigidbody& rb)const { string chainIDs; - AtomSelection selection = rb.SelectAllAtoms (); + AtomSelection selection = rb.select_all_atoms (); string tmp = ""; - unsigned int selectionSize = selection.Size(); + unsigned int selectionsize = selection.size(); - for (unsigned int i=0; i < selectionSize ;i++) + for (unsigned int i=0; i < selectionsize ;i++) { string id = selection[i].chainId; if(id !=tmp) @@ -469,12 +469,12 @@ bool DNA::IsPdbFile (std::string seq) const void DNA::BuildStrand(std::string seq, std::string chainIDs, const std::vector& vbase) { - unsigned int seqSize = seq.size(); - unsigned int chainIDsSize = chainIDs.size(); + unsigned int seqsize = seq.size(); + unsigned int chainIDssize = chainIDs.size(); - for (unsigned int i =0; i < seqSize; i++ ) + for (unsigned int i =0; i < seqsize; i++ ) { - for (unsigned int j =0; j < chainIDsSize; j++ ) + for (unsigned int j =0; j < chainIDssize; j++ ) { if (seq[i] == chainIDs[j]) { @@ -488,84 +488,84 @@ void DNA::BuildStrand(std::string seq, std::string chainIDs, const std::vector 0 ; i-- ) + for (unsigned int i = strandsize-1; i > 0 ; i-- ) { //numerotation atom (second part) - nbAtom = strand[i].SetAtomNumberOfBase("B",nbAtom); + nbAtom = strand[i].set_atomNumberOfBase("B",nbAtom); } //last part of atom numerotation (because of error with decreasing unsigned int) - strand[0].SetAtomNumberOfBase("B",nbAtom); + strand[0].set_atomNumberOfBase("B",nbAtom); } -void DNA::ApplyInitialMov(const Movement& mov) +void DNA::applyInitialMov(const Movement& mov) { - unsigned int strandSize = strand.size(); - for (unsigned int i=1; i Size(); - for (uint i=0; isize(); + for (uint i=0; i"< vbase = BuildVbase(chainIDs,dataBase); - unsigned int chainIDsSize = chainIDs.size(); + unsigned int chainIDssize = chainIDs.size(); - unsigned int strandSize = strand.size(); - for (unsigned int i = 0; i < strandSize ; i++) + unsigned int strandsize = strand.size(); + for (unsigned int i = 0; i < strandsize ; i++) { - Movement mov = Movement(strand[i].GetMatrix()); + Movement mov = Movement(strand[i].get_matrix()); - for (unsigned int j =0; j < chainIDsSize; j++ ) + for (unsigned int j =0; j < chainIDssize; j++ ) { - if ( strand[i].GetType()[0] == chainIDs[j]) + if ( strand[i].get_type()[0] == chainIDs[j]) { strand[i]=BasePair(vbase[j]); - strand[i].Apply(mov); + strand[i].apply(mov); } } } @@ -654,10 +654,10 @@ void DNA::ChangeRepresentation(std::string dataBaseFile) Matrix DNA::GetLocalMatrix(int pos)const { - if (pos == 0) return strand[0].GetMatrix(); + if (pos == 0) return strand[0].get_matrix(); - Matrix mtot = strand[pos].GetMatrix(); - Matrix prec = inverseMatrix44(strand[pos-1].GetMatrix()); + Matrix mtot = strand[pos].get_matrix(); + Matrix prec = inverseMatrix44(strand[pos-1].get_matrix()); return matrixMultiply( prec, mtot ); @@ -666,113 +666,113 @@ Matrix DNA::GetLocalMatrix(int pos)const Parameter DNA::GetLocalParameter(int pos) { Parameter param =Parameter(); - Rigidbody firstAxis = strand[pos-1].GetRigidBody(); - Rigidbody secondAxis = strand[pos].GetRigidBody(); + Rigidbody firstAxis = strand[pos-1].get_rigid(); + Rigidbody secondAxis = strand[pos].get_rigid(); param.MeasureParameters(param.BuildAxisCentered(firstAxis),param.BuildAxisCentered(secondAxis)); return param; } -void DNA::ApplylocalMov(const Movement& mov,int pos) +void DNA::applylocalMov(const Movement& mov,int pos) { Matrix nextlocal = GetLocalMatrix(pos+1); - strand[pos].Apply(mov); + strand[pos].apply(mov); - unsigned int strandSize = strand.size(); - for (unsigned int i=pos+1; i 1){ + unsigned int strandsize = strand.size(); + if (strandsize>1){ nextlocal = GetLocalMatrix(1); } - strand[0].Apply(mov); + strand[0].apply(mov); - for (unsigned int i=1; i Add(d[0], mov); - for(uint i =1; i< d.Size();i++) + this->add(d[0], mov); + for(uint i =1; i< d.size();i++) { - this->Add(d[i],Movement(d.GetLocalMatrix(i))); + this->add(d[i],Movement(d.GetLocalMatrix(i))); } } /// add a basepair at the end of the strand of this DNA -void DNA::Add(BasePair bp, const Movement & mov) +void DNA::add(BasePair bp, const Movement & mov) { - Matrix oldmouvement = bp.GetMatrix (); - bp.Apply(inverseMatrix44 (oldmouvement)); + Matrix oldmouvement = bp.get_matrix (); + bp.apply(inverseMatrix44 (oldmouvement)); if (strand.size()>0) { - bp.Apply(matrixMultiply(strand[strand.size()-1].GetMatrix(),mov.GetMatrix())); + bp.apply(matrixMultiply(strand[strand.size()-1].get_matrix(),mov.get_matrix())); } - else bp.Apply(mov.GetMatrix()); + else bp.apply(mov.get_matrix()); strand.push_back(bp); this->ChangeFormat(); } -DNA DNA::SubDNA(uint start, uint end)const +DNA DNA::subDNA(uint start, uint end)const { - if (std::max(start, end) > this->Size() ) + if (std::max(start, end) > this->size() ) { - throw std::out_of_range("out of range in SubDNA"); + throw std::out_of_range("out of range in subDNA"); } DNA newdna = DNA(); - newdna.Add(strand[start],Movement(strand[start].GetMatrix())); + newdna.add(strand[start],Movement(strand[start].get_matrix())); for (uint i=start+1; iGetLocalMatrix(i))); + newdna.add(strand[i],Movement(this->GetLocalMatrix(i))); } return newdna; } void DNA::Replace(const DNA & d,int start) { - DNA preDNA = this->SubDNA(0,start); - DNA postDNA =this->SubDNA(start+d.Size(),this->Size()); + DNA preDNA = this->subDNA(0,start); + DNA postDNA =this->subDNA(start+d.size(),this->size()); - Movement initMov = Movement(strand[0].GetMatrix()); + Movement initMov = Movement(strand[0].get_matrix()); strand.clear(); - this->Add(preDNA,initMov); - this->Add(d); - this->Add(postDNA); + this->add(preDNA,initMov); + this->add(d); + this->add(postDNA); } -void DNA::ChangeType(int pos, std::string type, std::string filename) { +void DNA::change_type(int pos, std::string type, std::string filename) { Rigidbody dataBase = Rigidbody(filename); - Movement mov = Movement(strand[pos].GetMatrix()); + Movement mov = Movement(strand[pos].get_matrix()); - strand[pos] = BasePair(dataBase.SelectChainId(type).CreateRigid()); - strand[pos].Apply(mov); + strand[pos] = BasePair(dataBase.select_chainid(type).create_rigid()); + strand[pos].apply(mov); ChangeFormat(); } -void DNA::Translate(Coord3D coord) +void DNA::translate(Coord3D coord) { - unsigned int strandSize = strand.size(); - for (unsigned int i=0; i 0) + if (bp.select_atomtype("GS2").size()> 0) { return BuildAxisCGGeometricCenter(bp); } @@ -52,24 +52,24 @@ Rigidbody Parameter::BuildAxisCentered( Rigidbody& bp) ////code "steal" from deformDna.cpp (author: Pierre Poulain), modified to use the geometric center Rigidbody Parameter::BuildAxisCGGeometricCenter( Rigidbody& bp) { - AtomSelection selSugar = bp.SelectAtomType("GS2"); - assert(selSugar.Size() == 2); + AtomSelection selSugar = bp.select_atomtype("GS2"); + assert(selSugar.size() == 2); // build base3D Rigidbody base3D; // define atoms for base3D construction - Coord3D center = selSugar.CreateRigid().FindCenter(); // middle of GS2 + Coord3D center = selSugar.create_rigid().find_center(); // middle of GS2 Coord3D pointY = selSugar[0].coords; // point toward Y (first GS2) - AtomSelection grain1 = bp.SelectAtomType("GG1"); // GG1 or GA1 - if (grain1.Size() == 0) { - grain1 = bp.SelectAtomType("GA1"); + AtomSelection grain1 = bp.select_atomtype("GG1"); // GG1 or GA1 + if (grain1.size() == 0) { + grain1 = bp.select_atomtype("GA1"); } - assert(grain1.Size() == 1); + assert(grain1.size() == 1); - AtomSelection grain2 = bp.SelectAtomType("GC1"); // GG1 or GA1 - if (grain2.Size() == 0) { - grain2 = bp.SelectAtomType("GT1"); + AtomSelection grain2 = bp.select_atomtype("GC1"); // GG1 or GA1 + if (grain2.size() == 0) { + grain2 = bp.select_atomtype("GT1"); } - assert(grain2.Size() == 1); + assert(grain2.size() == 1); Coord3D pointX1 = grain1[0].coords; Coord3D pointX2 = grain2[0].coords; // Y @@ -91,18 +91,18 @@ Rigidbody Parameter::BuildAxisCGGeometricCenter( Rigidbody& bp) VectProd(axeY, axeZ, axeX); axeX = axeX.Normalize(); // origin - Coord3D origin=bp.FindCenter(); + Coord3D origin=bp.find_center(); // save base3D Atomproperty atp; atp.atomType = "OO"; - base3D.AddAtom(atp,origin ); + base3D.add_atom(atp,origin ); atp.atomType = "OX"; - base3D.AddAtom(atp, origin + axeX); + base3D.add_atom(atp, origin + axeX); atp.atomType = "OY"; - base3D.AddAtom(atp, origin + axeY); + base3D.add_atom(atp, origin + axeY); atp.atomType = "OZ"; - base3D.AddAtom(atp, origin + axeZ); + base3D.add_atom(atp, origin + axeZ); return base3D; } @@ -112,18 +112,18 @@ Rigidbody Parameter::BuildAxisCGGeometricCenter( Rigidbody& bp) ///Definitions and Nomenclature of Nucleic Acid Structure Parameters, R. E. Dickerson et alJ. Mol. Biol. (1995) 251, 648–664. Rigidbody Parameter::BuildAxisAAGeometricCenter( Rigidbody& bp) { - AtomSelection selSugar = bp.SelectAtomType("C1'"); - if (selSugar.Size() != 2)selSugar = bp.SelectAtomType("C1*"); + AtomSelection selSugar = bp.select_atomtype("C1'"); + if (selSugar.size() != 2)selSugar = bp.select_atomtype("C1*"); // build base3D Rigidbody base3D; // define atoms for base3D construction - Coord3D center = selSugar.CreateRigid().FindCenter(); // middle of GS2 + Coord3D center = selSugar.create_rigid().find_center(); // middle of GS2 Coord3D pointY = selSugar[0].coords; // point toward Y (first GS2) - AtomSelection grain = bp.SelectAtomType("C5"); // GG1 or GA1 - if (grain.Size() == 0) { - grain = bp.SelectAtomType("GA1"); + AtomSelection grain = bp.select_atomtype("C5"); // GG1 or GA1 + if (grain.size() == 0) { + grain = bp.select_atomtype("GA1"); } - assert(grain.Size() >= 1); /* /!\ */ + assert(grain.size() >= 1); /* /!\ */ // Y Coord3D axeY = (pointY - center).Normalize(); // Z @@ -144,18 +144,18 @@ Rigidbody Parameter::BuildAxisAAGeometricCenter( Rigidbody& bp) VectProd(axeY, axeZ, axeX); axeX = axeX.Normalize(); // origin - Coord3D origin=bp.FindCenter(); + Coord3D origin=bp.find_center(); // save base3D Atomproperty atp; atp.atomType = "OO"; - base3D.AddAtom(atp,origin ); + base3D.add_atom(atp,origin ); atp.atomType = "OX"; - base3D.AddAtom(atp, origin + axeX); + base3D.add_atom(atp, origin + axeX); atp.atomType = "OY"; - base3D.AddAtom(atp, origin + axeY); + base3D.add_atom(atp, origin + axeY); atp.atomType = "OZ"; - base3D.AddAtom(atp, origin + axeZ1); + base3D.add_atom(atp, origin + axeZ1); return base3D; } @@ -165,14 +165,14 @@ void Parameter::MeasureParameters(const Rigidbody& oxyz1, const Rigidbody& oxyz2 //the vector of the first coordinate - Coord3D X = oxyz1.GetCoords(1) - oxyz1.GetCoords(0); - Coord3D Y = oxyz1.GetCoords(2) - oxyz1.GetCoords(0); - Coord3D Z = oxyz1.GetCoords(3) - oxyz1.GetCoords(0); + Coord3D X = oxyz1.get_coords(1) - oxyz1.get_coords(0); + Coord3D Y = oxyz1.get_coords(2) - oxyz1.get_coords(0); + Coord3D Z = oxyz1.get_coords(3) - oxyz1.get_coords(0); //the vector of the second coordinate - Coord3D I = oxyz2.GetCoords(1) - oxyz2.GetCoords(0); - Coord3D J = oxyz2.GetCoords(2) - oxyz2.GetCoords(0); - Coord3D K = oxyz2.GetCoords(3) - oxyz2.GetCoords(0); + Coord3D I = oxyz2.get_coords(1) - oxyz2.get_coords(0); + Coord3D J = oxyz2.get_coords(2) - oxyz2.get_coords(0); + Coord3D K = oxyz2.get_coords(3) - oxyz2.get_coords(0); //the vector of the second axis are projeted in the first axis Coord3D e1(ScalProd(I, X), ScalProd(I, Y), ScalProd(I, Z)); @@ -190,7 +190,7 @@ void Parameter::MeasureParameters(const Rigidbody& oxyz1, const Rigidbody& oxyz2 // roll = acos(ScalProd(Y,J)); // tilt = acos(ScalProd(Z,K)); //the vector between the two origins - Coord3D OO = oxyz2.GetCoords(0) - oxyz1.GetCoords(0); + Coord3D OO = oxyz2.get_coords(0) - oxyz1.get_coords(0); //the projection of the vector between the two origins on each axis. shift = ScalProd(OO,I); slide = ScalProd(OO,J); diff --git a/src/Stacking.cpp b/src/Stacking.cpp index e87696a..8536ca0 100644 --- a/src/Stacking.cpp +++ b/src/Stacking.cpp @@ -27,57 +27,57 @@ Stacking::~Stacking() Rigidbody Stacking::Axis( Rigidbody& bp1, Rigidbody& bp2) { //1 determine if the considered basePair is a G-C or a A-T - bool bp1isGC = bp1.SelectAtomType("GG1").Size()>0; - bool bp2isGC = bp2.SelectAtomType("GG1").Size()>0; + bool bp1isGC = bp1.select_atomtype("GG1").size()>0; + bool bp2isGC = bp2.select_atomtype("GG1").size()>0; //2 build rigidbody for pyrimidine Rigidbody pyrBp1; if (bp1isGC) { - pyrBp1 = bp1.SelectAtomType("GC1").CreateRigid() + bp1.SelectAtomType("GC2").CreateRigid(); + pyrBp1 = bp1.select_atomtype("GC1").create_rigid() + bp1.select_atomtype("GC2").create_rigid(); } else { - pyrBp1 = bp1.SelectAtomType("GT1").CreateRigid() + bp1.SelectAtomType("GT2").CreateRigid(); + pyrBp1 = bp1.select_atomtype("GT1").create_rigid() + bp1.select_atomtype("GT2").create_rigid(); } Rigidbody pyrBp2; if (bp2isGC) { - pyrBp2 = bp2.SelectAtomType("GC1").CreateRigid() + bp2.SelectAtomType("GC2").CreateRigid(); + pyrBp2 = bp2.select_atomtype("GC1").create_rigid() + bp2.select_atomtype("GC2").create_rigid(); } else { - pyrBp2 = bp2.SelectAtomType("GT1").CreateRigid() + bp2.SelectAtomType("GT2").CreateRigid(); + pyrBp2 = bp2.select_atomtype("GT1").create_rigid() + bp2.select_atomtype("GT2").create_rigid(); } //3 build rigidbody for purine Rigidbody purBp1; if (bp1isGC) { - purBp1 = bp1.SelectAtomType("GG1").CreateRigid() + bp1.SelectAtomType("GG2").CreateRigid() + bp1.SelectAtomType("GG3").CreateRigid(); + purBp1 = bp1.select_atomtype("GG1").create_rigid() + bp1.select_atomtype("GG2").create_rigid() + bp1.select_atomtype("GG3").create_rigid(); } else { - purBp1 = bp1.SelectAtomType("GA1").CreateRigid() + bp1.SelectAtomType("GA2").CreateRigid() + bp1.SelectAtomType("GA3").CreateRigid(); + purBp1 = bp1.select_atomtype("GA1").create_rigid() + bp1.select_atomtype("GA2").create_rigid() + bp1.select_atomtype("GA3").create_rigid(); } Rigidbody purBp2; if (bp2isGC) { - purBp2 = bp2.SelectAtomType("GG1").CreateRigid() + bp2.SelectAtomType("GG2").CreateRigid() + bp2.SelectAtomType("GG3").CreateRigid(); + purBp2 = bp2.select_atomtype("GG1").create_rigid() + bp2.select_atomtype("GG2").create_rigid() + bp2.select_atomtype("GG3").create_rigid(); } else { - purBp2 = bp2.SelectAtomType("GA1").CreateRigid() + bp2.SelectAtomType("GA2").CreateRigid() + bp2.SelectAtomType("GA3").CreateRigid(); + purBp2 = bp2.select_atomtype("GA1").create_rigid() + bp2.select_atomtype("GA2").create_rigid() + bp2.select_atomtype("GA3").create_rigid(); } //4 compute center - Coord3D pyrBp1center = pyrBp1.FindCenter() ; - Coord3D pyrBp2center = pyrBp2.FindCenter() ; - Coord3D purBp1center = purBp1.FindCenter() ; - Coord3D purBp2center = purBp2.FindCenter() ; + Coord3D pyrBp1center = pyrBp1.find_center() ; + Coord3D pyrBp2center = pyrBp2.find_center() ; + Coord3D purBp1center = purBp1.find_center() ; + Coord3D purBp2center = purBp2.find_center() ; Rigidbody axis; @@ -101,36 +101,36 @@ Rigidbody Stacking::Axis( Rigidbody& bp1, Rigidbody& bp2) Rigidbody Stacking::Axis( Rigidbody& basePair) { //1 determine if the considered basePair is a G-C or a A-T - bool basePairIsGC = basePair.SelectAtomType("GG1").Size()>0; + bool basePairIsGC = basePair.select_atomtype("GG1").size()>0; //2 build rigidbody for pyrimidine Rigidbody pyrBp; if (basePairIsGC) { - pyrBp = basePair.SelectAtomType("GC1").CreateRigid() + basePair.SelectAtomType("GC2").CreateRigid(); + pyrBp = basePair.select_atomtype("GC1").create_rigid() + basePair.select_atomtype("GC2").create_rigid(); } else { - pyrBp = basePair.SelectAtomType("GT1").CreateRigid() + basePair.SelectAtomType("GT2").CreateRigid(); + pyrBp = basePair.select_atomtype("GT1").create_rigid() + basePair.select_atomtype("GT2").create_rigid(); } //3 build rigidbody for purine Rigidbody purBp; if (basePairIsGC) { - purBp = basePair.SelectAtomType("GG1").CreateRigid() + basePair.SelectAtomType("GG2").CreateRigid() + basePair.SelectAtomType("GG3").CreateRigid(); + purBp = basePair.select_atomtype("GG1").create_rigid() + basePair.select_atomtype("GG2").create_rigid() + basePair.select_atomtype("GG3").create_rigid(); } else { - purBp = basePair.SelectAtomType("GA1").CreateRigid() + basePair.SelectAtomType("GA2").CreateRigid() + basePair.SelectAtomType("GA3").CreateRigid(); + purBp = basePair.select_atomtype("GA1").create_rigid() + basePair.select_atomtype("GA2").create_rigid() + basePair.select_atomtype("GA3").create_rigid(); } //4 compute center - Coord3D pyrBp1center = pyrBp.FindCenter() ; - Coord3D purBp1center = purBp.FindCenter() ; + Coord3D pyrBp1center = pyrBp.find_center() ; + Coord3D purBp1center = purBp.find_center() ; Rigidbody axis; @@ -149,7 +149,7 @@ Rigidbody Stacking::AxisPyrimidine(const Rigidbody& pyr, const Coord3D& centerBa //1 get the projection of the center of the first base on the line defines //by the center of the second base and the vector of the first base. Coord3D vectorBp1Bp2 = centerBase1 - centerBase2; - Coord3D vectorBp1pyr2 = (pyr.CopyAtom(1).coords - centerBase1).Normalize(); + Coord3D vectorBp1pyr2 = (pyr.copy_atom(1).coords - centerBase1).Normalize(); double proj=ScalProd(vectorBp1Bp2,vectorBp1pyr2); @@ -161,8 +161,8 @@ Rigidbody Stacking::AxisPyrimidine(const Rigidbody& pyr, const Coord3D& centerBa //4 build the Axis for Pyrimidines Rigidbody pyrAxis; - pyrAxis.AddAtom(Atomproperty(),centerBase1); - pyrAxis.AddAtom(Atomproperty(),centerBase1+topOfAxis); + pyrAxis.add_atom(Atomproperty(),centerBase1); + pyrAxis.add_atom(Atomproperty(),centerBase1+topOfAxis); return pyrAxis; @@ -170,11 +170,11 @@ Rigidbody Stacking::AxisPyrimidine(const Rigidbody& pyr, const Coord3D& centerBa Rigidbody Stacking::AxisPyrimidineCopyPurine( const Coord3D& centerBase1, const Rigidbody& axisPurine )const { - Coord3D vectorPlanPur = axisPurine.GetCoords(1)-axisPurine.GetCoords(0); + Coord3D vectorPlanPur = axisPurine.get_coords(1)-axisPurine.get_coords(0); Rigidbody pyrAxis; - pyrAxis.AddAtom(Atomproperty(),centerBase1); - pyrAxis.AddAtom(Atomproperty(),centerBase1+vectorPlanPur); + pyrAxis.add_atom(Atomproperty(),centerBase1); + pyrAxis.add_atom(Atomproperty(),centerBase1+vectorPlanPur); return pyrAxis; } @@ -183,14 +183,14 @@ Rigidbody Stacking::AxisPurine(const Rigidbody& pur, const Coord3D& center)const //1 define two vector of the plan (check the chain to assure a clockwise order) Coord3D vectorPlan1 ; Coord3D vectorPlan2 ; - if (pur.GetAtomProperty(0).chainId=="A"){ - vectorPlan1 = pur.GetCoords(1)-center; - vectorPlan2 = pur.GetCoords(0)-center; + if (pur.get_atom_property(0).chainId=="A"){ + vectorPlan1 = pur.get_coords(1)-center; + vectorPlan2 = pur.get_coords(0)-center; } else { - vectorPlan1 = pur.GetCoords(0)-center; - vectorPlan2 = pur.GetCoords(1)-center; + vectorPlan1 = pur.get_coords(0)-center; + vectorPlan2 = pur.get_coords(1)-center; } //2 find orthogonal vector to defined plan @@ -199,17 +199,17 @@ Rigidbody Stacking::AxisPurine(const Rigidbody& pur, const Coord3D& center)const topOfAxis = topOfAxis.Normalize(); //3 build the Axis for Purine Rigidbody purAxis; - purAxis.AddAtom(Atomproperty(),center); - purAxis.AddAtom(Atomproperty(),center+topOfAxis); + purAxis.add_atom(Atomproperty(),center); + purAxis.add_atom(Atomproperty(),center+topOfAxis); return purAxis; } bool Stacking::IsStacked(const Rigidbody& axe1, const Rigidbody& axe2,double angleThreshold,double overlapThreshold)const { - Coord3D vector1 =axe1.GetCoords(1)-axe1.GetCoords(0); - Coord3D vector2 =axe2.GetCoords(1)-axe2.GetCoords(0); - Coord3D vectorD =(axe2.GetCoords(0)-axe1.GetCoords(0)).Normalize(); + Coord3D vector1 =axe1.get_coords(1)-axe1.get_coords(0); + Coord3D vector2 =axe2.get_coords(1)-axe2.get_coords(0); + Coord3D vectorD =(axe2.get_coords(0)-axe1.get_coords(0)).Normalize(); // cerr <atomType.c_str(); @@ -44,7 +44,7 @@ std::string Atom::ToPdbString() const } //! translate an atom with a Coord3D vector -void Atom::Translate(const Coord3D& tr) +void Atom::translate(const Coord3D& tr) { coords = coords+tr; } diff --git a/src/atomselection.cpp b/src/atomselection.cpp index fd53dc7..9787efc 100644 --- a/src/atomselection.cpp +++ b/src/atomselection.cpp @@ -14,9 +14,9 @@ namespace PTools { AtomSelection::AtomSelection(const Rigidbody& rigid) { m_rigid=&rigid; - for (uint i=0; i < rigid.Size(); i++) + for (uint i=0; i < rigid.size(); i++) { - this->AddAtomIndex(i); + this->add_atomIndex(i); } } @@ -33,13 +33,13 @@ AtomSelection::AtomSelection(const AtomSelection& oldsel) -Rigidbody AtomSelection::CreateRigid() +Rigidbody AtomSelection::create_rigid() { Rigidbody newrigid; - for (uint i=0; iSize(); i++) + for (uint i=0; isize(); i++) { - Atom at = m_rigid->CopyAtom(m_list[i]); - newrigid.AddAtom(at); + Atom at = m_rigid->copy_atom(m_list[i]); + newrigid.add_atom(at); } return newrigid; @@ -101,8 +101,8 @@ AtomSelection operator! (const AtomSelection& seltoinverse) { //TODO: tests! AtomSelection selout; - selout.SetRigid(*seltoinverse.m_rigid); - AtomSelection all = seltoinverse.m_rigid->SelectAllAtoms(); + selout.set_rigid(*seltoinverse.m_rigid); + AtomSelection all = seltoinverse.m_rigid->select_all_atoms(); set_difference(all.m_list.begin(), all.m_list.end(), seltoinverse.m_list.begin(), seltoinverse.m_list.end(), back_inserter(selout.m_list)); diff --git a/src/attractforcefield.cpp b/src/attractforcefield.cpp index 2970e86..5c82d93 100644 --- a/src/attractforcefield.cpp +++ b/src/attractforcefield.cpp @@ -24,9 +24,9 @@ void extractExtra( Rigidbody& rig, std::vector& vCat, std::vector& vC uint atcategory = 0; dbl atcharge = 0.0; - for (uint i=0; i& forcerec, std::vector& forcelig, bool print) { - assert(forcerec.size() == rec.Size()); - assert(forcelig.size() == lig.Size()); + assert(forcerec.size() == rec.size()); + assert(forcelig.size() == lig.size()); dbl sumLJ=0.0 ; dbl sumElectrostatic=0.0; - //synchronize coordinates for using unsafeGetCoords - rec.syncCoords(); - lig.syncCoords(); + //synchronize coordinates for using unsafeget_coords + rec.sync_coords(); + lig.sync_coords(); Coord3D a, b; - for (uint iter=0; iter=1); assert(m_movedligand.size() >=1); - if (stateVars.size() != this->ProblemSize() ) + if (stateVars.size() != this->Problemsize() ) { - throw std::runtime_error("error: ProblemSize != size of state vars in BaseAttractForceField::Function"); + throw std::runtime_error("error: Problemsize != size of state vars in BaseAttractForceField::Function"); } uint svptr = 0; //state variable 'pointer' @@ -363,17 +363,17 @@ dbl BaseAttractForceField::Function(const Vdouble& stateVars ) if (m_movedligand[i].hasrotation) { assert(svptr+2 < stateVars.size()); - m_movedligand[i].AttractEulerRotate(stateVars[svptr], stateVars[svptr+1], stateVars[svptr+2]); + m_movedligand[i].euler_rotate(stateVars[svptr], stateVars[svptr+1], stateVars[svptr+2]); svptr+=3; } - m_movedligand[i].Translate(m_ligcenter[i]); + m_movedligand[i].translate(m_ligcenter[i]); if (m_movedligand[i].hastranslation) { assert(svptr+2 < stateVars.size()); - m_movedligand[i].Translate(Coord3D(stateVars[svptr],stateVars[svptr+1],stateVars[svptr+2])); + m_movedligand[i].translate(Coord3D(stateVars[svptr],stateVars[svptr+1],stateVars[svptr+2])); svptr+=3; } @@ -405,7 +405,7 @@ dbl BaseAttractForceField::Function(const Vdouble& stateVars ) -uint BaseAttractForceField::ProblemSize() +uint BaseAttractForceField::Problemsize() { uint size = 0; for (uint i = 0; i < m_centeredligand.size(); i++) @@ -478,14 +478,14 @@ dbl AttractForceField2::nonbon8_forces(AttractRigidbody& rec, AttractRigidbody& std::cout.precision(20); - //synchronise coordinates to later use unsafeGetCoords (should be faster) - rec.syncCoords(); - lig.syncCoords(); + //synchronise coordinates to later use unsafeget_coords (should be faster) + rec.sync_coords(); + lig.sync_coords(); Coord3D a; Coord3D b; - for (uint ik=0; ikm_activeAtoms[i]; - Coord3D coords = pLigCentered->GetCoords(atomIndex); + Coord3D coords = pLigCentered->get_coords(atomIndex); X = coords.x; Y = coords.y; Z = coords.z; @@ -693,13 +693,13 @@ void BaseAttractForceField::Rota(uint molIndex, dbl phi,dbl ssi, dbl rot, Vdoubl -void BaseAttractForceField::AddLigand(AttractRigidbody & lig) +void BaseAttractForceField::addLigand(AttractRigidbody & lig) { setDummyTypeList(lig); // sets the dummy atom type. (virtual function customized for each Attract forcefield) AttractRigidbody centeredlig = lig ; - Coord3D com = lig.FindCenter(); + Coord3D com = lig.find_center(); m_ligcenter.push_back(com); m_movedligand.push_back(lig); diff --git a/src/attractrigidbody.cpp b/src/attractrigidbody.cpp index aa25d56..992a702 100644 --- a/src/attractrigidbody.cpp +++ b/src/attractrigidbody.cpp @@ -45,7 +45,7 @@ void AttractRigidbody::init_() uint atcategory = 0; dbl atcharge = 0.0; - for (uint i = 0; i < Size() ; ++i) + for (uint i = 0; i < size() ; ++i) { Atomproperty & at (mAtomProp[i]); std::string extra = at.extra; @@ -56,8 +56,8 @@ void AttractRigidbody::init_() } - setRotation(true); - setTranslation(true); + set_rotation(true); + set_translation(true); resetForces(); } @@ -75,7 +75,7 @@ void AttractRigidbody::updateActiveList() { std::vector newactivelist; - for(uint i=0; iSize(); i++) + for(uint i=0; isize(); i++) { if( isAtomActive(i) ) newactivelist.push_back(i); } diff --git a/src/basetypes.cpp b/src/basetypes.cpp index e3ab29d..009f202 100644 --- a/src/basetypes.cpp +++ b/src/basetypes.cpp @@ -30,7 +30,7 @@ namespace PTools void MakeIdentity(Matrix & mat) { - std::pair sz = mat.getDim(); + std::pair sz = mat.get_dim(); assert(sz.first == sz.second); for (int i=0; imat44[0][3]+=tr.x; @@ -95,7 +95,7 @@ void CoordsArray::ResetMatrix() -std::string CoordsArray::PrintMatrix() const +std::string CoordsArray::print_matrix() const { std::string out; out += "### MAT BEGIN\n"; @@ -117,7 +117,7 @@ std::string CoordsArray::PrintMatrix() const } -Matrix CoordsArray::GetMatrix() const +Matrix CoordsArray::get_matrix() const { Matrix matrix(4,4); @@ -131,14 +131,14 @@ return matrix; -void CoordsArray::GetCoords(const uint i, Coord3D& co) const throw(std::out_of_range) +void CoordsArray::get_coords(const uint i, Coord3D& co) const throw(std::out_of_range) { - if (i>=Size()) + if (i>=size()) { std::stringstream ss (std::stringstream::in | std::stringstream::out); - ss << "CoordsArray::GetCoords : out of range : "; - ss << i << " is out of bounds (object size: " << Size() << ")\n"; + ss << "CoordsArray::get_coords : out of range : "; + ss << i << " is out of bounds (object size: " << size() << ")\n"; std::string message = ss.str() ; std::cerr << message ; throw std::out_of_range (message); @@ -148,7 +148,7 @@ void CoordsArray::GetCoords(const uint i, Coord3D& co) const throw(std::out_of_ }; -void CoordsArray::SetCoords(const uint k, const Coord3D& co) +void CoordsArray::set_coords(const uint k, const Coord3D& co) { //sets the coordinate [i] to be 'co' after rotation/translation @@ -190,11 +190,11 @@ _modified(); * * Note that for this new implementation only the 4x4 rotational/translational * matrix is updated. This may allow a big speedup (to be tested) and a -* higher flexibility ( rig.Translate(a); rig.Translate(minus(a)); may now be delayed +* higher flexibility ( rig.translate(a); rig.translate(minus(a)); may now be delayed * until the coordinates are really needed. * If coordinates are never asked (why?), then no costly calculation is performed ! */ -void CoordsArray::AttractEulerRotate(dbl phi, dbl ssi, dbl rot) +void CoordsArray::euler_rotate(dbl phi, dbl ssi, dbl rot) { dbl cp, cs, ss, sp, cscp, sscp, sssp, crot, srot, cssp ; diff --git a/src/forcefield.cpp b/src/forcefield.cpp index 449c497..9f638df 100644 --- a/src/forcefield.cpp +++ b/src/forcefield.cpp @@ -55,7 +55,7 @@ void ForceField::NumDerivatives(const Vdouble& stateVars, Vdouble& delta, bool p std::cout << "Warning: using numerical derivatives in production may lead to poor performances\n" ; numerical_warning=true; } - for (uint j=0; j newvars1 = stateVars; @@ -77,7 +77,7 @@ void ForceField::NumDerivatives(const Vdouble& stateVars, Vdouble& delta, bool p if (print) { std::cout << "Numerical derivatives: \n"; - for (uint i=0; i copyforce(copy.Size()); - std::vector mainforce(lig._main.Size()); + std::vector copyforce(copy.size()); + std::vector mainforce(lig._main.size()); // dbl e = _ff.nonbon8( lig._main, _receptor._vregion[loopregion][copy] , cpl ); dbl e = _ff.nonbon8_forces(lig._main, copy, cpl, mainforce, copyforce); @@ -205,11 +205,11 @@ dbl McopForceField::Function(const Vdouble & v) { mainforce[i] = weight*mainforce[i]; } //add force to main ligand and receptor copy - assert(lig._main.Size() == mainforce.size()); - for (uint i=0; i todbl(std::vector & vcplx) void Lbfgs::minimize(int maxiter) { - int n = objToMinimize.ProblemSize(); + int n = objToMinimize.Problemsize(); std::cout << "number of free variables for the minimizer: " << n << std::endl; @@ -195,7 +195,7 @@ void Lbfgs::minimize(int maxiter) -std::vectorLbfgs::GetMinimizedVarsAtIter(uint iter) +std::vectorLbfgs::get_minimized_vars_at_iter(uint iter) { if (iter>=m_vars_over_time.size()) { diff --git a/src/pairlist.cpp b/src/pairlist.cpp index a0ca6b7..b18fa89 100644 --- a/src/pairlist.cpp +++ b/src/pairlist.cpp @@ -23,8 +23,8 @@ AttractPairList::AttractPairList(const AttractRigidbody & receptor, const Attrac mp_receptor = &receptor; no_update = true ; //if infinite cutoff - for (uint i = 0 ; i < mp_ligand->Size(); i++) - for (uint j = 0; j < mp_receptor->Size(); j++) + for (uint i = 0 ; i < mp_ligand->size(); i++) + for (uint j = 0; j < mp_receptor->size(); j++) { vectl.push_back(i); vectr.push_back(j); @@ -54,7 +54,7 @@ void AttractPairList::update() std::vector activelig; std::vector activerec; - for (uint i=0; iSize(); i++) + for (uint i=0; isize(); i++) { if (mp_ligand->isAtomActive(i)) { @@ -62,7 +62,7 @@ void AttractPairList::update() } } - for (uint i=0; iSize(); i++) + for (uint i=0; isize(); i++) { if (mp_receptor->isAtomActive(i)) { @@ -83,8 +83,8 @@ void AttractPairList::update() uint j=activerec[jj]; - Coord3D c1 = mp_ligand->GetCoords(i) ; - Coord3D c2 = mp_receptor->GetCoords(j); + Coord3D c1 = mp_ligand->get_coords(i) ; + Coord3D c2 = mp_receptor->get_coords(j); if (Norm2(c1-c2) <= squarecutoff) { vectl.push_back(i); diff --git a/src/pdbio.cpp b/src/pdbio.cpp index b1d3fbf..72cfdb5 100644 --- a/src/pdbio.cpp +++ b/src/pdbio.cpp @@ -172,7 +172,7 @@ void ReadPDB(istream& file, Rigidbody& protein) { Coord3D pos = pdbToCoords(line); Atomproperty a; pdbToAtomproperty(line, a); - protein.AddAtom(a,pos); + protein.add_atom(a,pos); } } @@ -195,17 +195,17 @@ void ReadPDB(const std::string name,Rigidbody& protein ) { } -void WritePDB(const Rigidbody& rigid, std::string filename) +void write_pdb(const Rigidbody& rigid, std::string filename) { FILE* file= fopen(filename.c_str(),"w") ; - for (uint i=0; i= this->Size()) + if (pos<0 || pos >= this->size()) { - std::string message = "SetAtom: position "; + std::string message = "set_atom: position "; message += pos; message += " is out of range"; throw std::out_of_range(message); } Atomproperty atp(atom); Coord3D co(atom.coords); - SetAtomProperty(pos, atp); - SetCoords(pos,co); + set_atom_property(pos, atp); + set_coords(pos,co); } -void Rigidbody::AddAtom(const Atom& at) +void Rigidbody::add_atom(const Atom& at) { Atomproperty atp(at); Coord3D co = at.coords; - AddAtom(atp,co); + add_atom(atp,co); } -Coord3D Rigidbody::FindCenter() const +Coord3D Rigidbody::find_center() const { Coord3D center(0.0,0.0,0.0); - for (uint i=0; i< this->Size() ; i++) + for (uint i=0; i< this->size() ; i++) { - center = center + GetCoords(i); + center = center + get_coords(i); } - return ( (1.0/(dbl)this->Size())*center); + return ( (1.0/(dbl)this->size())*center); } void Rigidbody::CenterToOrigin() { - Coord3D c = FindCenter(); - Translate(Coord3D()-c); + Coord3D c = find_center(); + translate(Coord3D()-c); } -dbl Rigidbody::RadiusGyration() +dbl Rigidbody::radius_of_gyration() { - Coord3D c = this->FindCenter(); + Coord3D c = this->find_center(); dbl r=0.0; - for (uint i=0; i< this->Size(); i++) + for (uint i=0; i< this->size(); i++) { - r += Norm2( c - this->GetCoords(i) ); + r += Norm2( c - this->get_coords(i) ); } - dbl result = sqrt( r/ (double) this->Size() ); + dbl result = sqrt( r/ (double) this->size() ); return result; } -dbl Rigidbody::Radius() +dbl Rigidbody::radius() { - Coord3D center = this->FindCenter(); - uint size = this->Size(); + Coord3D center = this->find_center(); + uint size = this->size(); dbl radius = 0.0; for (uint i=0; i < size; i++) { - dbl rad=Norm(center - this->GetCoords(i)); + dbl rad=Norm(center - this->get_coords(i)); if (radius < rad) {radius=rad;} } return radius; } -void Rigidbody::Translate(const Coord3D& tr) +void Rigidbody::translate(const Coord3D& tr) { - CoordsArray::Translate(tr); + CoordsArray::translate(tr); } -void Rigidbody::AttractEulerRotate(dbl phi, dbl ssi, dbl rot) +void Rigidbody::euler_rotate(dbl phi, dbl ssi, dbl rot) { - CoordsArray::AttractEulerRotate(phi, ssi, rot); + CoordsArray::euler_rotate(phi, ssi, rot); } -AtomSelection Rigidbody::SelectAllAtoms() const +AtomSelection Rigidbody::select_all_atoms() const { AtomSelection newsel; - newsel.SetRigid(*this); - for (uint i=0; i < Size(); i++) + newsel.set_rigid(*this); + for (uint i=0; i < size(); i++) { - newsel.AddAtomIndex(i); + newsel.add_atomIndex(i); } @@ -171,10 +171,10 @@ AtomSelection Rigidbody::SelectAllAtoms() const } -AtomSelection Rigidbody::SelectAtomType(std::string atomtype) +AtomSelection Rigidbody::select_atomtype(std::string atomtype) { AtomSelection newsel; - newsel.SetRigid(*this); + newsel.set_rigid(*this); if (atomtype.size() == 0) return newsel; @@ -189,7 +189,7 @@ AtomSelection Rigidbody::SelectAtomType(std::string atomtype) std::string & at2 = mAtomProp[i].atomType ; if (at2.substr(0, sub.size()) == sub) //compare sub to the beginning of mAtomProp[i].atomType - newsel.AddAtomIndex(i); + newsel.add_atomIndex(i); } @@ -197,60 +197,60 @@ AtomSelection Rigidbody::SelectAtomType(std::string atomtype) else - for (uint i=0; i=start && atp.residId <= stop) newsel.AddAtomIndex(i); + if (atp.residId >=start && atp.residId <= stop) newsel.add_atomIndex(i); } return newsel; } -AtomSelection Rigidbody::CA() { - return SelectAtomType("CA"); +AtomSelection Rigidbody::get_CA() { + return select_atomtype("CA"); } -bool isBackbone(const std::string & atomtype) +bool isbackbone(const std::string & atomtype) { const std::string bbtypes[] = {"N", "CA", "C", "O"}; @@ -265,16 +265,16 @@ bool isBackbone(const std::string & atomtype) } -AtomSelection Rigidbody::Backbone() +AtomSelection Rigidbody::backbone() { AtomSelection newsel; - newsel.SetRigid(*this); + newsel.set_rigid(*this); - for (uint i=0; iSize(); i++) + for (uint i=0; isize(); i++) { - if (isBackbone(CopyAtom(i).atomType) ) + if (isbackbone(copy_atom(i).atomType) ) { - newsel.AddAtomIndex(i); + newsel.add_atomIndex(i); } } @@ -285,40 +285,40 @@ AtomSelection Rigidbody::Backbone() /// operator + Rigidbody Rigidbody::operator+(const Rigidbody& rig) { Rigidbody rigFinal(*this); - for (uint i=0; i< rig.Size() ; i++) { - rigFinal.AddCoord(rig.GetCoords(i)); + for (uint i=0; i< rig.size() ; i++) { + rigFinal.add_coord(rig.get_coords(i)); rigFinal.mAtomProp.push_back(rig.mAtomProp[i]); } return rigFinal; } -void Rigidbody::ABrotate(const Coord3D& A, const Coord3D& B, dbl theta) +void Rigidbody::rotate(const Coord3D& A, const Coord3D& B, dbl theta) { - PTools::ABrotate(A,B, *this, theta); + PTools::rotate(A,B, *this, theta); } -std::string Rigidbody::PrintPDB() const +std::string Rigidbody::print_pdb() const { - uint size=this->Size(); + uint size=this->size(); std::string output; for (uint i=0; i < size-1 ; i++) { - Atom at(mAtomProp[i], this->GetCoords(i)); - output = output + at.ToPdbString() + "\n" ; + Atom at(mAtomProp[i], this->get_coords(i)); + output = output + at.to_pdb_string() + "\n" ; } - Atom at(mAtomProp[size-1], this->GetCoords(size-1)); - output += at.ToPdbString(); // append the last pdb string, without "\n" + Atom at(mAtomProp[size-1], this->get_coords(size-1)); + output += at.to_pdb_string(); // append the last pdb string, without "\n" return output; } -void Rigidbody::ApplyMatrix(const Matrix& mat) +void Rigidbody::apply_matrix(const Matrix& mat) { dbl mat44[4][4]; diff --git a/src/rmsd.cpp b/src/rmsd.cpp index 64efb19..0e1296a 100644 --- a/src/rmsd.cpp +++ b/src/rmsd.cpp @@ -18,30 +18,30 @@ namespace PTools { -dbl Rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2) +dbl rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2) { - if (atsel1.Size() == 0 || atsel2.Size() == 0) + if (atsel1.size() == 0 || atsel2.size() == 0) { throw std::invalid_argument("EmptyRigidbody"); } - if (atsel1.Size() != atsel2.Size()) + if (atsel1.size() != atsel2.size()) { - throw std::invalid_argument("RmsdSizesDiffers"); + throw std::invalid_argument("rmsdsizesDiffers"); } dbl sum = 0.0; - for (uint i=0; i& forcerec, std::vector& forcelig, bool print) { - assert(forcerec.size() == rec.Size()); - assert(forcelig.size() == lig.Size()); + assert(forcerec.size() == rec.size()); + assert(forcelig.size() == lig.size()); dbl sumLJ=0.0 ; dbl sumElectrostatic=0.0; - //synchronize coordinates for using unsafeGetCoords - rec.syncCoords(); - lig.syncCoords(); + //synchronize coordinates for using unsafeget_coords + rec.sync_coords(); + lig.sync_coords(); Coord3D a, b; - for (uint iter=0; iter