Showing difference in files

We are submitting the review “Twenty Years After: Scaling Relations in Oxygen Electrocatalysis and Beyond

I have made so many changes to the LaTeX code that latexdiff gives 99+ errors. UPDATE: the errors were related to table and equations. To fix them I played with –math-markup=none and –add-to-config PICTURENEV=tabular, but eventually just fixed the Tables and specific errors.

There are two ways to get diff in overleaf, which I use.

In search for an alternative, have tested DiffPDF and Meld. The result looks useful, yet unsuitable for submitting them to the editor. So, this post should have a label “do not know how” instead of usual “know-how”. Still, fun.

To make the last printscreen, I did the following.

Installed packages in Linux/Ubuntu/WSL2.

sudo apt-get -y install meld calibre parallel

Saved the following code in a file named “diffdoc” (with no extensions) inside directory “/usr/local/bin”.

usage="
*** usage:

diffepub - compare text in two files. Valid format for input files are:
MOBI, LIT, PRC, EPUB, ODT, HTML, CBR, CBZ, RTF, TXT, PDF and LRS.

diffepub -h | FILE1 FILE2

-h print this message

Example:
diffepub my_file1.pdf my_file2.pdf
diffepub my_file1.epub my_file2.epub

v0.2 (added parallel and 3 files processing)
"

#parse command line options
while getopts "h" OPTIONS ; do
  case ${OPTIONS} in
    h|-help) echo "${usage}"; exit;;
  esac
done
shift $(($OPTIND - 1))

#check if first 2 command line arguments are files
if [ -z "$1" ] || [ -z "$2" ] || [ ! -f "$1" ] || [ ! -f "$2" ]
then
  echo "ERROR: input files do not exist."
  echo
  echo "$usage"
  exit
fi



#create temporary files (first & last 10 characters of
# input files w/o extension)
file1=`basename "$1" | sed -r -e '
s/\..*$//                     #strip file extension
s/(^.{1,10}).*(.{10})/\1__\2/ #take first-last 10 chars
s/$/_XXX.txt/                 #add tmp file extension
'`
TMPFILE1=$(mktemp --tmpdir "$file1")

file2=`basename "$2" | sed -r -e '
s/\..*$//                     #strip file extension
s/(^.{1,10}).*(.{10})/\1__\2/ #take first-last 10 chars
s/$/_XXX.txt/                 #add tmp file extension
'`
TMPFILE2=$(mktemp --tmpdir "$file2")

if [ "$#" -gt 2 ] 
then
  file3=`basename "$3" | sed -r -e '
  s/\..*$//                     #strip file extension
  s/(^.{1,10}).*(.{10})/\1__\2/ #take first-last 10 chars
  s/$/_XXX.txt/                 #add tmp file extension
  '`
  TMPFILE3=$(mktemp --tmpdir "$file3")
fi

#convert to txt and compare using meld
doit(){ #to solve __space__ between filenames and parallel
  ebook-convert $1
}
export -f doit
if [ "$#" -gt 2 ] 
then
  (parallel doit ::: "$1 $TMPFILE1" \
                     "$2 $TMPFILE2" \
                     "$3 $TMPFILE3" ) &&
  (meld "$TMPFILE1" "$TMPFILE2" "$TMPFILE3")
else
  (parallel doit ::: "$1 $TMPFILE1" \
                     "$2 $TMPFILE2" ) &&
  (meld "$TMPFILE1" "$TMPFILE2")
fi

Made sure the owner is me and it has execution permissions:

sudo chown $USER:$USER /usr/local/bin/diffepub
sudo chmod 700 /usr/local/bin/diffepub

Run it on two pdf files:

diffdoc FILE1.pdf FILE2.pdf

Playing with new xTB

https://chemrxiv.org/engage/chemrxiv/article-details/685434533ba0887c335fc974

