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 geometric parameter function and the new tc geo command #236

Merged
merged 4 commits into from
May 17, 2024

Conversation

YHordijk
Copy link
Contributor

We added the new tc geo command:

usage: tc geo [-h] [-p] xyzfile atom_indices [atom_indices ...]

Calculate geometrical parameters for atoms at the provided indices. For 1 index this program returns the cartesian coordinate for this atom. For 2 indices return bond length
between atoms. For 3 indices return bond angle, with the second index being the central atom. For 4 indices return dihedral angle by calculating the angle between normal
vectors described by atoms at indices 1-2-3 and indices 2-3-4. If the -p/--pyramidal flag is turned on it calculates 360° - ang1 - ang2 - ang3, where ang1, ang2 and ang3 are
the angles described by indices 2-1-3, 3-1-4 and 4-1-2 respectively.

positional arguments:
  xyzfile          The molecule to calculate the parameter for.
  atom_indices     The indices of the atoms to calculate the parameters for. For 1 index return cartesian coordinate. For 2 indices return bond length between atoms. For 3
                   indices return bond angle, with the second index being the central atom. For 4 indices return dihedral angle by calculating the angle between normal vectors
                   described by atoms at indices 1, 2, 3 and indices 2, 3, 4. If the -p/--pyramidal flag is turned on it calculates

options:
  -h, --help       show this help message and exit
  -p, --pyramidal  Instead of calculating dihedral angles, calculate pyramidalisation angle.

Example usage:

>>> tc geo nh3.xyz 1
Coordinate(N1) =  0.000000   0.000000   0.254200 Å
>>> tc geo nh3.xyz 1 2
Distance(N1-H2) =  1.008 Å
>>> tc geo nh3.xyz 2 1 3
Angle(H2-N1-H3) =  109.29°
>>> tc geo nh3.xyz 1 2 3 4
Dihedral(N1-H2-H3-H4) =  35.53°
>>> tc geo nh3.xyz 1 2 3 4 -p
Pyramid(N1-H2-H3-H4) =  32.13°

@YHordijk YHordijk added the enhancement New feature or request label May 15, 2024
@YHordijk YHordijk requested review from SiebeLeDe and SEBeutick May 15, 2024 14:58
@YHordijk YHordijk self-assigned this May 15, 2024
@YHordijk YHordijk linked an issue May 15, 2024 that may be closed by this pull request
@YHordijk YHordijk marked this pull request as ready for review May 15, 2024 15:32
Copy link
Contributor

@SiebeLeDe SiebeLeDe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command line is very nice. There misses a check if the user tries to specify more than 4 identifiers, or less than 1. Can you raise an error if that is the case?

@YHordijk
Copy link
Contributor Author

The command line is very nice. There misses a check if the user tries to specify more than 4 identifiers, or less than 1. Can you raise an error if that is the case?

Good suggestion! Now we raise an AssertionError

@YHordijk YHordijk requested a review from SiebeLeDe May 16, 2024 09:14
@YHordijk YHordijk merged commit 9db8bcc into main May 17, 2024
6 checks passed
@YHordijk YHordijk deleted the 232-add-geometric-information-function branch May 17, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add geometric information function
2 participants