[dev] determine which score_type’s enabled in create_energy_method?

Member Site Forums Rosetta 3 Rosetta 3 – General [dev] determine which score_type’s enabled in create_energy_method?

Viewing 1 reply thread
  • Author
    Posts
    • #2765
      Anonymous

        Hey,

        I have created an energy method and it works. However, I want to do a check at the time it is created for whether a particular score_type is enabled. Is there any way to know which score_types are enabled from within my create_energy_method function?

        Thanks!

        – Igor

      • #13834
        Anonymous

          No, there’s no way of determining what the weights are from the EnergyMethodCreator::create_energy_method() object.

          The good news is that the create_energy_method() method for your particular EnergyMethod will not be called unless  one of the score types from the score_types_for_method() is enabled in the Scorefunction.  So if your EnergyMethod only controls one score type, you can be confident that the create_energy_method() will only be called if that score_type is enabled.

          If your EnergyMethod controls several different score_types, and you want to change how you create the EnergyMethod object based on which one (or both) are enabled, then that’s another story. However, you probably don’t need/want to do that. If it’s completely different EnergyMethod objects that need to get created, then you’re better off just making multiple EnergyMethodCreators, one for each EnergyMethod type.  If it’s the same EnergyMethod class, just constructed differently, then you’re probably better off changing the EnergyMethod constructor to work generally (regardless of what the weights are), and then move the switching logic into the EnergyMethod’s functions, where you can get the weights vector.

          If that’s an unsatisfactory answer, perhaps you can describe in more detail what you hope to do, and I can make more targeted suggestions.

          • #13838
            Anonymous

              … If it’s the same EnergyMethod class, just constructed differently, then you’re probably better off changing the EnergyMethod constructor to work generally (regardless of what the weights are), and then move the switching logic into the EnergyMethod’s functions, where you can get the weights vector. …

              Thanks for the very thorough respose. It is the case that most of the computation is the same, so I don’t want to create two different energy methods. Some of the score terms require a native structure, but most do not. I guess I’ll probably just check in the “setup_for_*” methods.

            • #13839
              Anonymous

                That’s how I’d probably do it.

          Viewing 1 reply thread
          • You must be logged in to reply to this topic.