This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: python | |
# turn off sudo | |
sudo: false | |
# python versions to be tested | |
matrix: | |
include: | |
- python: 2.7 | |
- python: 3.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .readthedocs.yml | |
version: 2 | |
build: | |
image: latest | |
python: | |
version: 3.7 | |
install: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
molecule.py | |
A python package for the MolSSI Software Summer School. | |
Contains a molecule class | |
""" | |
import numpy as np | |
def calculate_distance(rA, rB): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .readthedocs.yml | |
version: 2 | |
build: | |
image: latest | |
python: | |
version: 3.6 | |
install: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_molecular_mass(symbols): | |
"""Calculate the mass of a molecule. | |
Parameters | |
---------- | |
symbols : list | |
A list of elements. | |
Returns | |
------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_center_of_mass(symbols, coordinates): | |
"""Calculate the center of mass of a molecule. | |
The center of mass is weighted by each atom's weight. | |
Parameters | |
---------- | |
symbols : list | |
A list of elements for the molecule | |
coordinates : np.ndarray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
for atom1 in atoms: | |
for atom2 in atoms: | |
a1 = atoms.index(atom1) | |
a2 = atoms.index(atom2) | |
coor1 = coordinates[a1] | |
coor2 = coordinates[a2] | |
distance = np.sqrt(np.sum((coor1-coor2)**2)) | |
if 0 < distance <= 1.5: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def read_xyz(filepath): | |
""" | |
Reads coordinates from an xyz file. | |
Parameters | |
---------- | |
filepath : str | |
The path to the xyz file to be processed. | |
Returns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rdf(values, max_value, bin_size,num_particles, box_length): | |
""" | |
Calculate the radial distribution function for a set of particles. | |
Parameters | |
---------- | |
values : list | |
A list of particle particle distances. | |
max_value : float | |
The maximum value to consider for the calculation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rdf(values, n_bins, max_value, num_particles, box_length): | |
""" | |
Compute the RDF for a set of values | |
Parameters | |
----------- | |
values : np.ndarray | |
The distance values to compute the RDF for. | |
n_bins : int |
OlderNewer