Exemple #1
0
def test_processor_weight(mol_with_variable, weight):
    processor = average_beads.DoAverageBead(weight=weight)
    mol = processor.run_molecule(mol_with_variable)
    target_key = 'target {}'.format(weight)
    target_positions = np.stack([node[target_key] for node in mol_with_variable.nodes.values()])
    positions = np.stack([node['position'] for node in mol_with_variable.nodes.values()])
    assert np.allclose(positions, target_positions, equal_nan=True)
Exemple #2
0
def test_processor_variable(mol_with_variable):
    processor = average_beads.DoAverageBead()
    mol = processor.run_molecule(mol_with_variable)
    weight = mol_with_variable.force_field.variables['center_weight']
    target_key = 'target {}'.format(weight)
    target_positions = np.stack(
        [node[target_key] for node in mol_with_variable.nodes.values()])
    positions = np.stack(
        [node['position'] for node in mol_with_variable.nodes.values()])
    assert np.allclose(positions, target_positions)