Skip to content
Open
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
25 changes: 14 additions & 11 deletions Python/lib/NWChem_Wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
. goToLine()
. findNextOccurrence()

Last edit: 2025-01-29
Author: Dinis Abranches, Fathya Salih
Last edit: 2026-04-09
Author: Dinis Abranches, Fathya Salih, Ching Ting Leung
"""

# =============================================================================
Expand Down Expand Up @@ -208,15 +208,18 @@ def readOutput(outputPath,doCOSMO=True):
with open(outputPath,'r') as file:
if doCOSMO:
# Find last occurrence of "-cosmo- solvent"
lastOccurrenceLine=findLastOccurrence(file,['-cosmo-','solvent'])
# Go to line of last occurrence
goToLine(file,lastOccurrenceLine)
# Retrieve total number of surface segments
lineSplit=findNextOccurrence(file,'-cosmo-')
nSeg=int(lineSplit[-1])
# Retrieve total surface area (next line)
lineSplit=file.readline().split()
surfaceArea=float(lineSplit[-2])
file.seek(0)
cosmoLineNum = None
for i, line in enumerate(file):
if '-cosmo-' in line and 'points' in line:
cosmoLineNum = i
file.seek(0)
for _ in range(cosmoLineNum):
file.readline()
lineSplit = file.readline().split()
nSeg = int(lineSplit[-1])
lineSplit = file.readline().split()
surfaceArea = float(lineSplit[-2])
# Initialize list of areas and segment atoms
segmentAreas=[]
segAtoms=[]
Expand Down
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ The journal article associated with this work is available on DigitalDiscovery:[
These instructions are for a user who would like all functionalities to be present within the same conda environment. Here, NWChem along with the necessary python dependencies are installed through conda from an environment file using the following instructions:

```
# Go to the directory where the repository was installed
cd <OpenSPGen-installation-path>
cd Python
# Create a conda environment for all the dependencies
conda env create -n spg-env --file spg-7.3.yml
conda env create -n spg-env --file Python/spg-7.3.yml
```
Installing with the .yml file is preferred for reproducibility of results. If it failed on your device, linux dependencies could be excluded by replacing the line of conda environment creation with the following block:
```
conda create -n spgen python=3.10
# Install required packages
pip install -r requirements.txt
```
and accept all prompts in the terminal
Then, you can run the installation tests (will run a sigma profile generation job for methane with different inputs - a SMILES, a CAS number and a pre-optimized xyz). *You may need to edit the environment section of the script before running tests.*
```
./run-tests.sh
Expand All @@ -35,18 +40,24 @@ Then, you can run the installation tests (will run a sigma profile generation jo
These instructions are for the case where the user has an existing NWChem installation (has to be at least version `7.2.0` or higher) or a the user would like to install NWChem with specific build instructions (the basic build is sufficient for this package).

1. Install the open source DFT package `NWChem` without Python support (note the compatible versions listed below).
1. Add the path of the `nwchem` executable to your `PATH` variable (the `nwchem` executable path should be along the lines of: `User/Desktop/nwchem-7.2.0-beta2/bin/LINUX64`)
1. Download the current repository to your local machine.
1. Add the path of the folder containing main python script (`<OpenSPGen-installation-path>/Python`) to your `PATH` variable.
1. Create a conda environment where you can install `rdkit` and its dependencies from the provided `yml` file using the following instructions:
2. Add the path of the `nwchem` executable to your `PATH` variable (the `nwchem` executable path should be along the lines of: `User/Desktop/nwchem-7.2.0-beta2/bin/LINUX64`)
3. Download the current repository to your local machine.
4. Add the path of the folder containing main python script (`<OpenSPGen-installation-path>/Python`) to your `PATH` variable.
5. Create a conda environment where you can install `rdkit` and its dependencies from the provided `yml` file using the following instructions:

```
# Go to the directory where the repository was installed
cd <OpenSPGen-installation-path>
cd Python
# Create a conda environment for all the dependencies
conda env create -n spg-env --file spg.yml
conda env create -n spg-env --file Python/spg-7.3.yml
```
Installing with the .yml file is preferred for reproducibility of results. If it failed on your device, linux dependencies could be excluded by replacing the line of conda environment creation with the following block:
```
conda create -n spgen python=3.10
# Install required packages
pip install -r requirements.txt
```
1. Run the installation tests (will run a sigma profile generation job for methane with different inputs - a SMILES, a CAS number and a pre-optimized xyz). *You may need to edit the environment section of the script before running tests.*
and accept all prompts in the terminal.
7. Run the installation tests (will run a sigma profile generation job for methane with different inputs - a SMILES, a CAS number and a pre-optimized xyz). *You may need to edit the environment section of the script before running tests.*
```
./run-tests.sh
```
Expand Down
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cirpy==1.0.2
gpflow==2.10.0
matplotlib==3.10.8
numpy==1.26.4
pandas==2.1.1
pubchempy==1.0.5
rdkit==2022.03.5
scikit_learn==1.7.2
tqdm==4.67.3