Skip to content

Commit 58b65bd

Browse files
authored
Merge pull request #3 from d-SEAMS/addCI
CI: Add a basic test
2 parents 719990f + 9f42187 commit 58b65bd

File tree

10 files changed

+433
-21
lines changed

10 files changed

+433
-21
lines changed

.github/workflows/build_test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Build pyseams and test"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
jobs:
10+
build_test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- uses: mamba-org/setup-micromamba@v1
16+
with:
17+
environment-file: environment.yml
18+
19+
- name: Build pyseams
20+
shell: bash -l {0}
21+
run: |
22+
micromamba activate pyseamsdev
23+
meson setup bbdir
24+
meson compile -C bbdir
25+
26+
- name: Run a test
27+
shell: bash -l {0}
28+
run: |
29+
python -c 'import bbdir.cyoda'

BPring.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import bbdir.cyoda as cyoda
2+
trajectory ="subprojects/seams-core/input/traj/clathrate-thf.lammpstrj"
3+
4+
#Get the frame
5+
resCloud = cyoda.readLammpsTrjreduced(
6+
filename = trajectory,
7+
targetFrame = 1,
8+
typeI = 1, #oxygenAtomType
9+
isSlice = True,
10+
coordLow = [0,0,0],
11+
coordHigh = [34.728,0,0],
12+
)
13+
14+
#Calculate the neighborlist by ID
15+
nList = cyoda.neighListO(
16+
rcutoff = 3.5,
17+
yCloud = resCloud,
18+
typeI = 1, #oxygenAtomType
19+
)
20+
21+
#Get the hydrogen-bonded network for the current frame
22+
hbnList = cyoda.populateHbonds(
23+
filename = trajectory,
24+
yCloud = resCloud,
25+
nList = nList,
26+
targetFrame = 1,
27+
Htype = 2, #hydrogen atom type
28+
)
29+
30+
#Hydrogen-bonded network using indices not IDs
31+
hbnList = cyoda.neighbourListByIndex(
32+
yCloud = resCloud,
33+
nList = hbnList,
34+
)
35+
36+
#Gets every ring (non-primitives included)
37+
rings = cyoda.ringNetwork(
38+
nList = hbnList,
39+
maxDepth = 6,
40+
)
41+
42+
#Writes out primitive rings for a bulk system
43+
ring = cyoda.bulkPolygonRingAnalysis(
44+
path = "runOne/", #outDir
45+
rings = rings,
46+
nList = hbnList,
47+
yCloud = resCloud,
48+
maxDepth = 6,
49+
firstFrame = 1,
50+
)

bulktopoC.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import bbdir.cyoda as cyoda
2+
trajectory ="subprojects/seams-core/input/traj/cluster-417.lammpstrj"
3+
4+
#Get the frame
5+
resCloud = cyoda.readLammpsTrjreduced(
6+
filename = trajectory,
7+
targetFrame = 1302,
8+
typeI = 1, #oxygenAtomType
9+
isSlice = False,
10+
coordLow = [0,0,0],
11+
coordHigh = [0,0,0],
12+
)
13+
14+
#Calculate the neighborlist by ID
15+
nList = cyoda.neighListO(
16+
rcutoff = 3.5,
17+
yCloud = resCloud,
18+
typeI = 1, #oxygenAtomType
19+
)
20+
solCloud = cyoda.PointCloudDouble()
21+
iceList = []
22+
clump = cyoda.clusterAnalysis(
23+
path = "runOne/", #outDir
24+
iceCloud = solCloud,
25+
yCloud = resCloud,
26+
nList = nList,
27+
iceNeighbourList = iceList,
28+
cutoff = 3.5,
29+
firstFrame = 1302,
30+
bopAnalysis = "q6",
31+
)
32+
33+
#Gets every ring (non-primitives included)
34+
rings = cyoda.ringNetwork(
35+
nList = iceList,
36+
maxDepth = 6,
37+
)
38+
39+
#Finds DDCs and HCs
40+
tum3 = cyoda.topoUnitMatchingBulk(
41+
path = "runOne/", #outDir
42+
rings = rings,
43+
iceNeighbourList = iceList,
44+
yCloud = solCloud,
45+
firstFrame = 1302,
46+
printClusters = True,
47+
onlyTetrahedral = False,
48+
)

