Skip to content
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ stream file for the perturbable molecule, or AMBER or GROMACS files for the two
The format can be specified using the the `--output-format` option. If you require input
for a free-energy perturbation simulation, e.g. a hybrid GROMACS toplogy file, the you can
use the stream file with [BioSimSpace](https://biosimspace.openbiosim.org) to generate the
required input files.
required input files. Additionally, the program will output a JSON file summarising the
modifications that were made.

```bash

> [!NOTE]
> When a stream file is used as input, the `--mapping` option is ignored. and
Expand Down
11 changes: 10 additions & 1 deletion src/ghostly/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def run():
from loguru import logger

import argparse
import json
import os
import sys

Expand Down Expand Up @@ -268,7 +269,7 @@ def run():
try:
if args.system is None:
system = merged.toSystem()._sire_object
system = modify(
system, modifications = modify(
system,
k_hard.value(),
k_soft.value(),
Expand Down Expand Up @@ -307,3 +308,11 @@ def run():
sys.exit(1)
else:
sr.stream.save(system, f"{args.output_prefix}.bss")

# Try to save the modifications to JSON.
try:
with open(f"{args.output_prefix}_modifications.json", "w") as f:
json.dump(modifications, f, indent=4)
except Exception as e:
logger.error(f"An error occurred while saving the modifications to JSON: {e}")
sys.exit(1)
Loading