forked from plumed/plumed2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
99 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../scripts/test.make |
5 changes: 5 additions & 0 deletions
5
pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/colvar.out.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#! FIELDS time cv1 | ||
0.000000 1.000000 | ||
1.000000 2.000000 | ||
2.000000 3.000000 | ||
3.000000 4.000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
type=driver | ||
arg="--plumed plumed.dat --ixyz traj.xyz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
LOAD GLOBAL FILE=../../../../PythonCVInterface.so | ||
|
||
cv1: PYCVINTERFACE ATOMS=@mdatoms IMPORT=pycvPerFrame CALCULATE=pydist PREPARE=changeAtom | ||
|
||
PRINT FILE=colvar.out ARG=* |
32 changes: 32 additions & 0 deletions
32
pycv/regtest/pycvcomm/rt-newFrameNewAtomSTR/pycvPerFrame.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This is only a partial example. This function does not compute the | ||
# gradient, so it is useless for biasing. See the other regression | ||
# tests for how to auto-grad. | ||
|
||
# And, of course, one should not call slow functions (such as print) | ||
# in the CV calculation. | ||
|
||
import numpy as np | ||
import plumedCommunications | ||
|
||
log = open("pycv.log", "w") | ||
|
||
print("Imported.", file=log) | ||
plumedInit={"Value": plumedCommunications.defaults.COMPONENT,} | ||
|
||
def changeAtom(plmdAction: plumedCommunications.PythonCVInterface): | ||
print(f"pyCVCALLED") | ||
toret = {"setAtomRequest": f"1, {int(plmdAction.getStep()) + 2}"} | ||
# this is just for "fun" | ||
if plmdAction.getStep() == 3: | ||
toret["setAtomRequest"] = "1,2" | ||
print(toret) | ||
return toret | ||
|
||
|
||
def pydist(action: plumedCommunications.PythonCVInterface): | ||
at: np.ndarray = action.getPositions() | ||
d = at[0] - at[1] | ||
d = np.linalg.norm(d) | ||
print(f"{at[0]},{at[1]},{d}", file=log) | ||
|
||
return d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
4 | ||
100 100 100 | ||
X 0 0 0 | ||
X 0 0 1 | ||
X 0 0 0 | ||
X 0 0 0 | ||
4 | ||
100 100 100 | ||
X 0 0 0 | ||
X 0 0 0 | ||
X 0 0 2 | ||
X 0 0 0 | ||
4 | ||
100 100 100 | ||
X 0 0 0 | ||
X 0 0 0 | ||
X 0 0 0 | ||
X 0 0 3 | ||
4 | ||
100 100 100 | ||
X 0 0 0 | ||
X 0 0 4 | ||
X 0 0 0 | ||
X 0 0 0 |