Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 3 additions & 10 deletions repsample_acetylcall.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,11 @@

oscillator_strengths_array = np.array(oscillator_strengths)
excitation_energies_cm_array = np.array(excitation_energies_cm)
excitation_energies_ev_array = excitation_energies_cm_array*(0.0001239841984)
excitation_energies_ev_array = excitation_energies_cm_array * 0.0001239841984

excitation_energies_help_array = excitation_energies_ev_array/27.211396
tdpx = np.sqrt((3*oscillator_strengths_array)/(2*excitation_energies_help_array))

trans_dip_mom_y = np.zeros((2000,3))
trans_dip_mom_z = np.zeros((2000,3))

MYGEOM = rstd.GeomReduction(2000, 3, 20, 1000, 8, 16, weighted=True, pdfcomp = "KLdiv", intweights=False, verbose=False, dim1=False) #create an instance of GeomReduction with specified parameters: 500 samples, 3 states, 20 representative molecules, 100 cycles, 1 core, 1 job, without weighting, using KL divergence for PDF comparison, no integer weights, and verbose off
MYGEOM = rstd.GeomReduction(2000, 3, 5, 1000, 8, 16, weighted=True, pdfcomp = "KLdiv", intweights=False, verbose=False, dim1=False) #create an instance of GeomReduction with specified parameters: 500 samples, 3 states, 20 representative molecules, 100 cycles, 1 core, 1 job, without weighting, using KL divergence for PDF comparison, no integer weights, and verbose off

np.random.seed(42) #set the seed for reproducibility


MYGEOM.read_data_direct(excitation_energies_ev_array, tdpx, trans_dip_mom_y, trans_dip_mom_z) #directly feed the generated data into the GeomReduction instance
MYGEOM.read_data_direct_osc(excitation_energies_ev_array, oscillator_strengths_array) #directly feed the generated data into the GeomReduction instance
MYGEOM.reduce_geoms() #start the geometry reduction process to select representative geometries
13 changes: 13 additions & 0 deletions src/pyneapples/rep_sampler_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,19 @@ def read_data_direct(self, excitation_energies, transition_dipole_moments_x, tra
self.weights = self.exc*self.trans #calculate the weight for each transition as the product of excitation energy and the (summed) dipole moment
self.wnorms = np.sum(self.weights, axis=0)/np.sum(self.weights) #provides a normalization factor for each state, ensuring that the weights are comparable across states

def read_data_direct_osc(self, excitation_energies, oscillator_stregths):

evs_in_au = 27.211396 # Conversion factor from electronvolts to atomic units

self.infile = "Test_Filename" #stores the filename

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird, but I'll clean this up later.

self.exc = excitation_energies # Assign excitation energies in eV units
self.time = datetime.datetime.now() #records the current date and time

self.trans = abs((3*oscillator_stregths)/(2*(self.exc/evs_in_au))) # Calculate transition dipole moment scaler value (as above) using energy in a.u.

self.weights = self.exc*self.trans #calculate the weight for each transition as the product of excitation energy and the (summed) dipole moment
self.wnorms = np.sum(self.weights, axis=0)/np.sum(self.weights) #provides a normalization factor for each state, ensuring that the weights are comparable across states


def read_data(self, infile):
"""Reads and parses input data from given input file."""
Expand Down