Skip to content

Commit

Permalink
Merge pull request #3 from d-SEAMS/addCI
Browse files Browse the repository at this point in the history
CI: Add a basic test
  • Loading branch information
HaoZeke authored Jun 30, 2024
2 parents 719990f + 9f42187 commit 58b65bd
Show file tree
Hide file tree
Showing 10 changed files with 433 additions and 21 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Build pyseams and test"
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml

- name: Build pyseams
shell: bash -l {0}
run: |
micromamba activate pyseamsdev
meson setup bbdir
meson compile -C bbdir
- name: Run a test
shell: bash -l {0}
run: |
python -c 'import bbdir.cyoda'
50 changes: 50 additions & 0 deletions BPring.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import bbdir.cyoda as cyoda
trajectory ="subprojects/seams-core/input/traj/clathrate-thf.lammpstrj"

#Get the frame
resCloud = cyoda.readLammpsTrjreduced(
filename = trajectory,
targetFrame = 1,
typeI = 1, #oxygenAtomType
isSlice = True,
coordLow = [0,0,0],
coordHigh = [34.728,0,0],
)

#Calculate the neighborlist by ID
nList = cyoda.neighListO(
rcutoff = 3.5,
yCloud = resCloud,
typeI = 1, #oxygenAtomType
)

#Get the hydrogen-bonded network for the current frame
hbnList = cyoda.populateHbonds(
filename = trajectory,
yCloud = resCloud,
nList = nList,
targetFrame = 1,
Htype = 2, #hydrogen atom type
)

#Hydrogen-bonded network using indices not IDs
hbnList = cyoda.neighbourListByIndex(
yCloud = resCloud,
nList = hbnList,
)

#Gets every ring (non-primitives included)
rings = cyoda.ringNetwork(
nList = hbnList,
maxDepth = 6,
)

#Writes out primitive rings for a bulk system
ring = cyoda.bulkPolygonRingAnalysis(
path = "runOne/", #outDir
rings = rings,
nList = hbnList,
yCloud = resCloud,
maxDepth = 6,
firstFrame = 1,
)
48 changes: 48 additions & 0 deletions bulktopoC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import bbdir.cyoda as cyoda
trajectory ="subprojects/seams-core/input/traj/cluster-417.lammpstrj"

#Get the frame
resCloud = cyoda.readLammpsTrjreduced(
filename = trajectory,
targetFrame = 1302,
typeI = 1, #oxygenAtomType
isSlice = False,
coordLow = [0,0,0],
coordHigh = [0,0,0],
)

#Calculate the neighborlist by ID
nList = cyoda.neighListO(
rcutoff = 3.5,
yCloud = resCloud,
typeI = 1, #oxygenAtomType
)
solCloud = cyoda.PointCloudDouble()
iceList = []
clump = cyoda.clusterAnalysis(
path = "runOne/", #outDir
iceCloud = solCloud,
yCloud = resCloud,
nList = nList,
iceNeighbourList = iceList,
cutoff = 3.5,
firstFrame = 1302,
bopAnalysis = "q6",
)

#Gets every ring (non-primitives included)
rings = cyoda.ringNetwork(
nList = iceList,
maxDepth = 6,
)

#Finds DDCs and HCs
tum3 = cyoda.topoUnitMatchingBulk(
path = "runOne/", #outDir
rings = rings,
iceNeighbourList = iceList,
yCloud = solCloud,
firstFrame = 1302,
printClusters = True,
onlyTetrahedral = False,
)
100 changes: 100 additions & 0 deletions chillPlus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import bbdir.cyoda as cyoda
trajectory ="input/traj/mW_cubic.lammpstrj"

solCloud = cyoda.PointCloudDouble()
iceList = []

#Get the frame
resCloud = cyoda.readLammpsTrjO(
filename = trajectory,
targetFrame = 1,
type0 = 1, #oxygenAtomType
isSlice = False,
coordLow = [0,0,0],
coordHigh = [50,0,0],
)

#Calculate the neighborlist by ID
nList = cyoda.neighListO(
rcutoff = 3.5,
yCloud = resCloud,
type0 = 1, #oxygenAtomType
)

#Calculate Cij (cloud,slice)
resCloud = cyoda.getCorrelPlus(
yCloud = resCloud,
nList = nList,
isSlice = False,
)

#Write out data (cloud,slice,name)
resCloud = cyoda.getIceTypePlus(
yCloud = resCloud,
nList = nList,
path = "runOne/",
firstFrame = 1,
isSlice = False
outputFileName = "chillPlus.txt",
)

#Dump the rescloud which currently has CHILL Plus classifications
cyoda.writeDump(
yCloud = resCloud,
path = "runOne/",
outFile = "waterChillP.lammpstrj",
)

#Average Q6 (cloud,slice)
avgQ6 = cyoda.getq6(
yCloud = resCloud,
nList = nList,
isSlice = False,
)

#Modification (cloud,q6)
resCloud = cyoda.reclassifyWater(
yCloud = resCloud,
q6 = avgQ6,
)

#Post reclassification writeOut
cyoda.printIceType(
yCloud = resCloud,
path = "runOne/",
firstFrame = 1,
isSlice = False,
outputFileName = "chillPlus.txt",
)

#Dump the rescloud which now has the supaa CHILL Plus Trajectory
cyoda.writeDump(
yCloud = resCloud,
path = "runOne/",
outFile = "waterSupaaP.lammpstrj",
)

#Get the largest ice cluster. Here, iceNeighbourList is the neighbour list by index.
cyoda.clusterAnalysis(
path = "runOne/",
iceCloud = solCloud,
yCloud = resCloud,
nList = nList,
iceNeighbourList = iceList,
cutoff = 3.5,
firstFrame = 1,
bopAnalysis = "q6",
)

#Recenter the cluster such that the centroid is at the center of the simulation box
cyoda.recenterClusterCloud(
iceCloud = solCloud,
nList = iceList,
)

#Dump the recentered largest ice cluster
cyoda.writeDump(
yCloud = resCloud,
path = "runOne/",
outFile = "largestIce.lammpstrj",
)
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ dependencies:
- eigen==3.4.0
# Python
- pdm
- pybind11
- pybind11
12 changes: 3 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project('pyseams', 'cpp',
version: '1.0.1',
default_options: ['warning_level=3', 'cpp_std=c++17'])
default_options: ['warning_level=1', 'cpp_std=c++14'])

host_system = host_machine.system()

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

# ---------------------- Library Dependencies
seams_core_deps = subproject('seams-core', version: '1.0.1').get_variable('_deps')
seams_core_inc = subproject('seams-core', version: '1.0.1').get_variable('_incdirs')
seams_core_linkto = subproject('seams-core', version: '1.0.1').get_variable('_linkto')
ydslib = subproject('seams-core', version: '1.0.1').get_variable('ydslib')
seams_core_dep = declare_dependency(link_with: [seams_core_linkto, ydslib],
dependencies: seams_core_deps,
include_directories: seams_core_inc)
_deps += seams_core_dep
ydslib = subproject('seams-core').get_variable('yds_dep')
_deps += ydslib

# ---------------------- Bindings
py_mod = import('python')
Expand Down
Loading

0 comments on commit 58b65bd

Please sign in to comment.