Skip to content

Commit adc7faf

Browse files
committed
Fix RMSD CV instantiation following API change.
1 parent 95da10a commit adc7faf

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

tests/Protocol/test_protocol.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,19 @@ def test_metadynamics():
116116

117117

118118
def test_steering(system):
119-
# Create a collective variable so we can instantiate a steering protocol.
120-
cv = BSS.Metadynamics.CollectiveVariable.RMSD(system, system[0], [0, 1, 2, 3])
119+
# Create a reference containing the first and third molecule from the system.
120+
reference = (system[0] + system[2]).toSystem()
121+
122+
# Create the collective variable. Here we align on molecule index 1
123+
# and all atoms not belonging to to the ALA residue in molecule index 0.
124+
# We compute the RSMD using the atoms belonging to the ALA residue.
125+
cv = BSS.Metadynamics.CollectiveVariable.RMSD(
126+
system,
127+
reference,
128+
"(molidx 0 and not resname ALA) or molidx 1",
129+
"resname ALA",
130+
reference_mapping={0: 0, 1: 2},
131+
)
121132

122133
# Create a schedule.
123134
start = 0 * BSS.Units.Time.nanosecond

tests/Sandpit/Exscientia/Protocol/test_protocol.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,19 @@ def test_metadynamics():
122122

123123

124124
def test_steering(system):
125-
# Create a collective variable so we can instantiate a steering protocol.
126-
cv = BSS.Metadynamics.CollectiveVariable.RMSD(system, system[0], [0, 1, 2, 3])
125+
# Create a reference containing the first and third molecule from the system.
126+
reference = (system[0] + system[2]).toSystem()
127+
128+
# Create the collective variable. Here we align on molecule index 1
129+
# and all atoms not belonging to to the ALA residue in molecule index 0.
130+
# We compute the RSMD using the atoms belonging to the ALA residue.
131+
cv = BSS.Metadynamics.CollectiveVariable.RMSD(
132+
system,
133+
reference,
134+
"(molidx 0 and not resname ALA) or molidx 1",
135+
"resname ALA",
136+
reference_mapping={0: 0, 1: 2},
137+
)
127138

128139
# Create a schedule.
129140
start = 0 * BSS.Units.Time.nanosecond

0 commit comments

Comments
 (0)