From 9de6f83150ec9a64d877833906cd728e84a568d8 Mon Sep 17 00:00:00 2001 From: Xiang Chen Date: Thu, 31 Oct 2024 15:28:00 -0400 Subject: [PATCH 1/4] add contributing helper doc --- CONTRIBUTING.md | 82 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bd97ed1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,82 @@ + +# Contributing to the BluePhos Pipeline Project + +Thank you for your interest in contributing to the BluePhos pipeline project! As a contributor, you’ll work from your fork of the main repository. This document outlines the steps to set up your development environment, guidelines for coding, and instructions for submitting contributions. + +## Repository Information + +- **Main Repository**: [BluePhos Main Repo](https://github.com/ssec-jhu/bluephos.git) + +## Getting Started + +1. **Fork the Repository**: First, create a fork of the main repository in your own GitHub account. This will allow you to freely make changes without affecting the main repository. + +2. **Clone Your Fork**: Clone your fork to your local machine: + ```bash + git clone https://github.com/your-username/bluephos.git + cd bluephos + ``` + +3. **Add the Main Repository as Upstream**: To keep your fork in sync with the latest updates from the main repo, add it as a second remote named `upstream`: + ```bash + git remote add upstream https://github.com/ssec-jhu/bluephos.git + ``` + +4. **Create a Branch**: Create a new branch for each feature or bug fix: + ```bash + git checkout -b feature/your-feature-name + ``` + +## Making Changes + +- **Coding Standards**: Follow PEP 8 for Python code. Use `ruff format` or `tox -e format` to ensure code formatting aligns with the repository’s requirements. +- **Testing**: Ensure your changes pass all tests. Include relevant tests for any new features you add. +- **Documentation**: Update the documentation for any significant code changes. This includes comments, docstrings, and relevant updates to the `README.md`. + +## Keeping Your Fork Updated + +Regularly pull updates from the main repository to keep your fork in sync: +```bash +git fetch upstream +git merge upstream/main +``` + +## Submitting a Pull Request + +When you’re ready to contribute your changes: + +1. **Commit Your Changes**: Write concise and descriptive commit messages. + ```bash + git add . + git commit -m "Description of changes" + ``` + +2. **Push to Your Fork**: + ```bash + git push origin feature/your-feature-name + ``` + +3. **Open a Pull Request**: + - Go to your forked repository on GitHub. + - Click on **New Pull Request**. + - Ensure the base repository is `ssec-jhu/bluephos` and the base branch is `main`. + - Provide a title and description for your pull request. + - Submit the pull request for review. + +## Code Review Process + +Once you submit a pull request: +- The maintainers will review your changes and may request modifications. +- Please address any feedback and re-submit for review. + +## Issues and Support + +If you encounter issues or have questions, feel free to open an issue on GitHub. We’ll do our best to assist. + +## License + +By contributing, you agree that your contributions will be licensed under the same open-source license as the project. + +--- + +Thank you for your contributions to the BluePhos pipeline! We’re excited to work with you. From af2d4d4414d17d03b563509fd50ec0d28a9033bf Mon Sep 17 00:00:00 2001 From: Xiang Chen Date: Fri, 1 Nov 2024 11:52:51 -0400 Subject: [PATCH 2/4] add link to contributing in readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 69c4cea..d8a753a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ BluePhos: An automated pipeline optimizing the synthesis and analysis of blue phosphorescent materials. + # BluePhos Pipeline Introduction ### Overview @@ -140,6 +141,9 @@ query_result = ddb.query('''SELECT * FROM '08ca147e-f618-11ee-b38f-eab1f408aca3- print(query_result.to_df()) ``` +# Contributing + +We welcome contributions! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to this project. From 63c0eb299493d218b68d8994832942f4f7591325 Mon Sep 17 00:00:00 2001 From: Xiang Chen Date: Fri, 1 Nov 2024 13:25:07 -0400 Subject: [PATCH 3/4] Standardize formatting by using tox -e format --- CONTRIBUTING.md | 24 ++++++++++++++++++++++-- bluephos/bluephos_pipeline.py | 16 +++++++++------- bluephos/modules/dft_calculators.py | 5 +++-- bluephos/modules/dft_extract.py | 4 +++- bluephos/tasks/dft.py | 10 ++++++---- bluephos/tasks/generateligandtable.py | 3 ++- bluephos/tasks/nn.py | 2 +- bluephos/tasks/optimizegeometries.py | 8 +++++--- bluephos/tasks/smiles2sdf.py | 3 ++- tests/test_dft_task.py | 8 +++++--- 10 files changed, 58 insertions(+), 25 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bd97ed1..bdb9d0c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,3 @@ - # Contributing to the BluePhos Pipeline Project Thank you for your interest in contributing to the BluePhos pipeline project! As a contributor, you’ll work from your fork of the main repository. This document outlines the steps to set up your development environment, guidelines for coding, and instructions for submitting contributions. @@ -7,6 +6,27 @@ Thank you for your interest in contributing to the BluePhos pipeline project! As - **Main Repository**: [BluePhos Main Repo](https://github.com/ssec-jhu/bluephos.git) +## How to Fork the Repository + +1. **Go to the Repository on GitHub**: + - Open your web browser and navigate to the main repository you want to fork. For the BluePhos pipeline, the URL is [https://github.com/ssec-jhu/bluephos.git](https://github.com/ssec-jhu/bluephos.git). + +2. **Click the Fork Button**: + - In the upper-right corner of the repository page, you’ll see a button labeled **Fork**. Click it. + - GitHub will ask you to select your GitHub account or organization where you want the fork to be created. + +3. **Wait for the Fork to Complete**: + - GitHub will create a copy of the repository under your account. This new repository is your fork, and you’ll be directed to the forked repository page (e.g., `https://github.com/your-username/bluephos`). + +4. **Clone Your Fork Locally**: + - Once your fork is created, you can clone it to your local machine to start working: + ```bash + git clone https://github.com/your-username/bluephos.git + cd bluephos + ``` + +You now have your own copy (fork) of the repository where you can make changes independently from the main repository. When you’re ready to contribute back, you can create a pull request from your fork to the main repository. + ## Getting Started 1. **Fork the Repository**: First, create a fork of the main repository in your own GitHub account. This will allow you to freely make changes without affecting the main repository. @@ -29,7 +49,7 @@ Thank you for your interest in contributing to the BluePhos pipeline project! As ## Making Changes -- **Coding Standards**: Follow PEP 8 for Python code. Use `ruff format` or `tox -e format` to ensure code formatting aligns with the repository’s requirements. +- **Coding Standards**: Follow PEP 8 for Python code. Use `tox -e format` to ensure code formatting aligns with the repository’s requirements. - **Testing**: Ensure your changes pass all tests. Include relevant tests for any new features you add. - **Documentation**: Update the documentation for any significant code changes. This includes comments, docstrings, and relevant updates to the `README.md`. diff --git a/bluephos/bluephos_pipeline.py b/bluephos/bluephos_pipeline.py index 591beb4..d2ccfd7 100644 --- a/bluephos/bluephos_pipeline.py +++ b/bluephos/bluephos_pipeline.py @@ -1,23 +1,25 @@ __doc__ = """"BluePhos Discovery Pipeline""" from pathlib import Path -import pandas as pd + import numpy as np +import pandas as pd from dplutils import cli from dplutils.pipeline.ray import RayStreamGraphExecutor -from bluephos.tasks.generateligandtable import GenerateLigandTableTask -from bluephos.tasks.nn import NNTask -from bluephos.tasks.optimizegeometries import OptimizeGeometriesTask -from bluephos.tasks.smiles2sdf import Smiles2SDFTask + from bluephos.tasks.dft import DFTTask from bluephos.tasks.filter_pipeline import ( + FilterDFTInTask, + FilterDFTOutTask, FilterNNInTask, FilterNNOutTask, FilterXTBInTask, FilterXTBOutTask, - FilterDFTInTask, - FilterDFTOutTask, ) +from bluephos.tasks.generateligandtable import GenerateLigandTableTask +from bluephos.tasks.nn import NNTask +from bluephos.tasks.optimizegeometries import OptimizeGeometriesTask +from bluephos.tasks.smiles2sdf import Smiles2SDFTask def ligand_pair_generator(halides_file, acids_file): diff --git a/bluephos/modules/dft_calculators.py b/bluephos/modules/dft_calculators.py index f509a3e..bd415c2 100644 --- a/bluephos/modules/dft_calculators.py +++ b/bluephos/modules/dft_calculators.py @@ -1,8 +1,9 @@ +import logging +import multiprocessing import os import subprocess -import multiprocessing -import logging from textwrap import dedent + from bluephos.modules.dft_extract import extract # Constants diff --git a/bluephos/modules/dft_extract.py b/bluephos/modules/dft_extract.py index 6f98d23..1c0fe32 100644 --- a/bluephos/modules/dft_extract.py +++ b/bluephos/modules/dft_extract.py @@ -1,6 +1,8 @@ import re -import numpy as np from glob import iglob + +import numpy as np + import bluephos.modules.log_config as log_config # Setup logging and get a logger instance diff --git a/bluephos/tasks/dft.py b/bluephos/tasks/dft.py index 4291f6e..002fddc 100644 --- a/bluephos/tasks/dft.py +++ b/bluephos/tasks/dft.py @@ -1,11 +1,13 @@ +import multiprocessing import os import tempfile -import multiprocessing + import pandas as pd -import bluephos.modules.log_config as log_config -from bluephos.modules.dft_calculators import OrcaCalculator, ASECalculator, remove_second_row -from dplutils.pipeline import PipelineTask from dplutils import observer +from dplutils.pipeline import PipelineTask + +import bluephos.modules.log_config as log_config +from bluephos.modules.dft_calculators import ASECalculator, OrcaCalculator, remove_second_row # Setup logging and get a logger instance logger = log_config.setup_logging(__name__) diff --git a/bluephos/tasks/generateligandtable.py b/bluephos/tasks/generateligandtable.py index e8c8175..325aaa6 100644 --- a/bluephos/tasks/generateligandtable.py +++ b/bluephos/tasks/generateligandtable.py @@ -1,8 +1,9 @@ import pandas as pd -import bluephos.modules.log_config as log_config from dplutils.pipeline import PipelineTask from rdkit.Chem import AllChem, MolFromSmiles, MolToSmiles +import bluephos.modules.log_config as log_config + # Setup logging and get a logger instance logger = log_config.setup_logging(__name__) diff --git a/bluephos/tasks/nn.py b/bluephos/tasks/nn.py index 98b6e0c..1ec7012 100644 --- a/bluephos/tasks/nn.py +++ b/bluephos/tasks/nn.py @@ -1,13 +1,13 @@ import pandas as pd import torch as t import torch.nn.functional as F -import bluephos.modules.log_config as log_config from dplutils.pipeline import PipelineTask from torch.nn import Dropout, Linear from torch.nn.init import kaiming_normal_ from torch_geometric.loader import DataLoader from torch_geometric.nn import GCN, Set2Set +import bluephos.modules.log_config as log_config from bluephos.modules.sdf2feature import feature_create # Setup logging and get a logger instance diff --git a/bluephos/tasks/optimizegeometries.py b/bluephos/tasks/optimizegeometries.py index 8a2f5f8..87e90b2 100644 --- a/bluephos/tasks/optimizegeometries.py +++ b/bluephos/tasks/optimizegeometries.py @@ -1,12 +1,14 @@ -import bluephos.modules.log_config as log_config from time import sleep + import pandas as pd from ase.calculators.calculator import InputError -from dplutils.pipeline import PipelineTask from dplutils import observer +from dplutils.pipeline import PipelineTask from rdkit import Chem from rdkit.Chem import AddHs, MolToXYZBlock -from bluephos.modules.annotate_rdkit_with_ase import optimize_geometry, annotate_molecule_property + +import bluephos.modules.log_config as log_config +from bluephos.modules.annotate_rdkit_with_ase import annotate_molecule_property, optimize_geometry from bluephos.modules.bond_length import bonds_maintained from bluephos.modules.isoctahedral import isoctahedral from bluephos.modules.octahedral_embed import octahedral_embed diff --git a/bluephos/tasks/smiles2sdf.py b/bluephos/tasks/smiles2sdf.py index 5dd76e5..2dcf8de 100644 --- a/bluephos/tasks/smiles2sdf.py +++ b/bluephos/tasks/smiles2sdf.py @@ -1,11 +1,12 @@ from functools import reduce + import pandas as pd -import bluephos.modules.log_config as log_config from dplutils.pipeline import PipelineTask from rdkit import Chem from rdkit.Chem import AddHs, AllChem, MolFromSmiles from rdkit.Chem.rdmolops import CombineMols, Kekulize, SanitizeMol +import bluephos.modules.log_config as log_config # Setup logging and get a logger instance logger = log_config.setup_logging(__name__) diff --git a/tests/test_dft_task.py b/tests/test_dft_task.py index ac83f9d..d9676e7 100644 --- a/tests/test_dft_task.py +++ b/tests/test_dft_task.py @@ -1,8 +1,10 @@ import os -import pytest -import pandas as pd from unittest.mock import patch -from bluephos.tasks.dft import dft_run, remove_second_row, OrcaCalculator + +import pandas as pd +import pytest + +from bluephos.tasks.dft import OrcaCalculator, dft_run, remove_second_row @pytest.fixture From 0e0dd976a37e661bc569a709db5e74d01b3fc740 Mon Sep 17 00:00:00 2001 From: Xiang Chen Date: Fri, 1 Nov 2024 13:34:56 -0400 Subject: [PATCH 4/4] use git commit -u with note on new files --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bdb9d0c..4266cca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,7 +67,7 @@ When you’re ready to contribute your changes: 1. **Commit Your Changes**: Write concise and descriptive commit messages. ```bash - git add . + git add -u # Use 'git add .' if adding new files git commit -m "Description of changes" ```