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

To initialize the geometry #18

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

To initialize the geometry #18

wants to merge 4 commits into from

Conversation

tirthbha
Copy link

This is the one way to initialize the geometry.

@reshnashrestha
Copy link
Collaborator

Can you elaborate the code you have used like what does it do?

@pratibha77118
Copy link

@tirthbh how is this method different and effective from the one given in Com-Phy ? Could you explain how can your code be implemented for different structure?

@reshnashrestha
Copy link
Collaborator

Yes, exactly we can find the similar in compphys. But how can we be sure to choose for different configurations?

@tirthbha
Copy link
Author

@reshnashrestha @pratibha77118 I have added details in the code shown below. This is just an example for the tetrahedron structure. You can take this as a reference for your chosen sructure.

import numpy as np

# Define the edge length of the tetrahedron based on expected ion separation
# Edge length is set to 0.3 nanometers, an arbitrary starting point that might represent the average ion distance
edge_length = 0.3  

# Define the vertices of a regular tetrahedron
# These vertices are in a normalized form and represent the corners of a regular tetrahedron
# Each vertex is a 3D coordinate [x, y, z]
vertices = np.array([[1, 1, 1],
                     [-1, -1, 1],
                     [-1, 1, -1],
                     [1, -1, -1]])

# Scale the vertices to the actual edge length of the tetrahedron
# Division by sqrt(3) scales the unit-length edges of the normalized tetrahedron to the desired edge length
tetrahedron_positions = vertices * (edge_length / np.sqrt(3))

# Assign Na+ and Cl- ions to the vertices alternately
# This loop creates pairs of ion type (Na or Cl) and their positions at the tetrahedron vertices
ideal_geometry = []
for i, pos in enumerate(tetrahedron_positions):
    ion = 'Na' if i % 2 == 0 else 'Cl'  # Alternating assignment: even index gets Na, odd index gets Cl
    ideal_geometry.append((ion, pos))   # Append a tuple of ion type and position

# Convert the list of ion positions and types into a structured NumPy array
# This array now represents the ideal geometric arrangement of Na+ and Cl- ions in a tetrahedral structure
ideal_geometry = np.array(ideal_geometry) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants