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

adding fssh feature to pysurf #9

Open
wants to merge 88 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
fcb214b
adding fssh feature to pysurf
Oct 26, 2023
e1d11ff
Updating energy parameter
Oct 30, 2023
fa7908c
Updating to write geometry format of BAGEL
Oct 30, 2023
4a26ce8
Update README.rst
gatox Nov 1, 2023
7a1b7f9
Update README.rst
gatox Nov 1, 2023
956516f
Revert "Update README.rst"
Nov 1, 2023
4ee6b36
Revert "Update README.rst"
Nov 1, 2023
98969f9
Removing old scripts for setup_propagation and qchem interface
Nov 1, 2023
d7c2aa9
Merge pull request #1 from gatox/old_branch
gatox Nov 1, 2023
0c8a698
The charge and multiplicity are provided by the user
Nov 10, 2023
5736e72
Merge pull request #2 from gatox/old_branch
gatox Nov 10, 2023
ed68780
Adding substeps via interpolation in the electronic propagator
Nov 13, 2023
0985276
Merge pull request #3 from gatox/old_branch
gatox Nov 13, 2023
bfd2ed5
Changing the function for interpolation, there was an error
Nov 21, 2023
3f99e6b
Merge pull request #4 from gatox/old_branch
gatox Nov 21, 2023
4b3f657
Removing some unnecessary lines of code
Nov 21, 2023
83e9101
Merge pull request #5 from gatox/old_branch
gatox Nov 21, 2023
bd60375
Changing the zero matrix to the identity matrix for the loop
Nov 22, 2023
00d4350
Merge pull request #6 from gatox/old_branch
gatox Nov 22, 2023
4baf2c5
Merge pull request #7 from MFSJMenger/master
gatox Nov 27, 2023
4761499
Adding a new feature to run LZ with nacs when there is a hop to resca…
Mar 12, 2024
5778e50
Merge pull request #8 from gatox/old_branch
gatox Mar 12, 2024
b11b162
Update^Cubmit calculations
Mar 22, 2024
d18c53e
Merge pull request #9 from gatox/old_branch
gatox Mar 22, 2024
4218e63
Changing to use the LZSH implemented in FSSH plugin
Mar 27, 2024
a57c0b9
Merge pull request #10 from gatox/old_branch
gatox Mar 27, 2024
3957b0a
Updating saoovqe interface and setup propagation
Apr 3, 2024
9ca32a1
Merge pull request #11 from gatox/old_branch
gatox Apr 3, 2024
68ab1a4
Adding a required file for documentation
gatox Apr 4, 2024
f1977cb
Merge pull request #12 from gatox/old_branch
gatox Apr 4, 2024
71f7b9c
Update README.rst
gatox Apr 4, 2024
794378f
Update README.rst
gatox Apr 4, 2024
1997e7d
Merge pull request #13 from gatox/old_branch
gatox Apr 4, 2024
e976658
Implementing coupled trajectory scheme
gatox Apr 4, 2024
3123dda
Planing
gatox Apr 12, 2024
89d2af3
Basic scheme of coupled trajectories
gatox Apr 12, 2024
b788f95
Merge pull request #14 from gatox/old_branch
gatox Apr 12, 2024
41da1f2
Adding Zhu-Nakamura formula (starting)
gatox Apr 24, 2024
0ddbc82
Adjusting to run with saoovqe
May 1, 2024
42ad070
Merge pull request #15 from gatox/qc_branch
gatox May 1, 2024
f2a5284
Adding Zhu-Nakamura formula (starting)
gatox Apr 24, 2024
4f15f40
Updating changes
gatox May 16, 2024
76758d6
Merge branch 'ct_old_branch' of https://github.com/gatox/pysurf_fssh …
gatox May 16, 2024
43d3179
Adding a factor to rescale the kinetic energy based on the number of …
gatox May 24, 2024
67a2598
Increasing the default variance value from 10^-5 to 10^-20
gatox May 24, 2024
9a039b6
Merge pull request #17 from gatox/ct_old_branch
gatox May 24, 2024
cc09e51
Adding flags to select noise in different parts of the SAOOVQE code. …
gatox May 28, 2024
3344def
Adding new sbatch script to run with ibIntel partition
gatox May 28, 2024
d9193c4
Implementing the Nose-Hoover thermostat
gatox Jun 5, 2024
224d932
Fixing some functions
gatox Jun 6, 2024
73ac1e9
Changing an issue related to the type of variable used in noise flags
gatox Jun 11, 2024
2c4f4cd
Add files via upload
gatox Jul 9, 2024
890cc77
Add files via upload
gatox Jul 9, 2024
8bb1237
Update README.rst
gatox Jul 9, 2024
f1c10fc
Merge pull request #22 from gatox/gatox-patch-1
gatox Jul 9, 2024
e75b913
Update README.rst
gatox Jul 9, 2024
a29a61c
Merge pull request #23 from gatox/gatox-patch-2
gatox Jul 9, 2024
d93700d
Update README.rst
gatox Jul 9, 2024
188a414
Merge pull request #24 from gatox/gatox-patch-3
gatox Jul 9, 2024
b956b5b
Update README.rst
gatox Jul 10, 2024
bf6f0f0
Merge pull request #25 from gatox/gatox-patch-4
gatox Jul 10, 2024
5ec7b38
Rename ‎PySurf_FSSH_logo.‎001.jpeg to ‎PySurf_FSSH_logo.jpeg
gatox Jul 10, 2024
ba49a21
Merge pull request #26 from gatox/gatox-patch-5
gatox Jul 10, 2024
02b3c2c
Delete docs/‎PySurf_FSSH_logo.jpeg
gatox Jul 10, 2024
5d79289
Merge pull request #27 from gatox/gatox-patch-6
gatox Jul 10, 2024
a5b09f5
Update README.rst
gatox Jul 22, 2024
17290df
Update README.rst
gatox Jul 22, 2024
6528bc0
Merge pull request #28 from gatox/gatox-patch-7
gatox Jul 22, 2024
8202f27
Update README.rst
gatox Jul 22, 2024
b7e5edd
Merge pull request #29 from gatox/gatox-patch-7-1
gatox Jul 22, 2024
89ab9f3
Merge pull request #30 from gatox/ct_old_branch
gatox Jul 23, 2024
67d5c37
Merge pull request #31 from gatox/nose-hoover_ther_branch
gatox Jul 23, 2024
25cc48c
Update README.rst
gatox Jul 23, 2024
0deaf5d
Merge pull request #32 from gatox/gatox-patch-7-2
gatox Jul 23, 2024
57c212f
Merge pull request #33 from gatox/gatox-patch-7-2
gatox Jul 23, 2024
d6e570c
Merge pull request #34 from gatox/ct_old_branch
gatox Jul 23, 2024
b486660
Merge pull request #35 from gatox/gatox-patch-1
gatox Jul 23, 2024
1936795
adding changes to prop_dynamics.py and vv_three_deco_fssh_lzsh_propag…
gatox Jul 24, 2024
c4a5794
Updating rescaling velocity schemes
gatox Jul 26, 2024
fa970fc
Merge branch 'master' into vdf_old_branch
gatox Jul 26, 2024
2d2106e
Merge pull request #38 from gatox/vdf_old_branch
gatox Jul 26, 2024
fdcd983
Bug solve realted to type of variable in substeps
gatox Jul 29, 2024
a169ac7
Merge branch 'vdf_old_branch' of https://github.com/gatox/pysurf_fssh…
gatox Jul 29, 2024
e5ac4a7
Merge pull request #39 from gatox/vdf_old_branch
gatox Jul 29, 2024
e4c19d6
Adding run_hoax.py and logo_pysurf_fssh.jpeg
gatox Jul 29, 2024
0fe02d2
Solving bug in subset variable
gatox Jul 30, 2024
ebe0489
Merge pull request #40 from gatox/vdf_old_branch
gatox Jul 30, 2024
096bc24
updated from alice1
Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
50 changes: 33 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
==============================================================
PySurf: A Framework for Database Accelerated Quantum Chemistry
==============================================================
==============================================================================
PySurf-FSSH: New Plugin for PySurf to Perform Nonadiabatic Dynamics using FSSH
==============================================================================

::

_____ _____ __
| __ \ / ____| / _|
| |__) |_ _ | (___ _ _ _ __ | |_
| ___/| | | | \___ \ | | | || '__|| _|
| | | |_| | ____) || |_| || | | |
|_| \__, ||_____/ \__,_||_| |_|
__/ |
|___/
.. image:: docs/logo_pysurf_fssh.jpeg
:alt: Schematic description of the code structure
:width: 700px

The FSSH Plugin is based on the standard FSSH algorithm proposed by Tully plus a decoherence correction to avoid overcoherence and a velocity adjustment to conserve the total energy. A comprehensive comparison using this plugin between the conventional Tully’s fewest switches surface hopping (FSSH) scheme and the Landau–Zener surface hopping (LZSH) to study photoinduced ring-opening of 1,3-cyclohexadiene to 1,3,5-hexatriene at SF-TDDFT level can be found here_.

.. _here: https://pubs.acs.org/doi/10.1021/acs.jctc.4c00012

Requirements
------------
Expand All @@ -23,8 +18,6 @@ Requirements

Both can be installed by:

::

pip install pycolt qctools

Additionally:
Expand All @@ -45,9 +38,32 @@ ____________
- Light-weight
- Developer/user friendly

Interfaces:
____________

- Q-Chem_: TDDFT, SF-TDDFT & EOM-CCSD
- OpenMolcas_: SA-CASSCF, XMS-CASPT2
- BAGEL_: XMS-CASPT2
- SA-OO-VQE_ (Quantum Algorithm)
.. _Q-Chem: https://manual.q-chem.com/latest/
.. _OpenMolcas: https://gitlab.com/Molcas/OpenMolcas
.. _BAGEL: https://nubakery.org/
.. _SA-OO-VQE: https://github.com/qc2nl/SAOOVQE