chillPlus.py

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import bbdir.cyoda as cyoda
2+
trajectory ="input/traj/mW_cubic.lammpstrj"
3+
4+
solCloud = cyoda.PointCloudDouble()
5+
iceList = []
6+
7+
#Get the frame
8+
resCloud = cyoda.readLammpsTrjO(
9+
filename = trajectory,
10+
targetFrame = 1,
11+
type0 = 1, #oxygenAtomType
12+
isSlice = False,
13+
coordLow = [0,0,0],
14+
coordHigh = [50,0,0],
15+
)
16+
17+
#Calculate the neighborlist by ID
18+
nList = cyoda.neighListO(
19+
rcutoff = 3.5,
20+
yCloud = resCloud,
21+
type0 = 1, #oxygenAtomType
22+
)
23+
24+
#Calculate Cij (cloud,slice)
25+
resCloud = cyoda.getCorrelPlus(
26+
yCloud = resCloud,
27+
nList = nList,
28+
isSlice = False,
29+
)
30+
31+
#Write out data (cloud,slice,name)
32+
resCloud = cyoda.getIceTypePlus(
33+
yCloud = resCloud,
34+
nList = nList,
35+
path = "runOne/",
36+
firstFrame = 1,
37+
isSlice = False
38+
outputFileName = "chillPlus.txt",
39+
)
40+
41+
#Dump the rescloud which currently has CHILL Plus classifications
42+
cyoda.writeDump(
43+
yCloud = resCloud,
44+
path = "runOne/",
45+
outFile = "waterChillP.lammpstrj",
46+
)
47+
48+
#Average Q6 (cloud,slice)
49+
avgQ6 = cyoda.getq6(
50+
yCloud = resCloud,
51+
nList = nList,
52+
isSlice = False,
53+
)
54+
55+
#Modification (cloud,q6)
56+
resCloud = cyoda.reclassifyWater(
57+
yCloud = resCloud,
58+
q6 = avgQ6,
59+
)
60+
61+
#Post reclassification writeOut
62+
cyoda.printIceType(
63+
yCloud = resCloud,
64+
path = "runOne/",
65+
firstFrame = 1,
66+
isSlice = False,
67+
outputFileName = "chillPlus.txt",
68+
)
69+
70+
#Dump the rescloud which now has the supaa CHILL Plus Trajectory
71+
cyoda.writeDump(
72+
yCloud = resCloud,
73+
path = "runOne/",
74+
outFile = "waterSupaaP.lammpstrj",
75+
)
76+
77+
#Get the largest ice cluster. Here, iceNeighbourList is the neighbour list by index.
78+
cyoda.clusterAnalysis(
79+
path = "runOne/",
80+
iceCloud = solCloud,
81+
yCloud = resCloud,
82+
nList = nList,
83+
iceNeighbourList = iceList,
84+
cutoff = 3.5,
85+
firstFrame = 1,
86+
bopAnalysis = "q6",
87+
)
88+
89+
#Recenter the cluster such that the centroid is at the center of the simulation box
90+
cyoda.recenterClusterCloud(
91+
iceCloud = solCloud,
92+
nList = iceList,
93+
)
94+
95+
#Dump the recentered largest ice cluster
96+
cyoda.writeDump(
97+
yCloud = resCloud,
98+
path = "runOne/",
99+
outFile = "largestIce.lammpstrj",
100+
)

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ dependencies:
1919
- eigen==3.4.0
2020
# Python
2121
- pdm
22-
- pybind11
22+
- pybind11

meson.build

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('pyseams', 'cpp',
22
version: '1.0.1',
3-
default_options: ['warning_level=3', 'cpp_std=c++17'])
3+
default_options: ['warning_level=1', 'cpp_std=c++14'])
44

55
host_system = host_machine.system()
66

@@ -12,14 +12,8 @@ host_system = host_machine.system()
1212
_incdirs = [] # All the includes
1313

1414
# ---------------------- Library Dependencies
15-
seams_core_deps = subproject('seams-core', version: '1.0.1').get_variable('_deps')
16-
seams_core_inc = subproject('seams-core', version: '1.0.1').get_variable('_incdirs')
17-
seams_core_linkto = subproject('seams-core', version: '1.0.1').get_variable('_linkto')
18-
ydslib = subproject('seams-core', version: '1.0.1').get_variable('ydslib')
19-
seams_core_dep = declare_dependency(link_with: [seams_core_linkto, ydslib],
20-
dependencies: seams_core_deps,
21-
include_directories: seams_core_inc)
22-
_deps += seams_core_dep
15+
ydslib = subproject('seams-core').get_variable('yds_dep')
16+
_deps += ydslib
2317

2418
# ---------------------- Bindings
2519
py_mod = import('python')

0 commit comments

Comments
 (0)