def test_atom_pair_featurizer(self): """ Create an atom pair collectivevariable using MSMSBuilder3 """ atom_pairs = [[0, 1], [10, 14]] atom_pair_op = op.MSMBFeaturizerCV( "atom_pairs", AtomPairsFeaturizer, topology=self.topology, pair_indices=atom_pairs) md_distances = md.compute_distances(self.mdtraj, atom_pairs) my_distances = atom_pair_op(self.traj_topology) np.testing.assert_allclose(md_distances, my_distances, rtol=10 ** -6, atol=10 ** -10)
def test_return_parameters_from_template(self): atom_pairs = [[0, 1], [10, 14]] atom_pair_op = op.MSMBFeaturizerCV("atom_pairs", AtomPairsFeaturizer, topology=self.topology, pair_indices=atom_pairs) # little trick. We just pretend the atom_pairs_op is a function we want # to use it cannot be stored though, but for from_template it is enough params = NetCDFPlus.get_value_parameters( atom_pair_op(self.traj_topology[0])) assert params['var_type'] == 'numpy.float32' assert params['simtk_unit'] is None assert params['dimensions'] == tuple([2])