Questions tagged [python]

For questions about materials modeling scripts written in the Python programming language. Questions should focus on interfacing with existing packages and aspects related to modeling, not general debugging.

Filter by
Sorted by
Tagged with
11
votes
3answers
1k views

How to make a python code that can read a .xyz file and find the distance between atoms?

I want to make a python script that will load an xyz file. From the xyz parameters, I need to find the distance between atoms, angle and dihedral between atoms. The file xyz have this structure: ...
9
votes
2answers
516 views

Python program that returns elements from a SMILE string

Given a SMILES string for a molecule, I want to know the elements in the molecule, I then send this to basis_set_exchange to get a "custom" basis set for use in Gaussian. This seems like ...
10
votes
1answer
103 views

Computing optimized 3D structures in python that take solvent into account

I have been using RDKit to generate 3D coordinates, cleaning-up the structures using a general-purpose force field as follows: ...
10
votes
2answers
116 views

Programs/Libraries for calculating solvent excluded surface and excluded volume

Given the 3D structure of a molecule (e.g. as *.mol) and a probe radius r, I want to calculate the solvent excluded surface (SES)...
6
votes
0answers
34 views

How to interpret WannierTools Python code that generates tight-binding model in the wannier90_hr.dat format?

I am getting myself acquainted with Wannier Tools. Wannier Tools requires two inputs, a wt.in file, and a .dat file. This .dat file should have the structure explained in the manual here. This file ...
6
votes
1answer
54 views

How to obtain electron charge density per unit volume about a water molecule using SlowQuant?

@Nike Dattani's answer to How to “get my feet wet” in Density Functional Theory by simulating a water molecule using Python recommends SlowQuant. I've used the install instructions for Linux on my ...
12
votes
1answer
86 views

Metropolis algorithm reduces energy in molecular simulation, but does not decrease euclidean distance

