Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SASA analysis #399

Merged
merged 19 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ jobs:
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
# Force libc++ due to https://github.com/actions/runner-images/issues/8659
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_OPENMP=on -DENABLE_PYTHON=off -DENABLE_TBB=off -DCMAKE_CXX_FLAGS="-stdlib=libc++"
run: |
export LDFLAGS="-fuse-ld=lld"
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_OPENMP=on -DENABLE_PYTHON=off -DENABLE_TBB=off -DCMAKE_CXX_FLAGS="-stdlib=libc++"

- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE --target faunus -j 2
run: |
export LDFLAGS="-fuse-ld=lld"
cmake --build . --config $BUILD_TYPE --target faunus -j 2

- name: Test
working-directory: ${{github.workspace}}/build
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include/
examples/
_deps/
sids/

docs/html/
unittests.log
a.out

Expand Down
40 changes: 0 additions & 40 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions docs/_docs/analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,29 @@ with gzip.open('distances.mtx.gz', 'rt') as f:
print(np.sort(counts)) # cluster size distribution
~~~

### Surface Area

Calculates surface areas using different sample policies
that selects by:

1. atoms types (`atomic`)
2. molecule types (`molecular`)
3. atom types in specific molecules (`atoms_in_molecule`)

In addition to the optional `file` streaming, a histogram of observed areas
is filed to disk, `sasa_histogram.dat`.

`sasa` | Description
-------------- | ---------------------------
`nstep` | Interval between samples
`nskip=0` | Number of initial steps excluded from the analysis
`policy` | Sample policy: `atomic`, `molecular`, `atoms_in_molecule`
`molecule` | Molecule name to sample if `molecular` or `atoms_in_molecule` policies
`atom` | Atom name to sample if `atomic` policy
`atomlist` | List of atom names if `atoms_in_molecule` policy
`file` | Optionally stream area for each `nstep` to file (`.dat|.dat.gz`)
`radius=1.4` | Probe radius (Å)

## Charge Properties

### Molecular Multipoles
Expand Down
29 changes: 29 additions & 0 deletions docs/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,35 @@ properties:
additionalProperties: false
type: object

sasa:
type: object
properties:
nstep: {type: integer, description: "Interval between samples"}
nskip: {type: integer, default: 0, description: "Initial steps to skip"}
molecule:
type: string
description: "Molecule name to sample if `molecular` or `atoms_in_molecule` policies"
atom: {type: string, description: "Atom to sample if `atomic` policy"}
atomlist:
type: array
items: string
minItems: 1
description: "List of atom names if `atoms_in_molecule` policy"
radius:
type: number
default: 1.4
description: "Probe radius for SASA calculation (Å)"
file:
type: string
pattern: "(.*?)\\.(dat|dat.gz)$"
description: "Streaming filename (.dat|.dat.gz)"
policy:
type: string
enum: ["atomic", "molecular", "atoms_in_molecule"]
description: "Area calculation policy"
required: [nstep, policy]
additionalProperties: false

savestate:
description: "Save particle positions to file"
properties:
Expand Down
7 changes: 7 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ add_test(
&& ${Python_EXECUTABLE} ${JSON_COMPARE} polymers.out.json out.json --tol 0.05"
WORKING_DIRECTORY ${EXAMPLES_DIR}/polymers)

add_test(
NAME sasa
COMMAND sh -c "${Python_EXECUTABLE} ${YASON} sasa.yml\
| $<TARGET_FILE:faunus> --quiet\
&& ${Python_EXECUTABLE} ${JSON_COMPARE} sasa.out.json out.json --tol 0.01"
WORKING_DIRECTORY ${EXAMPLES_DIR}/sasa)

add_test(
NAME smartmc
COMMAND sh -c "${Python_EXECUTABLE} ${YASON} smartmc.yml\
Expand Down
19 changes: 19 additions & 0 deletions examples/sasa/sasa.out.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"analysis": [
{
"sasa": {
"molecule": "mymolecule",
"nstep": 1,
"radius": 2.0,
"reference": "doi:10/dbjh",
"relative time": 0.592,
"samples": 1,
"slices_per_atom": 20,
"⟨SASA²⟩-⟨SASA⟩²": 0.0,
"⟨SASA⟩": 2177.145143881812
}
}
],
"compiler": "Apple LLVM 15.0.0 (clang-1500.0.40.1)",
"git revision": "71a2e177 (2023-11-29)"
}
29 changes: 29 additions & 0 deletions examples/sasa/sasa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env yason.py

temperature: 298.15
geometry: {type: sphere, radius: 100}
mcloop: {macro: 1, micro: 1}

atomlist:
- bead: {sigma: 20.0, mw: 1} # bead with r=10 Å

moleculelist:
- mymolecule:
structure:
- bead: [0.0, 0.0, 0.0]
- bead: [5.0, 0.0, 0.0]

insertmolecules:
- mymolecule: {N: 1}

energy: []
moves: []

analysis:
- sasa:
file: sasa.dat
policy: molecular
molecule: mymolecule
radius: 2.0
nstep: 1

Loading
Loading