# login to HPC
wget https://github.com/grimme-lab/g-xtb/archive/refs/tags/v1.0.0.tar.gz
tar -xvf v1.0.0.tar.gz
nano ~/.bashrc
add "export PATH=~/g-xtb-1.0.0/binary:$PATH"
exit .bashrc
source ~/.bashrc
cp -r ~/g-xtb-1.0.0/parameters/ ~/
# create a new conda environment
conda create gxtb
conda activate gxtb
conda install -c conda-forge libgfortran=14.2.0
conda install -c conda-forge xtb
# run
xtb example.xyz --driver "gxtb -grad -c xtbdriver.xyz" --optA quick test of g-xTB

Reconnecting colab

Recently I noticed that my colab notebooks get too often disconnected. Yes, their run takes over an hour, which is a usual timing for a seminar. I just want to test that they run by executing all cells and leaving my workplace.

Here is how to set up an automatic reconnect using javascript functions that one can enter to the browser console:

function ConnectButton() {console.log("Working");document.querySelector("#connect").click()}
setInterval(ConnectButton,600000);

Uni-, false, and true bifunctional oxygen catalysis

Publishing as chapters in books does now always attract the deserved attention. That might be the case with a chapter I co-authored: R. Cepitis, A. Kosimov, V. Ivaništšev, and N. Kongi, in Multi-functional ElectrocatalystsFundamentals and Applications, ed. V. S. Saji and V. K. Pillai, Royal Society of Chemistry, 2024, vol. 46, ch. 13, pp. 357-374. https://drive.google.com/file/u/0/d/1_oLCbMU6vxPsQe93HitgP-rm6bFSvED_/view

It is worth reading for at least two reasons. First it gives a nice overview of uni-, false, and true bifunctional oxygen catalysis in just one Figure:

Second, it provides a dictionary for theoreticians and experimentalists to allow them to talk about workflows in electrocatalysis:

Uniting “simulants” over pizza

This semester I am co-organising a seminar on computer simulations (3 ECTS, LOTI.05.076). One of the aim is to gather and unite researchers from different institutes. Our common topic is using computers in research, so we are “simulants”, i.e. simulating reality via calculations. Some of core organisers are pictured in the centre, from left to right: Taavi Repän, Tauno Tiirats, Veronika Zadin, and Juhan Matthias Kahk.

My first talk was about running simulations on HPC, e.g. using apptainers. Probably because of free pizza there were two–three dozen of participants from institutes of Chemistry, Physics, and Technology, which is a surprisingly high number for the university of Tartu. It is a great start and I am looking forward to contribute more into strengthening collaboration between the institutes.

Colors in ASE

Updated colors for atoms in ASE in 2024 look like this:

For POV rendering there are several options: ASE2, ASE3, Glass, Glass2, Intermediate, JMOL, Pale, Simple, VMD. I like intermediate because it does not have an reflection and glare.

List of banned tells for GPT

1) Just watched Andy Stapleton youtube-video about echo technique for working with chatGPT. After that I have made my list of banned tells for GPT. Here it is.

You must not use these words and phrases: Vibrant, Bustling, Vital, Out of the box, Underscores, Dive into, Reverberate, Delve, Hustle and bustle, Foster, Labyrinthine, Moist, Remnant, Nestled, Game changer, Symphony, Gossamer, Enigma, A testament to, Indelible, Meticulous, Meticulously, Navigating, Complexities, Realm, Tailored, Underpins, Everchanging, Ever-evolving, Not only, Embark, Designed to enhance, It is advisable, Daunting,  In the realm of, Unlock the secrets, Unveil the secrets, Diving, Unleash, Harness, Tapestry, Take a dive into, Leverage, Metropolis, Unless, Arguably, To put it simply, Promptly, In today's digital era. Avoid analogies and ambiguity in wording. Avoid using gerunds, mdash, and other ways of extending sentences; instead split a sentence and consider removing the unnecessary second part. Avoid words that non-native speakers may not understand. Avoid jargon, but do keep all my terms – do not substitute technical terms with analogies. Avoid comparative adjectives and remove adjectives that do not shape the meaning. 

