Skip to content

Instantly share code, notes, and snippets.

@bonfus
bonfus / MD_to_traj.py
Created January 15, 2023 10:19
Convert Siesta MD trajectory to ASE
# coding: utf-8
import sys
from scipy.io import FortranFile, FortranEOFError, FortranFormattingError
from ase.units import Bohr
from ase.io import read
from ase.io.trajectory import Trajectory
if len(sys.argv) == 1:
print('Usage: MD_to_traj.py PREFIX')
@bonfus
bonfus / lore.ipynb
Last active May 11, 2022 09:05
Lore
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#======================================================================
# CRYSTAL DATA
#----------------------------------------------------------------------
data_VESTA_phase_1
_chemical_name_common 'co0.247 ga mn ni1.753'
@bonfus
bonfus / HartreeFock.ipynb
Last active March 23, 2021 13:43
Hartree Fock Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bonfus
bonfus / README.md
Last active January 27, 2021 14:47
Results, Discussion or Results and discussion?

Results and discussion

In a recent manuscript that I wrote I've been asked to separate my "Results and Discussion" section into "Results" and "Discussion".

I obviously liked my original flow so I decided to quickly check how other autors are doing.

I used recent paper in my field (magnetism) downloading all the recent higlights section of PRM and PRB. It turns out that a self standing 'discussion' is getting less common.

@bonfus
bonfus / environment.yml
Last active August 6, 2020 12:26
Cheese
name: kwant-latest
channels:
- conda-forge
dependencies:
- python=3.6
- pip
- kwant
# required dependencies
- numpy
- scipy
@bonfus
bonfus / pwi2any.py
Last active January 22, 2020 08:56
Visualize initial magnetic configuration for QE inputs
# Requires ASE and QE Tools from AiiDA teem
from qe_tools import PwInputFile
from ase.calculators.calculator import Calculator, all_changes
from ase import Atoms
import numpy as np
import sys, os, re
class dummy_calc(Calculator):
"""This is used to trick ase and write whatever I want as forces,
in such a way that it can be seen in most output formats
@bonfus
bonfus / DalCorsoList
Created December 9, 2019 12:44
Generation of AiiDA friendly UPF families from PSLibrary
H: H.$fct-*_psl.1.0.0
He: He.$fct-*_psl.1.0.0
Li: Li.$fct-sl-*_psl.1.0.0
Be: Be.$fct-sl-*_psl.1.0.0
B: B.$fct-n-*_psl.1.0.0
C: C.$fct-n-*_psl.1.0.0
N: N.$fct-n-*_psl.1.0.0
O: O.$fct-n-*_psl.1.0.0
F: F.$fct-n-*_psl.1.0.0
Ne: Ne.$fct-n-*_psl.1.0.0
@bonfus
bonfus / pymatgen_to_aiida.py
Created October 21, 2019 14:50
PyMatGen to AiiDA
def pymatgen_to_aiida(pymatgen_structure, StructureData):
# analyze magnetism
magnetic_structure = CollinearMagneticStructureAnalyzer(pymatgen_structure, make_primitive=False)
has_spin = 0
if magnetic_structure.is_magnetic:
if magnetic_structure.is_collinear:
has_spin=2
else:
@bonfus
bonfus / Chi.ipynb
Created September 29, 2019 19:07
Convert Magnetic Susceptibility with IPy widgets
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.