%{ #include %} %pythoncode %{ import os i_m_p="IMP_MODULE_PATH" if i_m_p in os.environ.keys(): __path__.insert(0, os.environ[i_m_p]) def _forward_add_attribute(self, name, value, opt=None): if opt is not None: self.get_particle().add_attribute(name, value, opt) else: self.get_particle().add_attribute(name, value) def _forward_get_value(self, name): self.get_particle().get_value(name) def _forward_set_value(self, name, value): self.get_particle().set_value(name, value) %} %typemap(in) char * { strings_must_be_passed_by_std_string; } %typemap(out) char * { strings_must_be_passed_by_std_string; } %extend IMP::kernel::Particle { bool __eq__(const Particle *o) const { return self ==o; } bool __ne__(const Particle *o) const { return self !=o; } bool __le__(const Particle *o) const { return self <= o; } bool __lt__(const Particle *o) const { return self < o; } bool __ge__(const Particle *o) const { return self >= o; } bool __gt__(const Particle *o) const { return self > o; } bool __eq__(const IMP::kernel::Decorator &d) const { return self == d.get_particle(); } bool __ne__(const IMP::kernel::Decorator &d) const { return self != d.get_particle(); } bool __le__(const IMP::kernel::Decorator &d) const { return self <= d.get_particle(); } bool __lt__(const IMP::kernel::Decorator &d) const { return self < d.get_particle(); } bool __ge__(const IMP::kernel::Decorator &d) const { return self >= d.get_particle(); } bool __gt__(const IMP::kernel::Decorator &d) const { return self > d.get_particle(); } } #if IMP_BUILD == IMP_RELEASE %pythoncode %{ build="release" %} #else %pythoncode %{ build="debug" %} #endif namespace IMP { namespace kernel { %warnfilter(473) Refiner; %warnfilter(473) SingletonContainer; %warnfilter(473) PairContainer; %warnfilter(403) Constraint; %warnfilter(403) Container; %warnfilter(403) ModelObject; %warnfilter(473) Sampler; %warnfilter(473) Restraint; %warnfilter(403) Restraint; } } // to avoid extend clash IMP_SWIG_BASE_OBJECT(IMP::kernel,Constraint, Constraints); IMP_SWIG_BASE_OBJECT(IMP::kernel,Undecorator, Undecorators); IMP_SWIG_BASE_OBJECT(IMP::kernel,Container, Containers); IMP_SWIG_BASE_OBJECT(IMP::kernel,Optimizer, Optimizers); IMP_SWIG_BASE_OBJECT(IMP::kernel,OptimizerState, OptimizerStates); IMP_SWIG_BASE_OBJECT(IMP::kernel,PairContainer, PairContainers); IMP_SWIG_BASE_OBJECT(IMP::kernel,PairModifier, PairModifiers); IMP_SWIG_BASE_OBJECT(IMP::kernel,PairScore, PairScores); IMP_SWIG_BASE_OBJECT(IMP::kernel,QuadContainer, QuadContainers); IMP_SWIG_BASE_OBJECT(IMP::kernel,QuadModifier, QuadModifiers); IMP_SWIG_BASE_OBJECT(IMP::kernel,QuadScore, QuadScores); IMP_SWIG_BASE_OBJECT(IMP::kernel,Refiner, Refiners); IMP_SWIG_BASE_OBJECT(IMP::kernel,Restraint, Restraints); IMP_SWIG_BASE_OBJECT(IMP::kernel,Sampler, Samplers); IMP_SWIG_BASE_OBJECT(IMP::kernel,ScoreState, ScoreStates); IMP_SWIG_BASE_OBJECT(IMP::kernel,SingletonContainer, SingletonContainers); IMP_SWIG_BASE_OBJECT(IMP::kernel,SingletonModifier, SingletonModifiers); IMP_SWIG_BASE_OBJECT(IMP::kernel,SingletonScore, SingletonScores); IMP_SWIG_BASE_OBJECT(IMP::kernel,TripletContainer, TripletContainers); IMP_SWIG_BASE_OBJECT(IMP::kernel,TripletModifier, TripletModifiers); IMP_SWIG_BASE_OBJECT(IMP::kernel,TripletScore, TripletScores); IMP_SWIG_BASE_OBJECT(IMP::kernel,UnaryFunction, UnaryFunctions); IMP_SWIG_OBJECT(IMP::kernel,ConfigurationSet, ConfigurationSets); IMP_SWIG_OBJECT(IMP::kernel,Configuration, Configurations); IMP_SWIG_OBJECT(IMP::kernel,Model, Models); IMP_SWIG_OBJECT(IMP::kernel,Particle, Particles); #if IMP_HAS_DEPRECATED IMP_SWIG_BASE_OBJECT(IMP::kernel::internal,PythonRestraint, PythonRestraints); IMP_SWIG_BASE_OBJECT(IMP::kernel::internal,PythonScoreState, PythonScoreStates); #endif IMP_SWIG_NESTED_SEQUENCE_TYPEMAP(IMP::kernel::Particle, IMP::kernel::ParticlesTemp, IMP::kernel::ParticlesTemps, const&); IMP_SWIG_NESTED_SEQUENCE_TYPEMAP(IMP::kernel::Particle, IMP::kernel::ParticlesTemp, IMP::kernel::ParticlesTemps,); IMP_SWIG_OBJECT(IMP::kernel,RestraintSet, RestraintSets); IMP_SWIG_ARRAY(IMP::kernel, ParticlePair, ParticlePairsTemp, IMP::Particle); IMP_SWIG_ARRAY(IMP::kernel, ParticleTriplet, ParticleTripletsTemp, IMP::Particle); IMP_SWIG_ARRAY(IMP::kernel, ParticleQuad, ParticleQuadsTemp, IMP::Particle); IMP_SWIG_ARRAY(IMP::kernel, ParticleIndexPair, ParticleIndexPairs, IMP::ParticleIndex); IMP_SWIG_ARRAY(IMP::kernel, ParticleIndexTriplet, ParticleIndexTriplets, IMP::ParticleIndex); IMP_SWIG_ARRAY(IMP::kernel, ParticleIndexQuad, ParticleIndexQuads, IMP::ParticleIndex); IMP_SWIG_BASE_OBJECT(IMP::kernel, SingletonPredicate, SingletonPredicates); IMP_SWIG_BASE_OBJECT(IMP::kernel, PairPredicate, PairPredicates); IMP_SWIG_BASE_OBJECT(IMP::kernel, TripletPredicate, TripletPredicates); IMP_SWIG_BASE_OBJECT(IMP::kernel, QuadPredicate, QuadPredicates); IMP_SWIG_OBJECT(IMP::kernel, SaveToConfigurationSetOptimizerState, SaveToConfigurationSetOptimizerStates); // derivative accumulator is weird // IMP_SWIG_VALUE(IMP::kernel, DerivativeAccumulator, DerivativeAccumulators); IMP_SWIG_VALUE(IMP::kernel, EvaluationState, EvaluationStates); IMP_SWIG_VALUE(IMP::kernel, ScoreAccumulator, ScoreAccumulators); IMP_SWIG_VALUE_INSTANCE(IMP::kernel, ParticleIndex, IMP::base::Index, ParticleIndexes); IMP_SWIG_VALUE(IMP::kernel, FloatIndex, FloatIndexes); IMP_SWIG_VALUE_INSTANCE(IMP::kernel, FloatKey, Key, FloatKeys); IMP_SWIG_VALUE_INSTANCE(IMP::kernel, IntKey, Key, IntKeys); IMP_SWIG_VALUE_INSTANCE(IMP::kernel, StringKey, Key, StringKeys); IMP_SWIG_VALUE_INSTANCE(IMP::kernel, ParticleIndexKey, Key, ParticleIndexKeys); IMP_SWIG_VALUE_INSTANCE(IMP::kernel, ParticleIndexesKey, Key, ParticleIndexesKeys); IMP_SWIG_VALUE_INSTANCE(IMP::kernel, ObjectKey, Key, ObjectKeys); IMP_SWIG_VALUE_TEMPLATE(IMP::kernel, Key); IMP_SWIG_RAII_INSTANCE(IMP::kernel, ScopedRestraint, GenericScopedRestraint); IMP_SWIG_RAII_INSTANCE(IMP::kernel, ScopedRemoveRestraint, GenericScopedRemoveRestraint); IMP_SWIG_RAII_INSTANCE(IMP::kernel, ScopedRemoveScoreState, GenericScopedRemoveScoreState); IMP_SWIG_RAII_INSTANCE(IMP::kernel, ScopedScoreState, GenericScopedScoreState); IMP_SWIG_RAII_TEMPLATE(IMP::kernel, GenericScopedRestraint); IMP_SWIG_RAII_TEMPLATE(IMP::kernel, GenericScopedScoreState); IMP_SWIG_RAII_TEMPLATE(IMP::kernel, ScopedSetAttribute); IMP_SWIG_RAII_INSTANCE(IMP::kernel, ScopedSetFloatAttribute, ScopedSetAttribute); IMP_SWIG_VALUE(IMP::kernel, RestraintStatistics, RestraintStatisticsList); IMP_SWIG_BASE_OBJECT(IMP::kernel, ScoringFunction, ScoringFunctions); IMP_SWIG_BASE_OBJECT(IMP::kernel, ModelObject, ModelObjects); IMP_SWIG_DECORATOR(IMP::kernel::internal, _TrivialDecorator, _TrivialDecorators); IMP_SWIG_DECORATOR(IMP::kernel::internal, _TrivialDerivedDecorator, _TrivialDerivedDecorators); IMP_SWIG_DECORATOR_WITH_TRAITS(IMP::kernel::internal, _TrivialTraitsDecorator, _TrivialTraitsDecorators); IMP_SWIG_OBJECT(IMP::kernel::internal, _ConstRestraint, _ConstRestraints); IMP_SWIG_OBJECT(IMP::kernel::internal, _ConstOptimizer, _ConstOptimizers); IMP_SWIG_GRAPH(IMP::kernel, DependencyGraph, DependencyGraph, IMP::kernel::ModelObject*); IMP_SWIG_CONTAINER(IMP::kernel, IMP::kernel, RestraintSet, Restraint, restraint) IMP_SWIG_CONTAINER(IMP::kernel, IMP::kernel, Model, ScoreState, score_state) IMP_SWIG_CONTAINER(IMP::kernel, IMP::kernel, Model, Restraint, restraint) IMP_SWIG_CONTAINER(IMP::kernel, IMP::kernel, Optimizer, OptimizerState, optimizer_state) %include "IMP/kernel/utility.h" %include "IMP/kernel/Key.h" namespace IMP { namespace kernel { %template(FloatKey) ::IMP::kernel::Key<0, true>; %template(IntKey) ::IMP::kernel::Key<1, true>; %template(StringKey) ::IMP::kernel::Key<2, true>; %template(ParticleIndexKey) ::IMP::kernel::Key<3, true>; %template(ObjectKey) ::IMP::kernel::Key<4, true>; %template(ParticleIndexesKey) ::IMP::kernel::Key<6, true>; %template(ParticleIndex) ::IMP::base::Index; } } %inline %{ namespace IMP { namespace kernel { template class Decorators; } } %} %pythoncode %{ def ParticlePair(a, b): return (a,b) def ParticleTriplet(a, b, c): return (a,b,c) def ParticleQuad(a, b, c, d): return (a,b,c,d) %} %rename(_ParticleIndexTag) ParticleIndexTag; %rename(_ScoringFunctionAdaptor) ScoringFunctionAdaptor; %rename(_SingletonContainerAdaptor) SingletonContainerAdaptor; %rename(_PairContainerAdaptor) PairContainerAdaptor; %rename(_TripletContainerAdaptor) TripletContainerAdaptor; %rename(_QuadContainerAdaptor) QuadContainerAdaptor; %include "IMP/kernel/particle_index.h" %include "IMP/kernel/FloatIndex.h" %include "IMP/kernel/base_types.h" %include "IMP/kernel/constants.h" %include "IMP/kernel/ModelObject.h" %include "IMP/kernel/input_output.h" %include "IMP/kernel/utility.h" %include "IMP/kernel/DerivativeAccumulator.h" %include "IMP/kernel/ScoreAccumulator.h" %include "IMP/kernel/ScoreState.h" %include "IMP/kernel/Constraint.h" %include "IMP/kernel/container_base.h" namespace IMP { namespace kernel { class Restraints; class ScoreStates; } } %include "IMP/kernel/declare_Restraint.h" %include "IMP/kernel/declare_RestraintSet.h" %include "IMP_kernel.particle.i" %include "IMP/kernel/dependency_graph.h" %include "IMP/kernel/declare_ScoringFunction.h" %include "IMP/kernel/Undecorator.h" %include "IMP/kernel/declare_Model.h" %include "IMP/kernel/Decorator.h" %include "IMP/kernel/UnaryFunction.h" %include "IMP/kernel/OptimizerState.h" %include "IMP/kernel/Refiner.h" %include "IMP/kernel/Optimizer.h" %include "IMP/kernel/ConfigurationSet.h" %include "IMP/kernel/Configuration.h" %include "IMP/kernel/Sampler.h" %include "IMP/kernel/PairDerivativeModifier.h" %include "IMP/kernel/PairModifier.h" %include "IMP/kernel/PairScore.h" %include "IMP/kernel/PairPredicate.h" %include "IMP/kernel/declare_PairContainer.h" %include "IMP/kernel/QuadDerivativeModifier.h" %include "IMP/kernel/QuadModifier.h" %include "IMP/kernel/QuadScore.h" %include "IMP/kernel/QuadPredicate.h" %include "IMP/kernel/declare_QuadContainer.h" %include "IMP/kernel/SingletonDerivativeModifier.h" %include "IMP/kernel/SingletonModifier.h" %include "IMP/kernel/SingletonScore.h" %include "IMP/kernel/SingletonPredicate.h" %include "IMP/kernel/declare_SingletonContainer.h" %include "IMP/kernel/TripletDerivativeModifier.h" %include "IMP/kernel/TripletModifier.h" %include "IMP/kernel/TripletScore.h" %include "IMP/kernel/TripletPredicate.h" %include "IMP/kernel/declare_TripletContainer.h" %include "IMP/kernel/io.h" %include "IMP/kernel/internal/swig.h" %include "IMP/kernel/scoped.h" namespace IMP { namespace kernel { %template(ScopedScoreState) ::IMP::kernel::GenericScopedScoreState< IMP::kernel::ScoreState>; %template(ScopedRestraint) ::IMP::kernel::GenericScopedRestraint< IMP::kernel::Restraint>; %template(ScopedRemoveRestraint) ::IMP::kernel::GenericScopedRemoveRestraint< IMP::kernel::Restraint>; %template(ScopedRemoveScoreState) ::IMP::kernel::GenericScopedRemoveScoreState< IMP::kernel::ScoreState>; %template(ScopedSetFloatAttribute) ::IMP::kernel::ScopedSetAttribute; } } %pythoncode %{ #used_modules=[] #def show_used_modules(): # for m in used_modules: # print "%-20s %s" % (m.get_module(), m.get_version()) import IMP.base get_networkx_graph=IMP.base.get_networkx_graph show_altgraph=IMP.base.show_altgraph show_graphviz=IMP.base.show_graphviz SetLogState= IMP.base.SetLogState SetLogTarget= IMP.base.SetLogTarget Object= IMP.base.Object NONE= IMP.base.NONE USAGE= IMP.base.USAGE USAGE_AND_INTERNAL= IMP.base.USAGE_AND_INTERNAL TERSE= IMP.base.TERSE SILENT= IMP.base.SILENT VERBOSE= IMP.base.VERBOSE WARNING= IMP.base.WARNING PROGRESS= IMP.base.PROGRESS MEMORY= IMP.base.MEMORY create_temporary_file= IMP.base.create_temporary_file create_temporary_file_name= IMP.base.create_temporary_file_name random_number_generator= IMP.base.random_number_generator set_log_level=IMP.base.set_log_level set_log_timer=IMP.base.set_log_timer get_log_level=IMP.base.get_log_level add_to_log= IMP.base.add_to_log set_check_level= IMP.base.set_check_level get_check_level= IMP.base.get_check_level # Ensure that Windows gets the PATH set to include anything in the library # search path if sys.platform == 'win32' and 'IMP_LD_PATH' in os.environ: dirs = os.environ['IMP_LD_PATH'].split(":") pathcomps = os.environ['PATH'].split(";") for d in dirs: if d not in pathcomps: os.environ['PATH'] = d + ';' + os.environ['PATH'] %} #if IMP_HAS_DEPRECATED %pythoncode %{ RestraintBase=Restraint ScoreStateBase=ScoreState Restraint=PythonRestraint ScoreState=PythonScoreState IOException=IMP.base.IOException ValueException=IMP.base.ValueException ModelException=IMP.base.ModelException IOException=IMP.base.IOException IOException=IMP.base.IOException %} #endif %include "IMP_kernel.dispatcher.i" %include "IMP_kernel.optparse.i"