OK. When I tried modifying the core module, I modified modules/core/include/RigidBodyMover.h RigidBodyMover class as follows:
Added to public: RigidBodyMover(RigidBody d, RigidBody d2, RigidBody d3,
Float max_translation, Float max_rotation);
Added to private: RigidBody d2_;
RigidBody d3_;
Then, to modules/core/src/RigidBodyMover.cpp, I added the following:
RigidBodyMover::RigidBodyMover(RigidBody d, RigidBody d2, RigidBody d3,
Float max_translation, Float max_angle) {
IMP_LOG(VERBOSE,"start RigidBodyMover constructor");
max_translation_=max_translation;
max_angle_ =max_angle;
d_= d;
d2_ = d2;
d3_ = d3;
IMP_LOG(VERBOSE,"finish mover construction" << std::endl);
}
All this does is add a constructor which takes in two extra RigidBody objects and sets d2_ and d3_. IMP compiles without complaining, but when I try and run my script, I get this error:
Traceback (most recent call last):
File "newtest3_test_unchanged_symm.py", line 10, in ?
import IMP.atom
File "/farm/home/moal01/bin/imp-1.0/lib64/python2.4/site-packages/IMP/atom/__init__.py", line 161, in ?
import IMP.core
File "/farm/home/moal01/bin/imp-1.0/lib64/python2.4/site-packages/IMP/core/__init__.py", line 28, in ?
import _IMP_core
ImportError: /farm/home/moal01/bin/imp-1.0/lib64/python2.4/site-packages/_IMP_core.so: undefined symbol: _ZN3IMP4core14RigidBodyMoverC1ENS0_9RigidBodyES2_S2_dd
When I run nm on IMP_core.so, I get
U IMP::core::RigidBodyMover::RigidBodyMover(IMP::core::RigidBody, IMP::core::RigidBody, IMP::core::RigidBody, double, double)
U IMP::core::RigidBodyMover::RigidBodyMover(IMP::core::RigidBody, double, double)
I haven't a clue why this doesn't work! Because this didn't work, I started again from scratch and attempted to implement a new module called 'symm'. I included only the SConscript files and the following files: in modules/symm/include/ : http://bmm.cancerresearchuk.org/~moal01/IMP/symm_config.h http://bmm.cancerresearchuk.org/~moal01/IMP/SymmM.h in modules/symm/src/ : http://bmm.cancerresearchuk.org/~moal01/IMP/symm_config.cpp http://bmm.cancerresearchuk.org/~moal01/IMP/SymmM.cpp
This time, IMP fails to compile. Scons gives this error: scons: warning: Two different environments were specified for target /farm/home/moal01/SOFT/imp-1.0/build/include/IMP/symm/symm_config.h,
but they appear to have the same action: installFunc(target, source, env)
File "/farm/home/moal01/SOFT/imp-1.0/scons_tools/symlinks.py", line 32, in LinkInstall
Just before crashing, it doesn't seem to accept my class name:
Install file: "modules/symm/include/SymmM.h" as "build/include/IMP/symm/SymmM.h"
g++ -o modules/symm/src/SymmM.os -c -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fno-strict-aliasing -Wall -Woverloaded-virtual -O2 -fvisibility=hidden -fPIC -DIMP_DATA_DIRECTORY="/farm/home/moal01/bin/imp-1.0/share/imp" -DIMP_EXAMPLE_DIRECTORY="/farm/home/moal01/bin/imp-1.0/share/doc/imp/examples" -D_USE_MATH_DEFINES -D_USE_MATH_DEFINES -DIMPSYMM_EXPORTS -DGCC_VISIBILITY -Ibuild/include -I/usr/local/include modules/symm/src/SymmM.cpp
build/include/IMP/symm/SymmM.h:24: error: expected class-name before '{' token
build/include/IMP/symm/SymmM.h:26: error: expected `)' before 'RigidBody'
build/include/IMP/symm/SymmM.h:36: error: 'RigidBody' does not name a type
build/include/IMP/symm/SymmM.h:37: error: 'RigidBody' does not name a type
build/include/IMP/symm/SymmM.h:38: error: 'RigidBody' does not name a type
modules/symm/src/SymmM.cpp:15: error: expected `)' before 'd'
modules/symm/src/SymmM.cpp:64: error: expected `}' at end of input
modules/symm/src/SymmM.cpp:64: error: expected `}' at end of input
scons: *** [modules/symm/src/SymmM.os] Error 1
scons: building terminated because of errors.
Its very frustrating. I can't make heads nor tails of it! Anyway, I will try your suggestion of implementing the symmetry as a constraint. Hopefully I can do this just in my python scripts without having to delve into any more C++ code.
Thank you again Daniel, I will let you know how I get on with the constraints.
Iain
________________________________________ From: imp-users-bounces@salilab.org [imp-users-bounces@salilab.org] On Behalf Of Daniel Russel [drussel@gmail.com] Sent: 13 March 2011 15:00 To: Help and discussion for users of IMP Subject: Re: [IMP-users] IMP-users Digest, Vol 10, Issue 2
On Mar 12, 2011, at 5:29 PM, Iain Moal wrote:
> Thank you for the reply Daniel. I want to have something similar to the rigid body mover, except when the RigidBody object is moved, objects which are related to it by a Cn symmetry operation are moved in such as was as to preserve the symmetry, just as SymmetrySampler samples when using domino. I think an easier way to do this is to set it up as a constraint. That is, let rb0 be your original rigid body and rb1 your symmetry related one (and tr the transform that relates them). Then one can implement a SingletonModifier (which, to be honest we should have already, but don't) called something like TransformedFrom that in its apply call does something like rb1.set_reference_frame(tr*rb0.get_reference_frame().get_transformation_to()) to force rb1 to be in the position defined by rb0. Then you would do trfr= IMP.core.TransformedFrom(rb0, tr) c= IMP.core.SingletonConstraint(trfr, None, rb1) model.add_constraint(c)
See IMP.core.Transform for a class that is very similar to IMP.core.TransformedFrom (but not very useful).
Does that make sense?
> > I have tried this by adding an overloaded RigidBodyMover constructor which takes in a Particles*, and by creating a new 'SymmerticalRigidBodyMover' class in the core model. However, after re-compiling, _IMP_core.so doesn't contain the new functions and crashes when I try to import IMP into python. I've also tried creating a new module containg my desired Mover class, but it doesn't even compile. There are three likely causes: If "import IMP.core" works, but you can't use your new class, then probably you forgot to add the %include and IMP_SWIG_OBJECT lines to the swig.i-in in core/pyext (or didn't add the .cpp and .h to the SConscripts in core).
If "import IMP.core" fails with an error about a missing symbol, then either, IMPCOREEXPORT is missing on the SymmerticalRigidBodyMover or one or more of the required functions for SymmerticalRigidBodyMover is not implemented in the .cpp file.
If you post error message, it might be clearer. There are an unfortunately large number of things that have to be in place to get a class working all the way through to python. I haven't been able to reduce the number much.
> > Thanks, > Iain > > ________________________________________ > From: imp-users-bounces@salilab.org [imp-users-bounces@salilab.org] On Behalf Of imp-users-request@salilab.org [imp-users-request@salilab.org] > Sent: 12 March 2011 20:00 > To: imp-users@salilab.org > Subject: IMP-users Digest, Vol 10, Issue 2 > > Send IMP-users mailing list submissions to > imp-users@salilab.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://salilab.org/mailman/listinfo/imp-users > or, via email, send a message with subject or body 'help' to > imp-users-request@salilab.org > > You can reach the person managing the list at > imp-users-owner@salilab.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of IMP-users digest..." > > > Today's Topics: > > 1. Re: Symmetry (Daniel Russel) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 12 Mar 2011 11:58:04 -0800 > From: Daniel Russel drussel@gmail.com > Subject: Re: [IMP-users] Symmetry > To: Help and discussion for users of IMP imp-users@salilab.org, > Keren Lasker kerenlasker@gmail.com > Message-ID: 2093665D-E853-471A-9F1D-2641669FC29E@gmail.com > Content-Type: text/plain; charset=us-ascii > > > On Mar 11, 2011, at 12:05 AM, Iain Moal wrote: > >> Hi, >> I am new to IMP so please fogive naievity! >> Is it possible to use IMP::domino::SymmetrySampler as a Monte Carlo mover? If not, how could I impliment it as a mover. It isn't evident how I could impliment this using MoverBase, nor what the list of attributes are for. > I'm unclear on exactly what you would want as your move set? Picking a random choice from a discrete set? Chances are that you want to use the X,Y,Z coordinate keys as the float attributes list when using the MoverBase (you can get those from IMP::core::XYZ::get_coordinate_keys()). If you then store a list of coordinate values in your Mover, you can pick one of those for each particle to be moved and do IMP::core::XYZ(p).set_coordinates(new_coordinates) to change them. > > Does that help? > > >> Also, when reconstructing em maps, such as in particles2density, I get this warning: >> WARNING could not find parameters for radius:8.16743 >> EM map is using default params >> >> What does this mean, are the default params ok? > Keren will have to answer this. > > Daniel > > > ------------------------------ > > _______________________________________________ > IMP-users mailing list > IMP-users@salilab.org > https://salilab.org/mailman/listinfo/imp-users > > > End of IMP-users Digest, Vol 10, Issue 2 > **************************************** > > This communication is from Cancer Research UK. Our website is at www.cancerresearchuk.org. We are a registered charity in England and Wales (1089464) and in Scotland (SC041666) and a company limited by guarantee registered in England and Wales under number 4325234. Our registered address is Angel Building, 407 St John Street, London, EC1V 4AD. Our central telephone number is 020 7242 0200. > > This communication and any attachments contain information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of disclosure, distribution, copying or use of this communication or the information in it or in any attachments is strictly prohibited and may be unlawful. If you have received this communication in error, please notify the sender and delete the email and destroy any copies of it. > > E-mail communications cannot be guaranteed to be secure or error free, as information could be intercepted, corrupted, amended, lost, destroyed, arrive late or incomplete, or contain viruses. We do not accept liability for any such matters or their consequences. Anyone who communicates with us by e-mail is taken to accept the risks in doing so. > > _______________________________________________ > IMP-users mailing list > IMP-users@salilab.org > https://salilab.org/mailman/listinfo/imp-users
_______________________________________________ IMP-users mailing list IMP-users@salilab.org https://salilab.org/mailman/listinfo/imp-users
This communication is from Cancer Research UK. Our website is at www.cancerresearchuk.org. We are a registered charity in England and Wales (1089464) and in Scotland (SC041666) and a company limited by guarantee registered in England and Wales under number 4325234. Our registered address is Angel Building, 407 St John Street, London, EC1V 4AD. Our central telephone number is 020 7242 0200.
This communication and any attachments contain information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of disclosure, distribution, copying or use of this communication or the information in it or in any attachments is strictly prohibited and may be unlawful. If you have received this communication in error, please notify the sender and delete the email and destroy any copies of it.
E-mail communications cannot be guaranteed to be secure or error free, as information could be intercepted, corrupted, amended, lost, destroyed, arrive late or incomplete, or contain viruses. We do not accept liability for any such matters or their consequences. Anyone who communicates with us by e-mail is taken to accept the risks in doing so.