choderalab / chiron

Differentiable Markov Chain Monte Carlo
https://github.com/choderalab/chiron/wiki
MIT License
14 stars 1 forks source link

Create Chiron TestSystem class #30

Open chrisiacovella opened 6 months ago

chrisiacovella commented 6 months ago

We should implement a TestSystem class in chiron, rather than having to import and convert openmmtools TestSystems.

chrisiacovella commented 6 months ago

Notes about structure of this class from a comment on PR #21 by @jchodera

Instead of a bunch of TestSystem.get_X_property() methods, what about a single TestSystem.get_analytical_properties() method that returns a dict of the available analytical properties? There, we just need to standardize the ontology of property definitions we use in that single method.

chrisiacovella commented 6 months ago

Preliminary mockup of the TestSystem class:

class TestSystem # base class that defines the basic API
     .analytical_properties # read-only property that returns a `dict` of analytical properties with units attached
     .sampler_state # initial sampler state (with appropriate box vectors)
     .thermodynamic_state # includes the potential and Topology (can be overwritten)
     .description # human-readable description
     .keywords # keyword tags that allow us to select subset of tests (e.g. 'condensed-phase', 'ideal-gas', 'vacuum', 'unit-test', 'expensive'

The idea is to make the test self contained, so we only need a few lines of code to set up a test case.

Some test systems we are considering initially:

  class NoninteractingTestSystem # base class for things like ideal atomic and molecular gasses
     class IdealAtomicGas
     class IdealMolecularGas # e.g. N2, O2, CO2, H2O

  class HarmonicOscillatorTestSystem
  class HarmonicOscillatorArray

 class LennardJones
  class LennardJonesFluid
  class LennardJonesCluster
  class LennardJonesDimer

class VacuumMolecularSystem
      def __init__(self, SMILES, potential_type) # Create molecular system for the SMILES string
           SMILES : molecular species
           pretrained_model : 'SAKE', '...' # pretrained model

                     # logic for setting up the config and 
                     # initializing sampler state and the thermodynamic state

  class EthanolSAKEMolecularSystem(VacuumMolecularSystem)

  #could have different ways of setting up
  test_ethanol = EthanolSAKEMolecularSystem()

  testsystem = VacuumMolecularSystem('CCO', 'SAKE-0.1')

  testsystem.thermodynamic_state.temperature = 300*unit.kelvin
chrisiacovella commented 6 months ago

This change will help to remove the dependency on openmm and openmmtools.