10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-04 21:23:56 +01:00

Merge branch 'dev-stable' of https://github.com/QuantumPackage/qp2 into dev-stable

This commit is contained in:
eginer 2024-05-03 16:24:22 +02:00
commit 96f2312bec
6 changed files with 35 additions and 18 deletions

View File

@ -22,10 +22,15 @@ let of_string ~units s =
} }
| [ name; x; y; z ] -> | [ name; x; y; z ] ->
let e = Element.of_string name in let e = Element.of_string name in
begin
try
{ element = e ; { element = e ;
charge = Element.to_charge e; charge = Element.to_charge e;
coord = Point3d.of_string ~units (String.concat " " [x; y; z]) coord = Point3d.of_string ~units (String.concat " " [x; y; z])
} }
with
| err -> (Printf.eprintf "name = \"%s\"\nxyz = (%s,%s,%s)\n%!" name x y z ; raise err)
end
| _ -> raise (AtomError s) | _ -> raise (AtomError s)

View File

@ -142,13 +142,21 @@ let of_xyz_string
result result
let regexp_r = Str.regexp {| |}
let regexp_t = Str.regexp {| |}
let of_xyz_file let of_xyz_file
?(charge=(Charge.of_int 0)) ?(multiplicity=(Multiplicity.of_int 1)) ?(charge=(Charge.of_int 0)) ?(multiplicity=(Multiplicity.of_int 1))
?(units=Units.Angstrom) ?(units=Units.Angstrom)
filename = filename =
let lines = let lines =
match Io_ext.input_lines filename with Io_ext.input_lines filename
|> List.map (fun s -> Str.global_replace regexp_r "" s)
|> List.map (fun s -> Str.global_replace regexp_t " " s)
in
let lines =
match lines with
| natoms :: title :: rest -> | natoms :: title :: rest ->
let natoms = let natoms =
try try
@ -173,6 +181,8 @@ let of_zmt_file
?(units=Units.Angstrom) ?(units=Units.Angstrom)
filename = filename =
Io_ext.read_all filename Io_ext.read_all filename
|> Str.global_replace regexp_r ""
|> Str.global_replace regexp_t " "
|> Zmatrix.of_string |> Zmatrix.of_string
|> Zmatrix.to_xyz_string |> Zmatrix.to_xyz_string
|> of_xyz_string ~charge ~multiplicity ~units |> of_xyz_string ~charge ~multiplicity ~units

View File

@ -24,7 +24,9 @@ let of_string ~units s =
let l = s let l = s
|> String_ext.split ~on:' ' |> String_ext.split ~on:' '
|> List.filter (fun x -> x <> "") |> List.filter (fun x -> x <> "")
|> list_map float_of_string |> list_map (fun x ->
try float_of_string x with
| Failure msg -> (Printf.eprintf "Bad string: \"%s\"\n%!" x ; failwith msg) )
|> Array.of_list |> Array.of_list
in in
{ x = l.(0) *. f ; { x = l.(0) *. f ;

View File

@ -106,7 +106,7 @@ doc: If |true|, the MO basis is assumed to be bi-orthonormal
interface: ezfio,provider,ocaml interface: ezfio,provider,ocaml
default: True default: True
[symetric_fock_tc] [symmetric_fock_tc]
type: logical type: logical
doc: If |true|, using F+F^t as Fock TC doc: If |true|, using F+F^t as Fock TC
interface: ezfio,provider,ocaml interface: ezfio,provider,ocaml

View File

@ -44,7 +44,7 @@ BEGIN_PROVIDER [ double precision, grad_hermit]
BEGIN_DOC BEGIN_DOC
! square of gradient of the energy ! square of gradient of the energy
END_DOC END_DOC
if(symetric_fock_tc)then if(symmetric_fock_tc)then
grad_hermit = grad_hermit_average_tc_fock_mat grad_hermit = grad_hermit_average_tc_fock_mat
else else
grad_hermit = grad_good_hermit_tc_fock_mat grad_hermit = grad_good_hermit_tc_fock_mat
@ -96,7 +96,7 @@ subroutine save_good_hermit_tc_eigvectors()
label = "Canonical" label = "Canonical"
output = .False. output = .False.
if(symetric_fock_tc)then if(symmetric_fock_tc)then
call mo_as_eigvectors_of_mo_matrix(hermit_average_tc_fock_mat, mo_num, mo_num, label, sign, output) call mo_as_eigvectors_of_mo_matrix(hermit_average_tc_fock_mat, mo_num, mo_num, label, sign, output)
else else
call mo_as_eigvectors_of_mo_matrix(good_hermit_tc_fock_mat, mo_num, mo_num, label, sign, output) call mo_as_eigvectors_of_mo_matrix(good_hermit_tc_fock_mat, mo_num, mo_num, label, sign, output)

View File

@ -327,12 +327,12 @@ subroutine wall_time(t)
end end
BEGIN_PROVIDER [ integer, nproc ] BEGIN_PROVIDER [ integer, nproc ]
use omp_lib
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Number of current OpenMP threads ! Number of current OpenMP threads
END_DOC END_DOC
integer, external :: omp_get_num_threads
nproc = 1 nproc = 1
!$OMP PARALLEL !$OMP PARALLEL
!$OMP MASTER !$OMP MASTER