I am using an open source python package openmmtools to run a simple molecular simulation problem using the metropolis algorithm. I first load a default system of particles (alanine-dipeptide in ...
5
votes
0answers
56 views

Cannot import both numpy and LAMMPS to python after installing with conda

I installed the module LAMMPS by using this command conda install -c conda-forge lammps I want to import LAMMPS to python code, but it says: ...
9
votes
4answers
315 views

How to make a python code that can read a .xyz file and find distance, angle and dihedral angle between atoms?

I want to make a python script that will load an xyz file. From the xyz parameters, I need to find the distance between atoms, angle and dihedral between atoms. If I have a xyz coordinate in this ...
7
votes
1answer
97 views

How to understand the wavefunction outputed by QE with HDF5 format?

Following the answer to my question: What is the best program to manipulate numerical DFT wavefunctions to calculate custom matrix elements?, I compiled Quantum ESPRESSO with the hdf5 flag on, and now ...
7
votes
1answer
41 views

Fractal dimension (SEM image) using the box-counting method

I am trying to discover the fractal dimension of the image of the following dendrite that was obtained by SEM (scanning electron microscope) by the box-counting method (Python). I found this code on ...
12
votes
1answer
99 views

What is the best program to manipulate numerical DFT wavefunctions to calculate custom matrix elements?

For pedagogical reasons, I am looking for ways to calculate quantum-mechanical quantities such as $\langle m | \dot{m}\rangle, \langle m | \dot{n}\rangle, \langle m | \ddot{n}\rangle$ using ...
8
votes
1answer
107 views

Using OpenBabel or RDKIT Python API to generate conformers from a SMILES string

I have a bunch of monomers in the form of SMILES string and I want to generate conformers from them. At the moment, I am using RDKit to convert these SMILES strings to .sdf files, then using ...
7
votes
1answer
94 views

How to build the [111] slab model of NiSe2 with different terminations with ASE tool?

The following figure is the bulk structure of NiSe$_2$ downloaded from the materials project database. Now I want to study the properties of its [111] plane. In detial, I cut the slab with atomic ...
11
votes
1answer
64 views

Interpret 2D and 3D data from a PubChem summary of organometallic molecule? Can I “flatten” it when showing on a surface?

I need to "build" an organometallic molecule in Blender/Python then represent it resting on a crystal surface. I'm looking at a PubChem summary for Chloroaluminum phthalocyanine and I can ...
12
votes
1answer
217 views

Is there a more efficient hard sphere packing algorithm?

I am trying to pack hard-spheres in a unit cubical box, such that these spheres cannot overlap on each other. This is being done in Python. I am given some packing fraction ...
7
votes
1answer
72 views

Normalization condition in evaluating the radial distribution function for a hard-spheres system

I am trying to simulate a 3D hard-spheres in a box system in python. The idea behind this is that I have to create a system in a 1-by-1-by-1 box with periodic boundary conditions and with $N = 500$ ...
11
votes
1answer
105 views

How to get order constitution data for single equilibrium calculation in Thermo-Calc's TC Python module?

I know that it is possible to get order constitution data for phases when using Thermo-Calc's GUI (e.g. to get "BCC_B2 DISORD" instead of just "BCC_B2") for a single equilibrium ...
10
votes
1answer
119 views

Generating SOAP descriptors in python

What is the best python package to construct Smooth Overlap of Atomic Positions (SOAP) descriptors given SMILES representation of a molecule? Is this even possible without providing 3D geometry? An ...
15
votes
2answers
694 views

Open Source PyMol Conda Package: UnsatisfiableError

I'm having an issue installing the open-source version of Pymol using Anaconda on Windows. I have Python3.8.3 installed and when I try add the package with Conda using ...
9
votes
3answers
519 views

Molecular visualization software in Jupyter (IPython) Notebooks

Jupyter notebooks have always been a great way for me to create high-quality graphs, and write code. The features also continue to improve with packages such as Jupyter Lab, and now Jupyter Books, ...
9
votes
2answers
59 views

Evaluating the MSD of my simulation

I am running a molecular dynamics simulation of water in TIP3P, and I am storing the positions of my particles in a 2D array called relevant_positions. The number ...
10
votes
2answers
507 views

RDkit: While converting a *.sdf file to fingerprint, I'm facing several errors

suppl = Chem.SDMolSupplier('1.sdf') for mol in suppl: if mol is None: continue # print(mol.GetNumAtoms()) fps = [Chem.RDKFingerprint(x) for x in supply] I am ...
17
votes
0answers
166 views

What are the tools available for point defects calculations?

As far as I know, there are mainly PyCDT, PyDEF, pylada and some part of pymatgen. As a new user to those tools, which one would be a good choice? It would be appreciated if you could explain one of ...
11
votes
3answers
156 views

Is python sufficient for serious tensor network or DMRG calculations?

There are enough tensor-network/DMRG packages that support python (ALPS, OpenMPS, pyUni10) that it would seem (to an outsider) that it's possible to do some substantial work with DMRG without messing ...
9
votes
0answers
194 views

I wrote a Python code to do MD for a Lennard-Jones fluid but the VACF is wrong: What might be the problem? [closed]

I am trying to write a molecular dynamics simulation for a Lennard-Jones fluid in a box with periodic boundary conditions. The box has no net momentum. I am writing this in python. I have written a ...
17
votes
2answers
814 views

How to find Young's Modulus using stress strain curve using Python?

I am trying to find the The Young's Modulus of an aluminum alloy The yield stress Below is the data for the stress-strain curve. I tried finding the region where the slope is constant and to my ...
23
votes
4answers
3k views

How to write my own density functional theory (DFT) code in Python?

I am a DFT user and at some point in the future, I would like to write my own DFT code in Python to help gain a deeper understanding of DFT. As mentioned in a previous answer people have written their ...
26
votes
3answers
2k views

How to “get my feet wet” in Density Functional Theory by simulating a water molecule using Python

I just saw I am a beginner in Density Functional Theory. What are some resources that could help me to learn the basics? and it reminded me that few years ago I'd asked How can I calculate the charge ...
26
votes
2answers
401 views

How is Julia used in Materials Modeling?

What are the main uses and applications of Julia in Materials Modeling? Python for example is used in codes such as kwant, ...
16
votes
1answer
182 views

How to calculate t-zero temperature using Thermo-Calc- Python (TCPython) for multiple alloys?

T-zero temperature is the temperature at which the Gibbs energies of two phases are equal. Here, I wish to find the temperature at which FCC and BCC have same Gibbs energy. Thermo-Calc console mode ...
34
votes
13answers
2k views

What is a good programming language for matter modeling?

What is a good programming language for matter (e.g. molecular or materials) modeling? Since this is a broad field, I don't expect there to be only one answer.