Thermostat:
____________

- Nose-Hoover_
.. _Nose-Hoover: https://pubs.aip.org/aip/jcp/article/83/8/4069/219065/The-Nose-Hoover-thermostatThe-Nose-Hoover

Documentation:
--------------

https://pysurf-fssh.readthedocs.io/


Credits
-------
Credits:
--------

This work was supported by the Innovational Research Incentives Scheme Vidi 2017 with project number 016.Vidi.189.044, (partly) funded by the Dutch Research Council (NWO).

Expand Down
44 changes: 36 additions & 8 deletions bin/setup_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
from pysurf.setup import SetupBase
from pysurf.spp import SurfacePointProvider
from pysurf.dynamics import RunTrajectory
from pysurf.fssh import State
from pysurf.utils import exists_and_isfile



class SetupPropagation(SetupBase):

folder = 'prop'
Expand All @@ -19,22 +21,26 @@ class SetupPropagation(SetupBase):
n_traj = -1 :: int

# Database containing all the initial conditions
sampling_db = :: existing_file
sampling_db = sampling.db :: existing_file

# Filepath for the inputfile of the Surface Point Provider
spp = spp.inp :: file

# initial excited state for the trajectory
initial state = :: int

#Filepath for the inputfile of the Propagation
# Filepath for the inputfile of the Propagation
prop = prop.inp :: file

# Decide whether database for the propagation should be copied to the trajectory folder
copy_db = none :: str