2) Previously I also used this prompt for working with LaTeX codes, but now I simply use texGPT in overleaf for quick drafting.
Start every sentence on a new line. Add line breaks after every 60 characters to make the text easier to read, but do not add these breaks within commented text. Preserve all original comments exactly as written, and do not delete anything unless explicitly instructed.

3) When working within a project, I define instructions like this:

Prohibited words and phrases: You must not use these words and phrases: Vibrant, Bustling, Vital, Out of the box, Underscores, Dive into, Reverberate, Delve, Hustle and bustle, Foster, Labyrinthine, Moist, Remnant, Nestled, Game changer, Symphony, Gossamer, Enigma, A testament to, Indelible, Meticulous, Meticulously, Navigating, Complexities, Realm, Tailored, Underpins, Everchanging, Ever-evolving, Not only, Embark, Designed to enhance, It is advisable, Daunting,  In the realm of, Unlock the secrets, Unveil the secrets, Diving, Unleash, Harness, Tapestry, Take a dive into, Leverage, Metropolis, Unless, Arguably, To put it simply, Promptly, In today's digital era. Avoid analogies and ambiguity in wording. Avoid using gerunds, mdash, and other ways of extending sentences; instead split a sentence and consider removing the unnecessary second part. Avoid words that non-native speakers may not understand. Avoid jargon, but do keep all my terms – do not substitute technical terms with analogies. Avoid comparative adjectives and remove adjectives that do not shape the meaning. 
You must avoid using "potential" in the sense of showing the capacity to develop into something in the future, because "electric potential" is a physical quantity. you must avoid "framework" in the sense of a basic structure underlying a computations, because "organic framework" is a term in material science. You must avoid using "capacity" and "capacitance" in sense of ability to do something, because similar terms are used in electrochemistry. You must avoid using "generation" in sense of production.

Faculty interview

Recently I have been preparing for an interview for a faculty position. As usual I watched a lot of videos, read some tutorials, chatted with GPT, and talked to people (to whom I am very grateful).

The most insightful video turned out to be by Wenhao Sun UM. See below. It is about having a solid research vision!

Besides I would highly recommend a youtube channel “Life in academia” of a very positive prof. Matthias Rillig.

P.S. Despite preparation, I have not anticipated even a single question.

My first presentation generated with AI

I am working on a presentation and use AI for the first time to draft some texts.

There are already existing solutions. Like plug-ins for google slides and copilot that works with powerpoint. I am using chatGPT and work in google slides.

Here is how I add some slides through app scripts:

function addSlide() {
    const presentationName = "ScientificActivities";
    const presentations = DriveApp.getFilesByName(presentationName);
    if (!presentations.hasNext()) return;

    const presentation = SlidesApp.openById(presentations.next().getId());
    const layouts = presentation.getMasters()[0].getLayouts();
    const targetLayout = layouts.find(layout => layout.getLayoutName() === "OBJECT");
    if (!targetLayout) return;

    const titleText = "Bridging Modelling and Scalable Chemical Processes"; // Edit title here
    const bodyText = "Assoc. Prof. Vladislav Ivaništšev"; // Edit body content here

    const newSlide = presentation.appendSlide(targetLayout);
    newSlide.getPlaceholder(SlidesApp.PlaceholderType.TITLE).asShape().getText().setText(titleText);
    newSlide.getPlaceholder(SlidesApp.PlaceholderType.BODY).asShape().getText().setText(bodyText);
}

Title and body can be generated by … within a long conversation with my personal research assistants. I enjoy the process because these skills will save me a lot of time in the future, although right now it took me some hours to get this simple code working. I have also used AI to find and download a dozen on logos of universities that I have visited (shown below). And it saved me time to get facts from my CV right into the slides.