## Run LZ or FSSH
#tsh_method = :: str :: FSSH, LZ
"""

def __init__(self, config):
#self.tsh_method = config['tsh_method']
""" Class to create initial conditions due to user input. Initial conditions are saved
in a file for further usage.
"""
Expand All @@ -47,16 +53,28 @@ def __init__(self, config):

#Make sure that inputfile for the SPP exists and is complete

if exists_and_isfile(config['spp']): lconfig = config['spp']
if exists_and_isfile(config['spp']):lconfig = config['spp']
else: lconfig = None
SurfacePointProvider.generate_input(config['spp'], config=lconfig)
spp_config = SurfacePointProvider.generate_input(config['spp'], config=lconfig)
if spp_config['mode'] == 'ab-initio':
self.model = None
self.basis = spp_config['mode']['software']['basis']
elif spp_config['mode']['model'] == 'LVC':
self.model = "LVC"
self.basis = None
else:
self.basis = None
self.model = None

#Make sure that inputfile for RunTrajectory exists and is complete
if exists_and_isfile(config['prop']): lconfig = config['prop']
else: lconfig = None
RunTrajectory.generate_input(config['prop'], config=lconfig)

#if self.tsh_method == 'FSSH':
# State.from_questions(config = "prop.inp")
#elif self.tsh_method == 'LZ':
# RunTrajectory.generate_input(config['prop'], config=lconfig)
#
State.from_questions(config = "prop.inp")
if config['n_traj'] == -1:
ntraj = len(sampling._db)
else:
Expand All @@ -74,12 +92,21 @@ def from_config(cls, config):
def setup_folder(self, number, foldername, config, sampling):
copy(config['prop'], foldername)
copy(config['spp'], foldername)
if self.model == 'LVC':
copy('pyrmod6.inp', foldername)

if self.basis == 'gen':
copy('basis_gen.ini', foldername)

if config['copy_db'] != 'none':
copy(config['copy_db'], foldername)

initname = os.path.join(foldername, 'init.db')
#if self.tsh_method == 'FSSH':
# initname = os.path.join(foldername, 'sampling.db')
#elif self.tsh_method == 'LZ':
# initname = os.path.join(foldername, 'init.db')
#setup new database
initname = os.path.join(foldername, 'sampling.db')
new_sampling = Sampling.create_db(initname, sampling.info['variables'], sampling.info['dimensions'], sampling.system, sampling.modes, model=sampling.model, sp=True)
#copy condition to new db
condition = sampling.get_condition(number)
Expand All @@ -88,4 +115,5 @@ def setup_folder(self, number, foldername, config, sampling):


if __name__=="__main__":
SetupPropagation.from_commandline()
SetupPropagation.from_questions(config = "setup_propagation.inp")
#SetupPropagation.from_commandline()
63 changes: 63 additions & 0 deletions bin/submit_traj.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import os
from subprocess import run, CalledProcessError

class SubmitTrajectories:

def read_sampling(self):
prop = open("sampling.inp", 'r+')
for line in prop:
if "model = " in line:
model = str(line.split()[2])
elif "from = molden" in line:
model = "molecule"
return model

def read_spp(self):
prop = open("spp.inp", 'r+')
for line in prop:
if "use_db =" in line:
use_db = str(line.split()[2])
return use_db

def read_prop(self):
prop = open("prop.inp", 'r+')
for line in prop:
if "method =" in line:
method = str(line.split()[2])
return method

def trajectories(self):
model = self.read_sampling()
use_db = self.read_spp()
method = self.read_prop()
for traj in os.listdir("prop"):
subfolder = os.path.join("prop",traj)
try:
if method == "LandauZener":
if use_db == "yes":
run(['sbatch db_lz_run.sh'], cwd=subfolder, check=True, shell=True)
else:
run(['sbatch lz_run_om.sh'], cwd=subfolder, check=True, shell=True)
#run(['sbatch lz_run.sh'], cwd=subfolder, check=True, shell=True)
elif method == "Surface_Hopping":
if model == "Tully_1":
run(['sbatch model_fssh_run.sh'], cwd=subfolder, check=True, shell=True)
elif model == "LVC":
run(['sbatch lvc_fssh_run.sh'], cwd=subfolder, check=True, shell=True)
else:
#run(['sbatch lz_nacs.sh'], cwd=subfolder, check=True, shell=True)
#run(['sbatch saoovqe.sh'], cwd=subfolder, check=True, shell=True)
run(['sbatch in_saoovqe.sh'], cwd=subfolder, check=True, shell=True)
#run(['sbatch test_open_molcas.sh'], cwd=subfolder, check=True, shell=True)
#run(['sbatch open_molcas.sh'], cwd=subfolder, check=True, shell=True)
#run(['sbatch bagel.sh'], cwd=subfolder, check=True, shell=True)
#run(['sbatch lvc_fssh_run.sh'], cwd=subfolder, check=True, shell=True)
#run(['sbatch fssh_run.sh'], cwd=subfolder, check=True, shell=True)
except KeyboardInterrupt or CalledProcessError:
break
print("Submitting", subfolder)


if __name__=='__main__':
all_traj = SubmitTrajectories()
all_traj.trajectories()
Loading